From a30abeea0340e99a98acf2b36632bc1ce4e53b33 Mon Sep 17 00:00:00 2001 From: brais <26645694+braisvq1996@users.noreply.github.com> Date: Mon, 26 Aug 2024 14:55:00 +0200 Subject: [PATCH] Release 4.5.5 (#1149) --- CHANGELOG.md | 5 +++++ src/org/ods/orchestration/util/Project.groovy | 2 +- .../ods/orchestration/util/ProjectSpec.groovy | 18 ++++++++++++++++++ 3 files changed, 24 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2d165dd20..b294b2a25 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,11 @@ ### Fixed * Fix Tailor deployment drifts for D, Q envs ([#1055](https://github.com/opendevstack/ods-jenkins-shared-library/pull/1055)) +## [4.5.5] - 2024-08-26 + +### Fixed +* Fix NPE when the test type is null ([#1146](https://github.com/opendevstack/ods-jenkins-shared-library/pull/1146)) + ## [4.5.4] - 2024-07-17 ### Changed diff --git a/src/org/ods/orchestration/util/Project.groovy b/src/org/ods/orchestration/util/Project.groovy index dc249c357..830cb3027 100644 --- a/src/org/ods/orchestration/util/Project.groovy +++ b/src/org/ods/orchestration/util/Project.groovy @@ -548,7 +548,7 @@ class Project { boolean hasGivenTypes(List testTypes, testIssue) { def result = true if (testTypes) { - result = testTypes*.toLowerCase().contains(testIssue.testType.toLowerCase()) + result = testTypes*.toLowerCase().contains(testIssue.testType?.toLowerCase()) } return result } diff --git a/test/groovy/org/ods/orchestration/util/ProjectSpec.groovy b/test/groovy/org/ods/orchestration/util/ProjectSpec.groovy index 392a71f69..b82fa1169 100644 --- a/test/groovy/org/ods/orchestration/util/ProjectSpec.groovy +++ b/test/groovy/org/ods/orchestration/util/ProjectSpec.groovy @@ -3255,4 +3255,22 @@ class ProjectSpec extends SpecHelper { !result } + def "check hasGivenTypes"() { + given: + def projectObj = new Project(steps, logger) + + when: + def resulFromExecution = projectObj.hasGivenTypes(testTypes, testIssue) + + then: + result == resulFromExecution + + where: + testTypes | testIssue | result + ['Unit', 'Integration', 'Installation', 'Acceptance'] | [testType: 'Unit'] | true + ['Integration', 'Installation', 'Acceptance'] | [testType: 'Unit'] | false + ['Unit', 'Integration', 'Installation', 'Acceptance'] | [testType: null] | false + ['Unit', 'Integration', 'Installation', 'Acceptance'] | [:] | false + } + }