summaryrefslogtreecommitdiff
path: root/test/utils/utils.go
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2020-10-29 18:00:33 +0100
committerGitHub <noreply@github.com>2020-10-29 18:00:33 +0100
commit6d72e7611e07c09ae2f4f9be799acd56179d66f9 (patch)
tree0a637ed92d3ee437582ea9be5ea203b1e7c00803 /test/utils/utils.go
parent74850052067c7a9c76c961fa06205388e9684be3 (diff)
parent20e104351dd4f85e56d49cca70dd9aaee8b72ffc (diff)
downloadpodman-6d72e7611e07c09ae2f4f9be799acd56179d66f9.tar.gz
podman-6d72e7611e07c09ae2f4f9be799acd56179d66f9.tar.bz2
podman-6d72e7611e07c09ae2f4f9be799acd56179d66f9.zip
Merge pull request #8165 from edsantiago/move_from_dockerio
Move from docker.io
Diffstat (limited to 'test/utils/utils.go')
-rw-r--r--test/utils/utils.go19
1 files changed, 9 insertions, 10 deletions
diff --git a/test/utils/utils.go b/test/utils/utils.go
index a45ce7b36..cb76d4a54 100644
--- a/test/utils/utils.go
+++ b/test/utils/utils.go
@@ -302,12 +302,7 @@ func (s *PodmanSession) LineInOutputContains(term string) bool {
// by podman-images(1).
func (s *PodmanSession) LineInOutputContainsTag(repo, tag string) bool {
tagMap := tagOutputToMap(s.OutputToStringArray())
- for r, t := range tagMap {
- if repo == r && tag == t {
- return true
- }
- }
- return false
+ return tagMap[repo][tag]
}
// IsJSONOutputValid attempts to unmarshal the session buffer
@@ -366,10 +361,11 @@ func StringInSlice(s string, sl []string) bool {
}
// tagOutPutToMap parses each string in imagesOutput and returns
-// a map of repo:tag pairs. Notice, the first array item will
+// a map whose key is a repo, and value is another map whose keys
+// are the tags found for that repo. Notice, the first array item will
// be skipped as it's considered to be the header.
-func tagOutputToMap(imagesOutput []string) map[string]string {
- m := make(map[string]string)
+func tagOutputToMap(imagesOutput []string) map[string]map[string]bool {
+ m := make(map[string]map[string]bool)
// iterate over output but skip the header
for _, i := range imagesOutput[1:] {
tmp := []string{}
@@ -383,7 +379,10 @@ func tagOutputToMap(imagesOutput []string) map[string]string {
if len(tmp) < 2 {
continue
}
- m[tmp[0]] = tmp[1]
+ if m[tmp[0]] == nil {
+ m[tmp[0]] = map[string]bool{}
+ }
+ m[tmp[0]][tmp[1]] = true
}
return m
}