diff --git a/src/silo/preprocessing/preprocessor.test.cpp b/src/silo/preprocessing/preprocessor.test.cpp index bb600762..9af65479 100644 --- a/src/silo/preprocessing/preprocessor.test.cpp +++ b/src/silo/preprocessing/preprocessor.test.cpp @@ -324,6 +324,24 @@ const Scenario DIVERSE_SEQUENCE_NAMES_NDJSON = { [{"count":2}])") }; +const Scenario PREVENT_LATE_AUTO_CASTING = { + .input_directory = "testBaseData/autoCasting/", + .expected_sequence_count = 3, + .query = R"( + { + "action": { + "type": "Details", + "orderByFields": ["accessionVersion"] + }, + "filterExpression": { + "type": "True" + } + } + )", + .expected_query_result = nlohmann::json::parse(R"( +[{"accessionVersion":"0"},{"accessionVersion":"0.12"},{"accessionVersion":"text_without_quotes"}])") +}; + class PreprocessorTestFixture : public ::testing::TestWithParam {}; INSTANTIATE_TEST_SUITE_P( @@ -345,7 +363,8 @@ INSTANTIATE_TEST_SUITE_P( EMPTY_INPUT_NDJSON_UNPARTITIONED, NO_GENES, NO_NUCLEOTIDE_SEQUENCES, - NO_SEQUENCES + NO_SEQUENCES, + PREVENT_LATE_AUTO_CASTING ), printTestName ); diff --git a/testBaseData/autoCasting/database_config.yaml b/testBaseData/autoCasting/database_config.yaml new file mode 100644 index 00000000..625311be --- /dev/null +++ b/testBaseData/autoCasting/database_config.yaml @@ -0,0 +1,6 @@ +schema: + instanceName: Test + metadata: + - name: accessionVersion + type: string + primaryKey: accessionVersion diff --git a/testBaseData/autoCasting/input.ndjson b/testBaseData/autoCasting/input.ndjson new file mode 100644 index 00000000..529f1bf0 --- /dev/null +++ b/testBaseData/autoCasting/input.ndjson @@ -0,0 +1,3 @@ +{"metadata": { "accessionVersion": 0 }, "unalignedNucleotideSequences": {}, "alignedNucleotideSequences": {}, "nucleotideInsertions": {}, "alignedAminoAcidSequences": {}, "aminoAcidInsertions": {}} +{"metadata": { "accessionVersion": 0.12 }, "unalignedNucleotideSequences": {}, "alignedNucleotideSequences": {}, "nucleotideInsertions": {}, "alignedAminoAcidSequences": {}, "aminoAcidInsertions": {}} +{"metadata": { "accessionVersion": "text_without_quotes" }, "unalignedNucleotideSequences": {}, "alignedNucleotideSequences": {}, "nucleotideInsertions": {}, "alignedAminoAcidSequences": {}, "aminoAcidInsertions": {}} diff --git a/testBaseData/autoCasting/preprocessing_config.yaml b/testBaseData/autoCasting/preprocessing_config.yaml new file mode 100644 index 00000000..a6772f53 --- /dev/null +++ b/testBaseData/autoCasting/preprocessing_config.yaml @@ -0,0 +1,2 @@ +ndjsonInputFilename: "input.ndjson" +referenceGenomeFilename: "reference_genomes.json" diff --git a/testBaseData/autoCasting/reference_genomes.json b/testBaseData/autoCasting/reference_genomes.json new file mode 100644 index 00000000..a5aa4c94 --- /dev/null +++ b/testBaseData/autoCasting/reference_genomes.json @@ -0,0 +1 @@ +{"genes":[],"nucleotideSequences":[]}