Skip to content
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

MNT Fix unit tests for kitchen-sink #10287

Merged

Conversation

emteknetnz
Copy link
Member

@emteknetnz emteknetnz commented Apr 22, 2022

Issue #10278

Should fix some of the travis errors in https://app.travis-ci.com/github/silverstripe/recipe-kitchen-sink/jobs/567740337 which only happen in recipe-kitchen-sink (not installer) due to interactions with other modules

@emteknetnz emteknetnz mentioned this pull request Apr 22, 2022
22 tasks
@GuySartorelli
Copy link
Member

This looks okay but I don't really understand what this is changing - could you put a few words about how this is fixing the tests? I wanna just make sure it's not hiding legitimate failures.

@emteknetnz
Copy link
Member Author

The change in setup means that calls in different tests to Director::forceWWW() and Director::forceSSL() don't carry over to other tests. They get reset between tests because setup() is run directly before each test.

The change in testRequestFilterInDirectorTest() is directly updating the middlewares in the Director singleton. Previously it was updating Injector so that (I think) when the Director singleton was instantiated for the first time it use the middlewares in config. I think what may have been happening is that something in one of the kitchen-sink modules was instantiating Director before the change in config.

In both of these instances, these tests do no fail on installer, only recipe-kitchen-sink. I wish I had more insight into why exactly this is happening, though I was unable to work out what was causing this.

Copy link
Member

@GuySartorelli GuySartorelli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems good to me, and the explanation makes sense. These changes are effectively making configuration for this test not affect other tests.

@GuySartorelli GuySartorelli merged commit b5bea0c into silverstripe:4.10 Apr 22, 2022
@GuySartorelli GuySartorelli deleted the pulls/4.10/director-tests branch April 22, 2022 03:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants