Ensure (or re-assure) in tests that unwanted kubernetes resources aren't being created
Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.
Summary
Spawned out of the discussion for https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/30235#note_189786562
In some of our tests, we rely on WebMock failing examples in which unwanted resources would be created. I.e. instead of having tests along the lines of
it 'does not create "this unwanted resource" in this context' do
# ...
expect(...).not_to have_created_the_unwanted_resource
end
we just have tests that say
it 'does this thing that I want' { ... }
and assume that any unwanted resources are not created by virtue of the test passing.
There are several problems with this:
- it is implicit and not obvious
- it is fragile. With shared examples, nested contexts etc, it can be hard to keep track of all the request stubs that have been created
Improvements
It would be great if these cases could be covered more explicitly
Risks
Any solution is likely to make the tests more complex, and might not be any more effective than what is already in place
Involved components
Optional: Intended side effects
Optional: Missing test coverage
Edited by 🤖 GitLab Bot 🤖