Stability: Resolve Envoy Test Service Data Race #8468
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Resolve data race in test service used in e2e tests
Context
The
envoy.Factory
is responsible for producing anenvoy.Instance
with necessary configuration. Historically, it also tracked each instance that was created, and when the Factory was cleaned up, it would go to each instance it was aware of and call instance.Clean on that instance. Cleaning an Envoy instance amounts to tearing down the process that is running the service.However, when an Envoy instance is Started, it is provided a context, and when that context is cancelled the service is auto-cleaned up (https://github.com/solo-io/gloo/blob/main/test/services/envoy/instance.go#L136). This way, we only have to worry about the test context, and all other resource lifecycles are tied to it.
The race occurred because the instances cleans itself up (when the test context is cancelled) AND the factory tries to call clean on the instance when the test suite is complete. Having both of these is actually unnecessary, so I just removed the implementation of the factory cleaning up the instances, since we expect instances to clean themselves up.
Checklist:
make -B install-go-tools generated-code
to ensure there will be no code diffBOT NOTES:
resolves https://github.com/solo-io/solo-projects/issues/5177