Skip to content

Commit

Permalink
fixed last test
Browse files Browse the repository at this point in the history
  • Loading branch information
fhennig committed Jan 28, 2025
1 parent ac0cad4 commit 89a77db
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1118,15 +1118,17 @@ class SubmissionDatabaseService(
}
}

fun useNewerProcessingPipelineIfPossible() {
SequenceEntriesTable.distinctOrganisms().forEach { organismName ->
useNewerProcessingPipelineIfPossible(organismName)
}
}
fun useNewerProcessingPipelineIfPossible(): Map<String, Long?> =
SequenceEntriesTable.distinctOrganisms().map { organismName ->
Pair(organismName, useNewerProcessingPipelineIfPossible(organismName))
}.toMap()

private fun useNewerProcessingPipelineIfPossible(organismName: String) {
/**
* Returns the new Version that was set for the organism, or null if nothing was changed.
*/
private fun useNewerProcessingPipelineIfPossible(organismName: String): Long? {
log.info("Checking for newer processing pipeline versions for organism '$organismName'")
transaction {
return transaction {
val newVersion = findNewPreprocessingPipelineVersion(organismName)
?: return@transaction null

Expand All @@ -1144,6 +1146,7 @@ class SubmissionDatabaseService(
val logMessage = "Started using results from new processing pipeline: version $newVersion"
log.info(logMessage)
auditLogger.log(logMessage)
newVersion
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,12 +162,8 @@ class DeleteAllSequenceDataEndpointTest(
.map { PreparedProcessedData.successfullyProcessed(accession = it.accession, version = it.version) }
submissionConvenienceClient.submitProcessedData(processedDataVersion2, pipelineVersion = 2)

val canUpdate = submissionDatabaseService.useNewerProcessingPipelineIfPossible()
// TODO this test fails, the assertion doesn't make sense anymore.
// I changed the function above to not return a value anymore.
// I think this wasn't good the way it was anyways. we should have an endpoint like
// /organism/currentProcessingPipelineVersion -> <version>
assertThat("An update to v2 should be possible", canUpdate, `is`(2L))
val newVersions = submissionDatabaseService.useNewerProcessingPipelineIfPossible()
assertThat("An update to v2 should be possible", newVersions["dummyOrganism"], `is`(2L))
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,7 @@ class GetReleasedDataEndpointWithDataUseTermsUrlTest(
@Autowired val convenienceClient: SubmissionConvenienceClient,
@Autowired val dataUseTermsClient: DataUseTermsControllerClient,
@Autowired val submissionControllerClient: SubmissionControllerClient,
@Autowired var dateProvider: DateProvider
@Autowired var dateProvider: DateProvider,
) {
@Test
fun `GIVEN sequence entry WHEN I change data use terms THEN returns updated data use terms`() {
Expand Down

0 comments on commit 89a77db

Please sign in to comment.