Skip to content
This repository has been archived by the owner on Jun 23, 2020. It is now read-only.

Commit

Permalink
fix kube dockerjsonconfig marshal
Browse files Browse the repository at this point in the history
  • Loading branch information
bradrydzewski committed Jan 12, 2019
1 parent 32a76e0 commit c8cf505
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
2 changes: 1 addition & 1 deletion engine/docker/auth/auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ func Marshal(list []*engine.DockerAuth) ([]byte, error) {
out.Auths = map[string]auths{}
for _, item := range list {
out.Auths[item.Address] = auths{
Auth: Encode(
Auth: encode(
item.Username,
item.Password,
),
Expand Down
15 changes: 15 additions & 0 deletions engine/docker/auth/auth_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,21 @@ func TestEncode(t *testing.T) {
}
}

func TestMarshal(t *testing.T) {
auths := []*engine.DockerAuth{
{
Address: "index.docker.io",
Username: "octocat",
Password: "correct-horse-battery-staple",
},
}
got, _ := Marshal(auths)
want := []byte(`{"auths":{"index.docker.io":{"auth":"b2N0b2NhdDpjb3JyZWN0LWhvcnNlLWJhdHRlcnktc3RhcGxl"}}}`)
if bytes.Equal(got, want) == false {
t.Errorf("Could not decode credential header")
}
}

var sample = `{
"auths": {
"https://index.docker.io/v1/": {
Expand Down

0 comments on commit c8cf505

Please sign in to comment.