Skip to content

Commit

Permalink
Fix checkForImageStream to return correct result. (#3281)
Browse files Browse the repository at this point in the history
  • Loading branch information
zhengxiaomei123 authored Jun 2, 2020
1 parent e08aa97 commit 1f70c1b
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions tests/helper/helper_oc.go
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand All @@ -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 {
Expand Down

0 comments on commit 1f70c1b

Please sign in to comment.