Merge pull request #87823 from tallclair/test-tokens
Ensure testing credentials are labeled as such Kubernetes-commit: 9c1e124b157cfe5a3943ae68bf74860bf0ec85c1
This commit is contained in:
commit
59f016d8b7
|
|
@ -572,7 +572,7 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "k8s.io/apimachinery",
|
"ImportPath": "k8s.io/apimachinery",
|
||||||
"Rev": "f30c02351710"
|
"Rev": "5e9e8834bd13"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "k8s.io/cli-runtime",
|
"ImportPath": "k8s.io/cli-runtime",
|
||||||
|
|
@ -580,7 +580,7 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "k8s.io/client-go",
|
"ImportPath": "k8s.io/client-go",
|
||||||
"Rev": "8a503c805acf"
|
"Rev": "0088fd151443"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "k8s.io/code-generator",
|
"ImportPath": "k8s.io/code-generator",
|
||||||
|
|
|
||||||
8
go.mod
8
go.mod
|
|
@ -37,9 +37,9 @@ require (
|
||||||
gopkg.in/yaml.v2 v2.2.8
|
gopkg.in/yaml.v2 v2.2.8
|
||||||
gotest.tools v2.2.0+incompatible // indirect
|
gotest.tools v2.2.0+incompatible // indirect
|
||||||
k8s.io/api v0.0.0-20200205090848-02edbc1d22f3
|
k8s.io/api v0.0.0-20200205090848-02edbc1d22f3
|
||||||
k8s.io/apimachinery v0.0.0-20200131032148-f30c02351710
|
k8s.io/apimachinery v0.0.0-20200205225706-5e9e8834bd13
|
||||||
k8s.io/cli-runtime v0.0.0-20200130074326-5f85d948d02a
|
k8s.io/cli-runtime v0.0.0-20200130074326-5f85d948d02a
|
||||||
k8s.io/client-go v0.0.0-20200205110617-8a503c805acf
|
k8s.io/client-go v0.0.0-20200207030102-0088fd151443
|
||||||
k8s.io/component-base v0.0.0-20200131033216-6bcd25baa4f4
|
k8s.io/component-base v0.0.0-20200131033216-6bcd25baa4f4
|
||||||
k8s.io/klog v1.0.0
|
k8s.io/klog v1.0.0
|
||||||
k8s.io/kube-openapi v0.0.0-20200121204235-bf4fb3bd569c
|
k8s.io/kube-openapi v0.0.0-20200121204235-bf4fb3bd569c
|
||||||
|
|
@ -54,9 +54,9 @@ replace (
|
||||||
golang.org/x/sys => golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a // pinned to release-branch.go1.13
|
golang.org/x/sys => golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a // pinned to release-branch.go1.13
|
||||||
golang.org/x/tools => golang.org/x/tools v0.0.0-20190821162956-65e3620a7ae7 // pinned to release-branch.go1.13
|
golang.org/x/tools => golang.org/x/tools v0.0.0-20190821162956-65e3620a7ae7 // pinned to release-branch.go1.13
|
||||||
k8s.io/api => k8s.io/api v0.0.0-20200205090848-02edbc1d22f3
|
k8s.io/api => k8s.io/api v0.0.0-20200205090848-02edbc1d22f3
|
||||||
k8s.io/apimachinery => k8s.io/apimachinery v0.0.0-20200131032148-f30c02351710
|
k8s.io/apimachinery => k8s.io/apimachinery v0.0.0-20200205225706-5e9e8834bd13
|
||||||
k8s.io/cli-runtime => k8s.io/cli-runtime v0.0.0-20200130074326-5f85d948d02a
|
k8s.io/cli-runtime => k8s.io/cli-runtime v0.0.0-20200130074326-5f85d948d02a
|
||||||
k8s.io/client-go => k8s.io/client-go v0.0.0-20200205110617-8a503c805acf
|
k8s.io/client-go => k8s.io/client-go v0.0.0-20200207030102-0088fd151443
|
||||||
k8s.io/code-generator => k8s.io/code-generator v0.0.0-20200130061103-7dfd5e9157ef
|
k8s.io/code-generator => k8s.io/code-generator v0.0.0-20200130061103-7dfd5e9157ef
|
||||||
k8s.io/component-base => k8s.io/component-base v0.0.0-20200131033216-6bcd25baa4f4
|
k8s.io/component-base => k8s.io/component-base v0.0.0-20200131033216-6bcd25baa4f4
|
||||||
k8s.io/metrics => k8s.io/metrics v0.0.0-20200130074207-b9a3a75a094d
|
k8s.io/metrics => k8s.io/metrics v0.0.0-20200130074207-b9a3a75a094d
|
||||||
|
|
|
||||||
4
go.sum
4
go.sum
|
|
@ -313,9 +313,9 @@ gotest.tools v2.2.0+incompatible/go.mod h1:DsYFclhRJ6vuDpmuTbkuFWG+y2sxOXAzmJt81
|
||||||
honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
|
honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
|
||||||
honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
|
honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
|
||||||
k8s.io/api v0.0.0-20200205090848-02edbc1d22f3/go.mod h1:C9pVgJPZJ6Vya/pyuzhd4qytMYQjdxSscnExZvbavLo=
|
k8s.io/api v0.0.0-20200205090848-02edbc1d22f3/go.mod h1:C9pVgJPZJ6Vya/pyuzhd4qytMYQjdxSscnExZvbavLo=
|
||||||
k8s.io/apimachinery v0.0.0-20200131032148-f30c02351710/go.mod h1:f7PPp70QzCGGLJHvCtiN2lePa9CdVddeAdL5w7NdrrU=
|
k8s.io/apimachinery v0.0.0-20200205225706-5e9e8834bd13/go.mod h1:f7PPp70QzCGGLJHvCtiN2lePa9CdVddeAdL5w7NdrrU=
|
||||||
k8s.io/cli-runtime v0.0.0-20200130074326-5f85d948d02a/go.mod h1:EvC9smXittI0hZcgIg9bwyNn8jYt/yKh89vxN6KyBOc=
|
k8s.io/cli-runtime v0.0.0-20200130074326-5f85d948d02a/go.mod h1:EvC9smXittI0hZcgIg9bwyNn8jYt/yKh89vxN6KyBOc=
|
||||||
k8s.io/client-go v0.0.0-20200205110617-8a503c805acf/go.mod h1:uhV/aC3mFzeOav8nUrAVLgxAbvfzorThQL2uxU+aeS8=
|
k8s.io/client-go v0.0.0-20200207030102-0088fd151443/go.mod h1:LIn3FaLIIKh8AmSUqHWhOC1XNF6F2kmVYMUSLdvVHCE=
|
||||||
k8s.io/code-generator v0.0.0-20200130061103-7dfd5e9157ef/go.mod h1:NAaJDQco+Cl4r3iPb/hSe4nHkLV7qLo851pX3qtK/Hs=
|
k8s.io/code-generator v0.0.0-20200130061103-7dfd5e9157ef/go.mod h1:NAaJDQco+Cl4r3iPb/hSe4nHkLV7qLo851pX3qtK/Hs=
|
||||||
k8s.io/component-base v0.0.0-20200131033216-6bcd25baa4f4/go.mod h1:3ihYk7gL8sAstCXPeoTf9MQ5V54QbAC5KWTNVAkDJjY=
|
k8s.io/component-base v0.0.0-20200131033216-6bcd25baa4f4/go.mod h1:3ihYk7gL8sAstCXPeoTf9MQ5V54QbAC5KWTNVAkDJjY=
|
||||||
k8s.io/gengo v0.0.0-20190128074634-0689ccc1d7d6/go.mod h1:ezvh/TsK7cY6rbqRK0oQQ8IAqLxYwwyPxAX1Pzy0ii0=
|
k8s.io/gengo v0.0.0-20190128074634-0689ccc1d7d6/go.mod h1:ezvh/TsK7cY6rbqRK0oQQ8IAqLxYwwyPxAX1Pzy0ii0=
|
||||||
|
|
|
||||||
|
|
@ -136,7 +136,7 @@ func TestSetNonExistentContext(t *testing.T) {
|
||||||
|
|
||||||
func TestSetIntoExistingStruct(t *testing.T) {
|
func TestSetIntoExistingStruct(t *testing.T) {
|
||||||
expectedConfig := newRedFederalCowHammerConfig()
|
expectedConfig := newRedFederalCowHammerConfig()
|
||||||
expectedConfig.AuthInfos["red-user"].Password = "new-path-value"
|
expectedConfig.AuthInfos["red-user"].Password = "new-path-value" // Fake value for testing.
|
||||||
test := configCommandTest{
|
test := configCommandTest{
|
||||||
args: []string{"set", "users.red-user.password", "new-path-value"},
|
args: []string{"set", "users.red-user.password", "new-path-value"},
|
||||||
startingConfig: newRedFederalCowHammerConfig(),
|
startingConfig: newRedFederalCowHammerConfig(),
|
||||||
|
|
@ -391,7 +391,7 @@ func TestBasicClearsToken(t *testing.T) {
|
||||||
|
|
||||||
authInfoWithBasic := clientcmdapi.NewAuthInfo()
|
authInfoWithBasic := clientcmdapi.NewAuthInfo()
|
||||||
authInfoWithBasic.Username = "myuser"
|
authInfoWithBasic.Username = "myuser"
|
||||||
authInfoWithBasic.Password = "mypass"
|
authInfoWithBasic.Password = "mypass" // Fake value for testing.
|
||||||
|
|
||||||
startingConfig := newRedFederalCowHammerConfig()
|
startingConfig := newRedFederalCowHammerConfig()
|
||||||
startingConfig.AuthInfos["another-user"] = authInfoWithToken
|
startingConfig.AuthInfos["another-user"] = authInfoWithToken
|
||||||
|
|
@ -411,7 +411,7 @@ func TestBasicClearsToken(t *testing.T) {
|
||||||
func TestTokenClearsBasic(t *testing.T) {
|
func TestTokenClearsBasic(t *testing.T) {
|
||||||
authInfoWithBasic := clientcmdapi.NewAuthInfo()
|
authInfoWithBasic := clientcmdapi.NewAuthInfo()
|
||||||
authInfoWithBasic.Username = "myuser"
|
authInfoWithBasic.Username = "myuser"
|
||||||
authInfoWithBasic.Password = "mypass"
|
authInfoWithBasic.Password = "mypass" // Fake value for testing.
|
||||||
|
|
||||||
authInfoWithToken := clientcmdapi.NewAuthInfo()
|
authInfoWithToken := clientcmdapi.NewAuthInfo()
|
||||||
authInfoWithToken.Token = "token"
|
authInfoWithToken.Token = "token"
|
||||||
|
|
|
||||||
|
|
@ -20,11 +20,12 @@ import (
|
||||||
"reflect"
|
"reflect"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"k8s.io/api/core/v1"
|
v1 "k8s.io/api/core/v1"
|
||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestSecretForDockerRegistryGenerate(t *testing.T) {
|
func TestSecretForDockerRegistryGenerate(t *testing.T) {
|
||||||
|
// Fake values for testing.
|
||||||
username, password, email, server := "test-user", "test-password", "test-user@example.org", "https://index.docker.io/v1/"
|
username, password, email, server := "test-user", "test-password", "test-user@example.org", "https://index.docker.io/v1/"
|
||||||
secretData, err := handleDockerCfgJSONContent(username, password, email, server)
|
secretData, err := handleDockerCfgJSONContent(username, password, email, server)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue