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

Refactor most ServiceContainer references #2404

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

williamjallen
Copy link
Collaborator

The CDash Service Container was introduced to enable white-box unit testing for individual methods without needing a full environment to be set up. This approach has since been superseded by Laravel feature tests and Cypress tests as the preferred means of testing CDash. The excessive use of mocking in the CDash test suite has caused various portions of the test suite to diverge from the true behavior of CDash. There is a time and place for mocks, particularly for error conditions which cannot otherwise be reproduced, but the excessive use of mocking is a long-term liability.

While the goal is to eventually remove all of the service container logic, doing so immediately would decrease our test coverage by an unacceptable amount. This PR removes as much service container logic as possible while maintaining the majority of tests which need it. Importantly, this change allows our static analysis tools to perform more a more complete analysis since concrete types can be directly inferred in more places. As further refactoring work progresses, I expect the remaining service container logic to gradually become obsolete, rendering it possible to remove it in the future.

Copy link
Member

@josephsnyder josephsnyder left a comment

Choose a reason for hiding this comment

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

LGTM, no issues found with the tests or manual testing

@josephsnyder josephsnyder added this pull request to the merge queue Sep 9, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Sep 9, 2024
@williamjallen williamjallen added this pull request to the merge queue Sep 9, 2024
github-merge-queue bot pushed a commit that referenced this pull request Sep 9, 2024
The CDash Service Container was introduced to enable white-box unit
testing for individual methods without needing a full environment to be
set up. This approach has since been superseded by Laravel feature tests
and Cypress tests as the preferred means of testing CDash. The excessive
use of mocking in the CDash test suite has caused various portions of
the test suite to diverge from the true behavior of CDash. There is a
time and place for mocks, particularly for error conditions which cannot
otherwise be reproduced, but the excessive use of mocking is a long-term
liability.

While the goal is to eventually remove all of the service container
logic, doing so immediately would decrease our test coverage by an
unacceptable amount. This PR removes as much service container logic as
possible while maintaining the majority of tests which need it.
Importantly, this change allows our static analysis tools to perform
more a more complete analysis since concrete types can be directly
inferred in more places. As further refactoring work progresses, I
expect the remaining service container logic to gradually become
obsolete, rendering it possible to remove it in the future.
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Sep 9, 2024
@josephsnyder josephsnyder added this pull request to the merge queue Sep 10, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Sep 10, 2024
@williamjallen williamjallen marked this pull request as draft September 16, 2024 15:51
@williamjallen williamjallen modified the milestones: v3.6, v3.7 Sep 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants