From 4990c711ecfbca3d4d063cb0ef0cfabde65aa856 Mon Sep 17 00:00:00 2001 From: Quique Llorente Date: Tue, 21 Jul 2020 10:12:41 +0200 Subject: [PATCH] Split test-suite-params by comma too apart from spaces Signed-off-by: Quique Llorente --- pkg/ginkgo-reporters/polarion_reporter.go | 9 ++++++++- pkg/ginkgo-reporters/polarion_reporter_test.go | 8 ++++++-- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/pkg/ginkgo-reporters/polarion_reporter.go b/pkg/ginkgo-reporters/polarion_reporter.go index 7ae5aaa..58b110c 100644 --- a/pkg/ginkgo-reporters/polarion_reporter.go +++ b/pkg/ginkgo-reporters/polarion_reporter.go @@ -103,7 +103,7 @@ func (reporter *PolarionReporter) SpecSuiteWillBegin(config config.GinkgoConfigT } valuesString := "" - suiteParams := strings.Split(reporter.TestSuiteParams, " ") + suiteParams := splitAny(reporter.TestSuiteParams, " ,") for _, s := range suiteParams { keyValue := strings.Split(s, "=") if len(keyValue) > 1 { @@ -259,3 +259,10 @@ func addProperty(properties []PolarionProperty, key string, value string) []Pola }) return properties } + +func splitAny(s string, seps string) []string { + splitter := func(r rune) bool { + return strings.ContainsRune(seps, r) + } + return strings.FieldsFunc(s, splitter) +} diff --git a/pkg/ginkgo-reporters/polarion_reporter_test.go b/pkg/ginkgo-reporters/polarion_reporter_test.go index 7148e93..242c573 100644 --- a/pkg/ginkgo-reporters/polarion_reporter_test.go +++ b/pkg/ginkgo-reporters/polarion_reporter_test.go @@ -55,7 +55,7 @@ var _ = Describe("ginkgo_reporters", func() { ProjectId: "QE", PlannedIn: "QE_1.0", LookupMethod: "id", - TestSuiteParams: "OS=EL7 SC=NFS", + TestSuiteParams: "OS=EL7 SC=NFS,ENV_TIER=TIER1", TestRunTemplate: "QE_Regression_template", TestRunTitle: "My run title", } @@ -70,6 +70,10 @@ var _ = Describe("ginkgo_reporters", func() { Name: "polarion-custom-SC", Value: "NFS", }, + { + Name: "polarion-custom-ENV_TIER", + Value: "TIER1", + }, { Name: "polarion-project-id", Value: "QE", @@ -84,7 +88,7 @@ var _ = Describe("ginkgo_reporters", func() { }, { Name: "polarion-testrun-id", - Value: "QE_1.0_EL7_NFS", + Value: "QE_1.0_EL7_NFS_TIER1", }, { Name: "polarion-custom-isautomated",