From 8d81c6e27e9ac176652b2ef30f23b45edf34bf8b Mon Sep 17 00:00:00 2001 From: Sebastian Schuberth Date: Mon, 18 Nov 2024 19:43:30 +0100 Subject: [PATCH] refactor(scancode): Parameterize a test for easier version upgrades Signed-off-by: Sebastian Schuberth --- .../scancode/src/test/kotlin/ScanCodeResultParserTest.kt | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/plugins/scanners/scancode/src/test/kotlin/ScanCodeResultParserTest.kt b/plugins/scanners/scancode/src/test/kotlin/ScanCodeResultParserTest.kt index fac238fdaec00..5cd542c31d280 100644 --- a/plugins/scanners/scancode/src/test/kotlin/ScanCodeResultParserTest.kt +++ b/plugins/scanners/scancode/src/test/kotlin/ScanCodeResultParserTest.kt @@ -196,7 +196,7 @@ class ScanCodeResultParserTest : FreeSpec({ } } - "for output format 4.0.0 should" - { + "for output format ${MAX_SUPPORTED_OUTPUT_FORMAT_MAJOR_VERSION + 1}.0.0 should" - { "create an issue about an unsupported version" { val headers = """ { @@ -218,7 +218,7 @@ class ScanCodeResultParserTest : FreeSpec({ }, "start_timestamp": "2022-12-12T065635.691832", "end_timestamp": "2022-12-12T065637.770792", - "output_format_version": "4.0.0" + "output_format_version": "${MAX_SUPPORTED_OUTPUT_FORMAT_MAJOR_VERSION + 1}.0.0" } ], "files": [ @@ -231,8 +231,9 @@ class ScanCodeResultParserTest : FreeSpec({ summary.issues.map { it.copy(timestamp = Instant.EPOCH) } shouldHaveSingleElement Issue( timestamp = Instant.EPOCH, source = ScanCode.SCANNER_NAME, - message = "The output format version 4.0.0 exceeds the supported major version " + - "$MAX_SUPPORTED_OUTPUT_FORMAT_MAJOR_VERSION. Results may be incomplete or incorrect.", + message = "The output format version ${MAX_SUPPORTED_OUTPUT_FORMAT_MAJOR_VERSION + 1}.0.0 " + + "exceeds the supported major version $MAX_SUPPORTED_OUTPUT_FORMAT_MAJOR_VERSION. Results may " + + "be incomplete or incorrect.", severity = Severity.WARNING ) }