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

chore(backend): fix flaky test that made wrong assumptions about order being guaranteed #3234

Merged
merged 2 commits into from
Nov 19, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
package org.loculus.backend.controller.submission

import org.hamcrest.CoreMatchers.containsString
import org.hamcrest.CoreMatchers.hasItem
import org.hamcrest.CoreMatchers.`is`
import org.hamcrest.CoreMatchers.not
import org.hamcrest.MatcherAssert.assertThat
import org.hamcrest.Matchers.allOf
import org.hamcrest.Matchers.containsInAnyOrder
import org.hamcrest.Matchers.containsString
import org.hamcrest.Matchers.equalTo
import org.hamcrest.Matchers.hasEntry
import org.hamcrest.Matchers.hasItem
import org.hamcrest.Matchers.hasProperty
import org.hamcrest.Matchers.hasSize
import org.hamcrest.Matchers.`is`
import org.hamcrest.Matchers.not
import org.junit.jupiter.api.Test
import org.junit.jupiter.params.ParameterizedTest
import org.junit.jupiter.params.provider.MethodSource
Expand Down Expand Up @@ -309,6 +312,13 @@ class DeleteSequencesEndpointTest(
)
.submissionIdMappings

val expectedPairs = accessionVersions.map { entry ->
allOf(
hasEntry("accession", entry.accession),
hasEntry("version", entry.version.toInt()),
)
}

client.deleteSequenceEntries(
scope = ALL,
accessionVersionsFilter = accessionVersions,
Expand All @@ -317,8 +327,7 @@ class DeleteSequencesEndpointTest(
.andExpect(status().isOk)
.andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE))
.andExpect(jsonPath("\$.length()").value(accessionVersions.size))
.andExpect(jsonPath("\$[0].accession").value(accessionVersions.first().accession))
.andExpect(jsonPath("\$[0].version").value(accessionVersions.first().version))
.andExpect(jsonPath("\$[*]", containsInAnyOrder(*expectedPairs.toTypedArray())))
corneliusroemer marked this conversation as resolved.
Show resolved Hide resolved
}

@Test
Expand Down
Loading