loculus-project / loculus

An open-source software package to power microbial genomic databases
https://loculus.org
GNU Affero General Public License v3.0
37 stars 2 forks source link

Flaky backend test #3235

Closed corneliusroemer closed 3 days ago

corneliusroemer commented 3 days ago
          Now getting the following failures:
DeleteSequencesEndpointTest > WHEN superuser deletes all entries THEN is successfully deleted() FAILED
    java.lang.AssertionError: JSON path "$[0].accession" expected:<LOC_000001Y> but was:<LOC_000006N>
        at org.springframework.test.util.AssertionErrors.fail(AssertionErrors.java:59)
        at org.springframework.test.util.AssertionErrors.assertEquals(AssertionErrors.java:122)
        at org.springframework.test.util.JsonPathExpectationsHelper.assertValue(JsonPathExpectationsHelper.java:123)
        at org.springframework.test.web.servlet.result.JsonPathResultMatchers.lambda$value$2(JsonPathResultMatchers.java:111)
        at org.springframework.test.web.servlet.MockMvc$1.andExpect(MockMvc.java:214)
        at org.loculus.backend.controller.submission.DeleteSequencesEndpointTest.WHEN superuser deletes all entries THEN is successfully deleted(DeleteSequencesEndpointTest.kt:288)

DeleteSequencesEndpointTest > WHEN superuser deletes entries of other user THEN is successfully deleted() FAILED
    java.lang.AssertionError: JSON path "$[0].accession" expected:<LOC_000001Y> but was:<LOC_00000AE>
        at org.springframework.test.util.AssertionErrors.fail(AssertionErrors.java:59)
        at org.springframework.test.util.AssertionErrors.assertEquals(AssertionErrors.java:122)
        at org.springframework.test.util.JsonPathExpectationsHelper.assertValue(JsonPathExpectationsHelper.java:123)
        at org.springframework.test.web.servlet.result.JsonPathResultMatchers.lambda$value$2(JsonPathResultMatchers.java:111)
        at org.springframework.test.web.servlet.MockMvc$1.andExpect(MockMvc.java:214)
        at org.loculus.backend.controller.submission.DeleteSequencesEndpointTest.WHEN superuser deletes entries of other user THEN is successfully deleted(DeleteSequencesEndpointTest.kt:308)

This occurs after rerunning tests a second time on an existing database. So it's possible our tests expect an empty database which isn't great. We should probably not have that as an assumption in backend tests.

Originally posted by @corneliusroemer in https://github.com/loculus-project/loculus/issues/1084#issuecomment-2112402231