Closed williammartin closed 5 years ago
:white_check_mark: Hey williammartin! The commit authors and yourself have already signed the CLA.
We have created an issue in Pivotal Tracker to manage this:
https://www.pivotaltracker.com/story/show/165132052
The labels on this github issue will be updated when the story is started.
Note also that before this PR, the tests would also probably fail if you ever turned on -randomizeAllSpecs
even in serial.
Hey @williammartin,
Nice catch! Thanks for the PR, looks good.
Best regards, @gdankov & @JulzDiverse
This is a tricksy race condition that occurs because the tests are currently not run in parallel by
ginkgo
in the eirini CI/contributor script. It also outlines that one of the tests wasn't testing expected behaviour at all.If the tests are run in parallel the tests fail with things like:
When the tests are run in serial, the
Expect(err).ToNot(HaveOccurred())
test passes, but in actual fact, thelrp
list is empty (unlike the context describes), because thelrps
variable only gets set after theopiClient.ListReturns(lrps, nil)
line. Then when the next test runs thelrps
variable had been set and the test passed.When run in parallel, there's no guarantee that
lrps
was actually set with 3 values, so the test panics.This same problem can manifest in multiple ways.
I've also set a default value for
lrps
in the higher levelBeforeEach
, which is idiomatic, such that if you were to create new contexts, they wouldn't inherit polluted values. I moved the related context up to highlight the coupling (that thelrps
is empty by default).