From 1f70c1b6667893c074217bc3ef05e9c387589b7e Mon Sep 17 00:00:00 2001 From: Zheng Xiao Mei Date: Tue, 2 Jun 2020 22:38:42 +0800 Subject: [PATCH] Fix checkForImageStream to return correct result. (#3281) --- tests/helper/helper_oc.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/helper/helper_oc.go b/tests/helper/helper_oc.go index 829211638d0..6db401ccfc2 100644 --- a/tests/helper/helper_oc.go +++ b/tests/helper/helper_oc.go @@ -264,8 +264,8 @@ func (oc OcRunner) SourceLocationBC(componentName string, appName string, projec // checkForImageStream checks if there is a ImageStram with name and tag in openshift namespace func (oc OcRunner) checkForImageStream(name string, tag string) bool { // first check if there is ImageStream with given name - names := CmdShouldPass(oc.path, "get", "is", "-n", "openshift", - "-o", "jsonpath='{range .items[*]}{.metadata.name}{\"\\n\"}{end}'") + names := strings.Trim(CmdShouldPass(oc.path, "get", "is", "-n", "openshift", + "-o", "jsonpath='{range .items[*]}{.metadata.name}{\"\\n\"}{end}'"), "'") scanner := bufio.NewScanner(strings.NewReader(names)) namePresent := false for scanner.Scan() { @@ -276,8 +276,8 @@ func (oc OcRunner) checkForImageStream(name string, tag string) bool { tagPresent := false // if there is a ImageStream check if there is a given tag if namePresent { - tags := CmdShouldPass(oc.path, "get", "is", name, "-n", "openshift", - "-o", "jsonpath='{range .spec.tags[*]}{.name}{\"\\n\"}{end}'") + tags := strings.Trim(CmdShouldPass(oc.path, "get", "is", name, "-n", "openshift", + "-o", "jsonpath='{range .spec.tags[*]}{.name}{\"\\n\"}{end}'"), "'") scanner := bufio.NewScanner(strings.NewReader(tags)) for scanner.Scan() { if scanner.Text() == tag {