From e76585ace7a7299f81a1ac0b64e7e2456d5dd02a Mon Sep 17 00:00:00 2001 From: Bastian Hofmann Date: Mon, 18 May 2020 15:26:49 +0200 Subject: [PATCH] Add test case for GetKubeletDockerConfig This covers https://github.com/rancher/rancher/issues/27029 --- docker/docker_test.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/docker/docker_test.go b/docker/docker_test.go index 72626a46..66b9fa35 100644 --- a/docker/docker_test.go +++ b/docker/docker_test.go @@ -45,3 +45,15 @@ func TestPrivateRegistry(t *testing.T) { assert.Equal(t, a, a2) } + +func TestGetKubeletDockerConfig(t *testing.T) { + e := "{\"auths\":{\"https://registry.example.com\":{\"auth\":\"dXNlcjE6cGFzc3d+cmQ=\"}}}" + c, err := GetKubeletDockerConfig(map[string]v3.PrivateRegistry{ + "https://registry.example.com": v3.PrivateRegistry{ + User: "user1", + Password: "passw~rd", + }, + }) + assert.Nil(t, err) + assert.Equal(t, c, e) +}