summaryrefslogtreecommitdiff
path: root/libpod/image/pull_test.go
diff options
context:
space:
mode:
authorMiloslav Trmač <mitr@redhat.com>2018-07-28 06:42:43 +0200
committerAtomic Bot <atomic-devel@projectatomic.io>2018-08-01 18:22:59 +0000
commitdbe2395769933a53058e81386f8f7a072acd15a2 (patch)
treea90b245a29cd4eb396b472a8db883d2f4a83abed /libpod/image/pull_test.go
parent8d73e456631ac283eb238584f963ee0df8c84973 (diff)
downloadpodman-dbe2395769933a53058e81386f8f7a072acd15a2.tar.gz
podman-dbe2395769933a53058e81386f8f7a072acd15a2.tar.bz2
podman-dbe2395769933a53058e81386f8f7a072acd15a2.zip
Do not re-parse the list of search registries just for an error message
... when we even only count them. This eliminates a rare error case, and saves time re-reading and re-parsing the input. (We still compute registryPath redundantly, and it may get out of sync.) Should not change behavior (but does not add unit tests). Signed-off-by: Miloslav Trmač <mitr@redhat.com> Closes: #1176 Approved by: rhatdan
Diffstat (limited to 'libpod/image/pull_test.go')
-rw-r--r--libpod/image/pull_test.go6
1 files changed, 6 insertions, 0 deletions
diff --git a/libpod/image/pull_test.go b/libpod/image/pull_test.go
index 3a914526d..13ba759c8 100644
--- a/libpod/image/pull_test.go
+++ b/libpod/image/pull_test.go
@@ -200,6 +200,7 @@ func TestPullGoalNamesFromImageReference(t *testing.T) {
}
assert.Equal(t, c.expectedPullAllPairs, res.pullAllPairs, c.srcName)
assert.False(t, res.usedSearchRegistries, c.srcName)
+ assert.Nil(t, res.searchedRegistries, c.srcName)
}
}
}
@@ -326,6 +327,11 @@ func TestPullGoalNamesFromPossiblyUnqualifiedName(t *testing.T) {
assert.Equal(t, c.expected, strings, c.input)
assert.False(t, res.pullAllPairs, c.input)
assert.Equal(t, c.expectedUsedSearchRegistries, res.usedSearchRegistries, c.input)
+ if !c.expectedUsedSearchRegistries {
+ assert.Nil(t, res.searchedRegistries, c.input)
+ } else {
+ assert.Equal(t, []string{"example.com", "docker.io"}, res.searchedRegistries, c.input)
+ }
}
}
}