-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Don't call bootstrapValidate commands repeatedly, and add --uri tests #3978
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
tests/functional/CoreTest.php
Outdated
| fwrite($fp, ' | ||
| $sites["test.uri"] = "dev"; | ||
| $sites["test.uri.subpath"] = "stage"; | ||
| '); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure if I should have reverted sites.php after this test finishes... You're not using "test.uri" anywhere else apparently, because tests still succeed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't hurt to leave sites.php in place; you could even commit this to the git repository if you wanted. Optional.
|
I'm not sure about the test (someone else should review it), but the bootstrapValidate() change looks right to me. I'll merge just that part, unless @greg-1-anderson chimes in otherwise. |
| // Test whether a URI in a config file resolves correctly, and test | ||
| // various URI values for their expected Site URI and path. | ||
| $drush_config_file = Path::join($this->webrootSlashDrush(), 'drush.yml'); | ||
| $test_uri = 'http://test.uri'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We still want to test with --uri=http://test.uri. Looks like you removed this test.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Two answers, to make surer I'm not misinterpreting:
- This test is still being done; it's just done as part of the loop.
- This (the current/old test) isn't testing with --uri=http://test.uri; it's only writing "http://test.uri" to the config file and testing with --uri=OMIT on the commandline. It's slightly hard to see because of naming, that $options_with_uri is not the --uri option on the commandline. Which is also why I renamed the variables.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I could add a new drush invocation that tests --uri on the commandline (not writing config fille), though. Either with only one flag, or with all of them as part of the loop.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll have to re-read it later in context, but I think that $options_with_uri does have the --uri option on the commandline. At least that was my impression.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, I see now. Tests look good.
greg-1-anderson
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Basic changes to bootstrapping look right, but we want to continue to test with test.uri to make sure everything is still working. Make your sites.php test in addition to the tests that were there before. I don't think you even need to dynamically write sites.php; we could just add it to the sut and commit it, I think.
greg-1-anderson
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I misread the code earlier. Tests look good. +1 on merging the whole thing once the tests come back green again.
|
Pushed a 3rd commit moving the $sites configuration into sut/sites/example.sites.php as suggested... since that is the file which is copied. Commit can be deleted if it turns out that keeping example.sites.php pristine is a better idea. |
|
I forgot that we overwrite sites.php with example.sites.php repeatedly. Modifying example.sites.php would be okay, but Drupal Scaffold is going to overwrite this on |
|
If we set @weitzman Do you have a preference about committing example.sites.php vs dynamically writing sites.php? |
|
I dont have a preference. |
|
I have a slight preference for committing static fixtures; I'll add the Drupal Scaffold exclude and merge in a little bit. |
|
We are not using Drupal Scaffold at the moment, so this is good to go. |
These are two followups to #3847 which are not super related, but I hope putting them in one PR turns out to be less work.
I'm going to just assume that was not intentional and that it can be fixed this way.
--
So here it is. I'm guessing a fairly simple addition to CoreTest::testOptionsUri() will do the trick, even though that means it's now used to test two slightly different things.
Note - I just assumed that the 'expected' URLs are the ones that are returned by 'drush status' at this moment. I'm not 100% sure if that's true; you're in a better position to judge:
--
If this PR (containing both commits) is applied to the commit from before #3847, the test for "--uri=test.uri/subpath" fails as expected.