drone-kaniko/cmd/kaniko-ecr/main_test.go
surtur ab07d57e85
All checks were successful
continuous-integration/drone/push Build is passing
Merge remote-tracking branch 'upstream/main' into merge-main
2022-03-26 17:15:57 +01:00

32 lines
655 B
Go

package main
import (
"reflect"
"testing"
"git.dotya.ml/wanderer/drone-kaniko/pkg/docker"
)
func TestCreateDockerConfig(t *testing.T) {
got, err := createDockerConfig(
"docker-username",
"docker-password",
"access-key",
"secret-key",
"ecr-registry",
false,
)
if err != nil {
t.Error("failed to create docker config")
}
want := docker.NewConfig()
want.SetAuth(docker.RegistryV1, "docker-username", "docker-password")
want.SetCredHelper(docker.RegistryECRPublic, "ecr-login")
want.SetCredHelper("ecr-registry", "ecr-login")
if !reflect.DeepEqual(want, got) {
t.Errorf("not equal:\n want: %#v\n got: %#v", want, got)
}
}