Use labels only when default namespace is provided and prefer given

options.

Implements same approach of setting defaults for `NewWithConn`.

Signed-off-by: Nikhil Soni <krsoninikhil@gmail.com>
This commit is contained in:
Nikhil Soni
2018-09-18 02:41:47 +05:30
parent 59432aaecf
commit 34323985a1
3 changed files with 27 additions and 14 deletions

View File

@@ -405,11 +405,12 @@ func TestDefaultRuntimeWithNamespaceLabels(t *testing.T) {
defer cancel()
namespaces := client.NamespaceService()
testRuntime := "testRuntime"
if err := namespaces.SetLabel(ctx, testNamespace, "runtime", testRuntime); err != nil {
runtimeLabel := "containerd.io/defaults/runtime"
if err := namespaces.SetLabel(ctx, testNamespace, runtimeLabel, testRuntime); err != nil {
t.Fatal(err)
}
testClient, err := newClient(t, address, WithDefaultNamespace(testNamespace))
testClient, err := New(address, WithDefaultNamespace(testNamespace))
if err != nil {
t.Fatal(err)
}