mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-22 19:31:44 +00:00
Ensure testing credentials are labeled as such
This commit is contained in:
parent
4b29407945
commit
9d3670f358
1
cmd/kube-apiserver/app/testing/testdata/README.md
vendored
Normal file
1
cmd/kube-apiserver/app/testing/testdata/README.md
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
Keys in this directory are generated for testing purposes only.
|
1
hack/testdata/README.md
vendored
Normal file
1
hack/testdata/README.md
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
Keys in this directory are generated for testing purposes only.
|
1
pkg/client/testdata/README.md
vendored
Normal file
1
pkg/client/testdata/README.md
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
Keys in this directory are generated for testing purposes only.
|
1
pkg/controller/certificates/signer/testdata/README.md
vendored
Normal file
1
pkg/controller/certificates/signer/testdata/README.md
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
Keys in this directory are generated for testing purposes only.
|
@ -32,7 +32,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
const user = "foo"
|
const user = "foo"
|
||||||
const password = "1234567890abcdef"
|
const password = "1234567890abcdef" // Fake value for testing.
|
||||||
const email = "not@val.id"
|
const email = "not@val.id"
|
||||||
|
|
||||||
// Mock implementation
|
// Mock implementation
|
||||||
|
@ -63,6 +63,7 @@ func TestReadDockerConfigFile(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
func TestDockerConfigJsonJSONDecode(t *testing.T) {
|
func TestDockerConfigJsonJSONDecode(t *testing.T) {
|
||||||
|
// Fake values for testing.
|
||||||
input := []byte(`{"auths": {"http://foo.example.com":{"username": "foo", "password": "bar", "email": "foo@example.com"}, "http://bar.example.com":{"username": "bar", "password": "baz", "email": "bar@example.com"}}}`)
|
input := []byte(`{"auths": {"http://foo.example.com":{"username": "foo", "password": "bar", "email": "foo@example.com"}, "http://bar.example.com":{"username": "bar", "password": "baz", "email": "bar@example.com"}}}`)
|
||||||
|
|
||||||
expect := DockerConfigJson{
|
expect := DockerConfigJson{
|
||||||
@ -92,6 +93,7 @@ func TestDockerConfigJsonJSONDecode(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestDockerConfigJSONDecode(t *testing.T) {
|
func TestDockerConfigJSONDecode(t *testing.T) {
|
||||||
|
// Fake values for testing.
|
||||||
input := []byte(`{"http://foo.example.com":{"username": "foo", "password": "bar", "email": "foo@example.com"}, "http://bar.example.com":{"username": "bar", "password": "baz", "email": "bar@example.com"}}`)
|
input := []byte(`{"http://foo.example.com":{"username": "foo", "password": "bar", "email": "foo@example.com"}, "http://bar.example.com":{"username": "bar", "password": "baz", "email": "bar@example.com"}}`)
|
||||||
|
|
||||||
expect := DockerConfig(map[string]DockerConfigEntry{
|
expect := DockerConfig(map[string]DockerConfigEntry{
|
||||||
@ -126,6 +128,7 @@ func TestDockerConfigEntryJSONDecode(t *testing.T) {
|
|||||||
}{
|
}{
|
||||||
// simple case, just decode the fields
|
// simple case, just decode the fields
|
||||||
{
|
{
|
||||||
|
// Fake values for testing.
|
||||||
input: []byte(`{"username": "foo", "password": "bar", "email": "foo@example.com"}`),
|
input: []byte(`{"username": "foo", "password": "bar", "email": "foo@example.com"}`),
|
||||||
expect: DockerConfigEntry{
|
expect: DockerConfigEntry{
|
||||||
Username: "foo",
|
Username: "foo",
|
||||||
@ -148,6 +151,7 @@ func TestDockerConfigEntryJSONDecode(t *testing.T) {
|
|||||||
|
|
||||||
// auth field overrides username & password
|
// auth field overrides username & password
|
||||||
{
|
{
|
||||||
|
// Fake values for testing.
|
||||||
input: []byte(`{"username": "foo", "password": "bar", "auth": "cGluZzpwb25n", "email": "foo@example.com"}`),
|
input: []byte(`{"username": "foo", "password": "bar", "auth": "cGluZzpwb25n", "email": "foo@example.com"}`),
|
||||||
expect: DockerConfigEntry{
|
expect: DockerConfigEntry{
|
||||||
Username: "ping",
|
Username: "ping",
|
||||||
@ -284,6 +288,7 @@ func TestDockerConfigEntryJSONCompatibleEncode(t *testing.T) {
|
|||||||
}{
|
}{
|
||||||
// simple case, just decode the fields
|
// simple case, just decode the fields
|
||||||
{
|
{
|
||||||
|
// Fake values for testing.
|
||||||
expect: []byte(`{"username":"foo","password":"bar","email":"foo@example.com","auth":"Zm9vOmJhcg=="}`),
|
expect: []byte(`{"username":"foo","password":"bar","email":"foo@example.com","auth":"Zm9vOmJhcg=="}`),
|
||||||
input: DockerConfigEntry{
|
input: DockerConfigEntry{
|
||||||
Username: "foo",
|
Username: "foo",
|
||||||
|
@ -45,7 +45,7 @@ func TestDockerKeyringFromGoogleDockerConfigMetadata(t *testing.T) {
|
|||||||
registryURL := "hello.kubernetes.io"
|
registryURL := "hello.kubernetes.io"
|
||||||
email := "foo@bar.baz"
|
email := "foo@bar.baz"
|
||||||
username := "foo"
|
username := "foo"
|
||||||
password := "bar"
|
password := "bar" // Fake value for testing.
|
||||||
auth := base64.StdEncoding.EncodeToString([]byte(fmt.Sprintf("%s:%s", username, password)))
|
auth := base64.StdEncoding.EncodeToString([]byte(fmt.Sprintf("%s:%s", username, password)))
|
||||||
sampleDockerConfig := fmt.Sprintf(`{
|
sampleDockerConfig := fmt.Sprintf(`{
|
||||||
"https://%s": {
|
"https://%s": {
|
||||||
@ -118,7 +118,7 @@ func TestDockerKeyringFromGoogleDockerConfigMetadataUrl(t *testing.T) {
|
|||||||
registryURL := "hello.kubernetes.io"
|
registryURL := "hello.kubernetes.io"
|
||||||
email := "foo@bar.baz"
|
email := "foo@bar.baz"
|
||||||
username := "foo"
|
username := "foo"
|
||||||
password := "bar"
|
password := "bar" // Fake value for testing.
|
||||||
auth := base64.StdEncoding.EncodeToString([]byte(fmt.Sprintf("%s:%s", username, password)))
|
auth := base64.StdEncoding.EncodeToString([]byte(fmt.Sprintf("%s:%s", username, password)))
|
||||||
sampleDockerConfig := fmt.Sprintf(`{
|
sampleDockerConfig := fmt.Sprintf(`{
|
||||||
"https://%s": {
|
"https://%s": {
|
||||||
@ -197,7 +197,7 @@ func TestContainerRegistryBasics(t *testing.T) {
|
|||||||
for _, registryURL := range registryURLs {
|
for _, registryURL := range registryURLs {
|
||||||
t.Run(registryURL, func(t *testing.T) {
|
t.Run(registryURL, func(t *testing.T) {
|
||||||
email := "1234@project.gserviceaccount.com"
|
email := "1234@project.gserviceaccount.com"
|
||||||
token := &tokenBlob{AccessToken: "ya26.lots-of-indiscernible-garbage"}
|
token := &tokenBlob{AccessToken: "ya26.lots-of-indiscernible-garbage"} // Fake value for testing.
|
||||||
|
|
||||||
const (
|
const (
|
||||||
serviceAccountsEndpoint = "/computeMetadata/v1/instance/service-accounts/"
|
serviceAccountsEndpoint = "/computeMetadata/v1/instance/service-accounts/"
|
||||||
|
@ -193,7 +193,7 @@ func TestDockerKeyringForGlob(t *testing.T) {
|
|||||||
for i, test := range tests {
|
for i, test := range tests {
|
||||||
email := "foo@bar.baz"
|
email := "foo@bar.baz"
|
||||||
username := "foo"
|
username := "foo"
|
||||||
password := "bar"
|
password := "bar" // Fake value for testing.
|
||||||
auth := base64.StdEncoding.EncodeToString([]byte(fmt.Sprintf("%s:%s", username, password)))
|
auth := base64.StdEncoding.EncodeToString([]byte(fmt.Sprintf("%s:%s", username, password)))
|
||||||
sampleDockerConfig := fmt.Sprintf(`{
|
sampleDockerConfig := fmt.Sprintf(`{
|
||||||
"%s": {
|
"%s": {
|
||||||
@ -261,7 +261,7 @@ func TestKeyringMiss(t *testing.T) {
|
|||||||
for _, test := range tests {
|
for _, test := range tests {
|
||||||
email := "foo@bar.baz"
|
email := "foo@bar.baz"
|
||||||
username := "foo"
|
username := "foo"
|
||||||
password := "bar"
|
password := "bar" // Fake value for testing.
|
||||||
auth := base64.StdEncoding.EncodeToString([]byte(fmt.Sprintf("%s:%s", username, password)))
|
auth := base64.StdEncoding.EncodeToString([]byte(fmt.Sprintf("%s:%s", username, password)))
|
||||||
sampleDockerConfig := fmt.Sprintf(`{
|
sampleDockerConfig := fmt.Sprintf(`{
|
||||||
"%s": {
|
"%s": {
|
||||||
@ -289,7 +289,7 @@ func TestKeyringMissWithDockerHubCredentials(t *testing.T) {
|
|||||||
url := defaultRegistryKey
|
url := defaultRegistryKey
|
||||||
email := "foo@bar.baz"
|
email := "foo@bar.baz"
|
||||||
username := "foo"
|
username := "foo"
|
||||||
password := "bar"
|
password := "bar" // Fake value for testing.
|
||||||
auth := base64.StdEncoding.EncodeToString([]byte(fmt.Sprintf("%s:%s", username, password)))
|
auth := base64.StdEncoding.EncodeToString([]byte(fmt.Sprintf("%s:%s", username, password)))
|
||||||
sampleDockerConfig := fmt.Sprintf(`{
|
sampleDockerConfig := fmt.Sprintf(`{
|
||||||
"https://%s": {
|
"https://%s": {
|
||||||
@ -315,7 +315,7 @@ func TestKeyringHitWithUnqualifiedDockerHub(t *testing.T) {
|
|||||||
url := defaultRegistryKey
|
url := defaultRegistryKey
|
||||||
email := "foo@bar.baz"
|
email := "foo@bar.baz"
|
||||||
username := "foo"
|
username := "foo"
|
||||||
password := "bar"
|
password := "bar" // Fake value for testing.
|
||||||
auth := base64.StdEncoding.EncodeToString([]byte(fmt.Sprintf("%s:%s", username, password)))
|
auth := base64.StdEncoding.EncodeToString([]byte(fmt.Sprintf("%s:%s", username, password)))
|
||||||
sampleDockerConfig := fmt.Sprintf(`{
|
sampleDockerConfig := fmt.Sprintf(`{
|
||||||
"https://%s": {
|
"https://%s": {
|
||||||
@ -356,7 +356,7 @@ func TestKeyringHitWithUnqualifiedLibraryDockerHub(t *testing.T) {
|
|||||||
url := defaultRegistryKey
|
url := defaultRegistryKey
|
||||||
email := "foo@bar.baz"
|
email := "foo@bar.baz"
|
||||||
username := "foo"
|
username := "foo"
|
||||||
password := "bar"
|
password := "bar" // Fake value for testing.
|
||||||
auth := base64.StdEncoding.EncodeToString([]byte(fmt.Sprintf("%s:%s", username, password)))
|
auth := base64.StdEncoding.EncodeToString([]byte(fmt.Sprintf("%s:%s", username, password)))
|
||||||
sampleDockerConfig := fmt.Sprintf(`{
|
sampleDockerConfig := fmt.Sprintf(`{
|
||||||
"https://%s": {
|
"https://%s": {
|
||||||
@ -397,7 +397,7 @@ func TestKeyringHitWithQualifiedDockerHub(t *testing.T) {
|
|||||||
url := defaultRegistryKey
|
url := defaultRegistryKey
|
||||||
email := "foo@bar.baz"
|
email := "foo@bar.baz"
|
||||||
username := "foo"
|
username := "foo"
|
||||||
password := "bar"
|
password := "bar" // Fake value for testing.
|
||||||
auth := base64.StdEncoding.EncodeToString([]byte(fmt.Sprintf("%s:%s", username, password)))
|
auth := base64.StdEncoding.EncodeToString([]byte(fmt.Sprintf("%s:%s", username, password)))
|
||||||
sampleDockerConfig := fmt.Sprintf(`{
|
sampleDockerConfig := fmt.Sprintf(`{
|
||||||
"https://%s": {
|
"https://%s": {
|
||||||
@ -499,13 +499,13 @@ func TestProvidersDockerKeyring(t *testing.T) {
|
|||||||
func TestDockerKeyringLookup(t *testing.T) {
|
func TestDockerKeyringLookup(t *testing.T) {
|
||||||
ada := AuthConfig{
|
ada := AuthConfig{
|
||||||
Username: "ada",
|
Username: "ada",
|
||||||
Password: "smash",
|
Password: "smash", // Fake value for testing.
|
||||||
Email: "ada@example.com",
|
Email: "ada@example.com",
|
||||||
}
|
}
|
||||||
|
|
||||||
grace := AuthConfig{
|
grace := AuthConfig{
|
||||||
Username: "grace",
|
Username: "grace",
|
||||||
Password: "squash",
|
Password: "squash", // Fake value for testing.
|
||||||
Email: "grace@example.com",
|
Email: "grace@example.com",
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -566,7 +566,7 @@ func TestDockerKeyringLookup(t *testing.T) {
|
|||||||
func TestIssue3797(t *testing.T) {
|
func TestIssue3797(t *testing.T) {
|
||||||
rex := AuthConfig{
|
rex := AuthConfig{
|
||||||
Username: "rex",
|
Username: "rex",
|
||||||
Password: "tiny arms",
|
Password: "tiny arms", // Fake value for testing.
|
||||||
Email: "rex@example.com",
|
Email: "rex@example.com",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -64,6 +64,7 @@ WwIDAQAB
|
|||||||
// 3. URLSafe Base64-encoding the sha bytes
|
// 3. URLSafe Base64-encoding the sha bytes
|
||||||
const rsaKeyID = "JHJehTTTZlsspKHT-GaJxK7Kd1NQgZJu3fyK6K_QDYU"
|
const rsaKeyID = "JHJehTTTZlsspKHT-GaJxK7Kd1NQgZJu3fyK6K_QDYU"
|
||||||
|
|
||||||
|
// Fake value for testing.
|
||||||
const rsaPrivateKey = `-----BEGIN RSA PRIVATE KEY-----
|
const rsaPrivateKey = `-----BEGIN RSA PRIVATE KEY-----
|
||||||
MIIEowIBAAKCAQEA249XwEo9k4tM8fMxV7zxOhcrP+WvXn917koM5Qr2ZXs4vo26
|
MIIEowIBAAKCAQEA249XwEo9k4tM8fMxV7zxOhcrP+WvXn917koM5Qr2ZXs4vo26
|
||||||
e4ytdlrV0bQ9SlcLpQVSYjIxNfhTZdDt+ecIzshKuv1gKIxbbLQMOuK1eA/4HALy
|
e4ytdlrV0bQ9SlcLpQVSYjIxNfhTZdDt+ecIzshKuv1gKIxbbLQMOuK1eA/4HALy
|
||||||
@ -94,6 +95,7 @@ X024wzbiw1q07jFCyfQmODzURAx1VNT7QVUMdz/N8vy47/H40AZJ
|
|||||||
`
|
`
|
||||||
|
|
||||||
// openssl ecparam -name prime256v1 -genkey -noout -out ecdsa256.pem
|
// openssl ecparam -name prime256v1 -genkey -noout -out ecdsa256.pem
|
||||||
|
// Fake value for testing.
|
||||||
const ecdsaPrivateKey = `-----BEGIN EC PRIVATE KEY-----
|
const ecdsaPrivateKey = `-----BEGIN EC PRIVATE KEY-----
|
||||||
MHcCAQEEIEZmTmUhuanLjPA2CLquXivuwBDHTt5XYwgIr/kA1LtRoAoGCCqGSM49
|
MHcCAQEEIEZmTmUhuanLjPA2CLquXivuwBDHTt5XYwgIr/kA1LtRoAoGCCqGSM49
|
||||||
AwEHoUQDQgAEH6cuzP8XuD5wal6wf9M6xDljTOPLX2i8uIp/C/ASqiIGUeeKQtX0
|
AwEHoUQDQgAEH6cuzP8XuD5wal6wf9M6xDljTOPLX2i8uIp/C/ASqiIGUeeKQtX0
|
||||||
|
@ -48,6 +48,7 @@ func (l *lister) Get(name string) (*corev1.Secret, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
// Fake values for testing.
|
||||||
tokenID = "foobar" // 6 letters
|
tokenID = "foobar" // 6 letters
|
||||||
tokenSecret = "circumnavigation" // 16 letters
|
tokenSecret = "circumnavigation" // 16 letters
|
||||||
)
|
)
|
||||||
|
1
staging/src/k8s.io/apiextensions-apiserver/pkg/cmd/server/testing/testdata/README.md
vendored
Normal file
1
staging/src/k8s.io/apiextensions-apiserver/pkg/cmd/server/testing/testdata/README.md
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
Keys in this directory are generated for testing purposes only.
|
@ -0,0 +1 @@
|
|||||||
|
Keys in this directory are generated for testing purposes only.
|
@ -0,0 +1 @@
|
|||||||
|
Keys and secrets in this directory are generated for testing purposes only.
|
1
staging/src/k8s.io/apiserver/pkg/server/options/testdata/README.md
vendored
Normal file
1
staging/src/k8s.io/apiserver/pkg/server/options/testdata/README.md
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
Keys in this directory are generated for testing purposes only.
|
@ -1546,7 +1546,7 @@ func TestToken(t *testing.T) {
|
|||||||
|
|
||||||
func TestUnmarshalClaimError(t *testing.T) {
|
func TestUnmarshalClaimError(t *testing.T) {
|
||||||
// Ensure error strings returned by unmarshaling claims don't include the claim.
|
// Ensure error strings returned by unmarshaling claims don't include the claim.
|
||||||
const token = "96bb299a-02e9-11e8-8673-54ee7553240e"
|
const token = "96bb299a-02e9-11e8-8673-54ee7553240e" // Fake token for testing.
|
||||||
payload := fmt.Sprintf(`{
|
payload := fmt.Sprintf(`{
|
||||||
"token": "%s"
|
"token": "%s"
|
||||||
}`, token)
|
}`, token)
|
||||||
|
@ -479,7 +479,7 @@ func TestV1WebhookTokenAuthenticator(t *testing.T) {
|
|||||||
expectedAuthenticated: false,
|
expectedAuthenticated: false,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
token := "my-s3cr3t-t0ken"
|
token := "my-s3cr3t-t0ken" // Fake token for testing.
|
||||||
for _, tt := range tests {
|
for _, tt := range tests {
|
||||||
t.Run(tt.description, func(t *testing.T) {
|
t.Run(tt.description, func(t *testing.T) {
|
||||||
wh, err := newV1TokenAuthenticator(s.URL, clientCert, clientKey, caCert, 0, tt.implicitAuds)
|
wh, err := newV1TokenAuthenticator(s.URL, clientCert, clientKey, caCert, 0, tt.implicitAuds)
|
||||||
|
@ -481,7 +481,7 @@ func TestV1beta1WebhookTokenAuthenticator(t *testing.T) {
|
|||||||
expectedAuthenticated: false,
|
expectedAuthenticated: false,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
token := "my-s3cr3t-t0ken"
|
token := "my-s3cr3t-t0ken" // Fake token for testing.
|
||||||
for _, tt := range tests {
|
for _, tt := range tests {
|
||||||
t.Run(tt.description, func(t *testing.T) {
|
t.Run(tt.description, func(t *testing.T) {
|
||||||
wh, err := newV1beta1TokenAuthenticator(s.URL, clientCert, clientKey, caCert, 0, tt.implicitAuds)
|
wh, err := newV1beta1TokenAuthenticator(s.URL, clientCert, clientKey, caCert, 0, tt.implicitAuds)
|
||||||
|
@ -296,7 +296,7 @@ func TestCertificateData(t *testing.T) {
|
|||||||
|
|
||||||
func TestBasicAuthData(t *testing.T) {
|
func TestBasicAuthData(t *testing.T) {
|
||||||
username := "myuser"
|
username := "myuser"
|
||||||
password := "mypass"
|
password := "mypass" // Fake value for testing.
|
||||||
|
|
||||||
config := clientcmdapi.NewConfig()
|
config := clientcmdapi.NewConfig()
|
||||||
config.Clusters["clean"] = &clientcmdapi.Cluster{
|
config.Clusters["clean"] = &clientcmdapi.Cluster{
|
||||||
|
1
staging/src/k8s.io/client-go/util/cert/testdata/README.md
vendored
Normal file
1
staging/src/k8s.io/client-go/util/cert/testdata/README.md
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
Keys in this directory are generated for testing purposes only.
|
@ -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 {
|
||||||
|
@ -1484,6 +1484,7 @@ func TestProtocolTranslationUDP(t *testing.T) {
|
|||||||
|
|
||||||
// Test Configuration deserialization (json)
|
// Test Configuration deserialization (json)
|
||||||
func TestNewCloudFromJSON(t *testing.T) {
|
func TestNewCloudFromJSON(t *testing.T) {
|
||||||
|
// Fake values for testing.
|
||||||
config := `{
|
config := `{
|
||||||
"tenantId": "--tenant-id--",
|
"tenantId": "--tenant-id--",
|
||||||
"subscriptionId": "--subscription-id--",
|
"subscriptionId": "--subscription-id--",
|
||||||
|
@ -95,7 +95,7 @@ func TestReadConfig(t *testing.T) {
|
|||||||
env := clearEnviron(t)
|
env := clearEnviron(t)
|
||||||
defer resetEnviron(t, env)
|
defer resetEnviron(t, env)
|
||||||
|
|
||||||
os.Setenv("OS_PASSWORD", "mypass")
|
os.Setenv("OS_PASSWORD", "mypass") // Fake value for testing.
|
||||||
defer os.Unsetenv("OS_PASSWORD")
|
defer os.Unsetenv("OS_PASSWORD")
|
||||||
|
|
||||||
os.Setenv("OS_TENANT_NAME", "admin")
|
os.Setenv("OS_TENANT_NAME", "admin")
|
||||||
@ -174,7 +174,7 @@ func TestReadConfig(t *testing.T) {
|
|||||||
func TestToAuthOptions(t *testing.T) {
|
func TestToAuthOptions(t *testing.T) {
|
||||||
cfg := Config{}
|
cfg := Config{}
|
||||||
cfg.Global.Username = "user"
|
cfg.Global.Username = "user"
|
||||||
cfg.Global.Password = "pass"
|
cfg.Global.Password = "pass" // Fake value for testing.
|
||||||
cfg.Global.DomainID = "2a73b8f597c04551a0fdc8e95544be8a"
|
cfg.Global.DomainID = "2a73b8f597c04551a0fdc8e95544be8a"
|
||||||
cfg.Global.DomainName = "local"
|
cfg.Global.DomainName = "local"
|
||||||
cfg.Global.AuthURL = "http://auth.url"
|
cfg.Global.AuthURL = "http://auth.url"
|
||||||
@ -679,7 +679,7 @@ func TestInstanceIDFromProviderID(t *testing.T) {
|
|||||||
func TestToAuth3Options(t *testing.T) {
|
func TestToAuth3Options(t *testing.T) {
|
||||||
cfg := Config{}
|
cfg := Config{}
|
||||||
cfg.Global.Username = "user"
|
cfg.Global.Username = "user"
|
||||||
cfg.Global.Password = "pass"
|
cfg.Global.Password = "pass" // Fake value for testing.
|
||||||
cfg.Global.DomainID = "2a73b8f597c04551a0fdc8e95544be8a"
|
cfg.Global.DomainID = "2a73b8f597c04551a0fdc8e95544be8a"
|
||||||
cfg.Global.DomainName = "local"
|
cfg.Global.DomainName = "local"
|
||||||
cfg.Global.AuthURL = "http://auth.url"
|
cfg.Global.AuthURL = "http://auth.url"
|
||||||
|
@ -0,0 +1 @@
|
|||||||
|
Keys in this directory are generated for testing purposes only.
|
@ -75,6 +75,7 @@ W6CzB7pZ9Nj1YLpgzc1r6oONHLokMJJIz/IvkQ==
|
|||||||
-----END CERTIFICATE-----`
|
-----END CERTIFICATE-----`
|
||||||
|
|
||||||
// localhostKey is the private key for localhostCert.
|
// localhostKey is the private key for localhostCert.
|
||||||
|
// Fake value for testing.
|
||||||
var localhostKey = `-----BEGIN RSA PRIVATE KEY-----
|
var localhostKey = `-----BEGIN RSA PRIVATE KEY-----
|
||||||
MIIEowIBAAKCAQEA1Z5/aTwqY706M34tn60l8ZHkanWDl8mM1pYf4Q7qg3zA9XqW
|
MIIEowIBAAKCAQEA1Z5/aTwqY706M34tn60l8ZHkanWDl8mM1pYf4Q7qg3zA9XqW
|
||||||
LX6S4rTYDYCb4stEasC72lQnbEWHbthiQE76zubP8WOFHdvGR3mjAvHWz4FxvLOT
|
LX6S4rTYDYCb4stEasC72lQnbEWHbthiQE76zubP8WOFHdvGR3mjAvHWz4FxvLOT
|
||||||
@ -206,6 +207,7 @@ func TestReadConfig(t *testing.T) {
|
|||||||
t.Errorf("Should fail when no config is provided: %s", err)
|
t.Errorf("Should fail when no config is provided: %s", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Fake values for testing.
|
||||||
cfg, err := readConfig(strings.NewReader(`
|
cfg, err := readConfig(strings.NewReader(`
|
||||||
[Global]
|
[Global]
|
||||||
server = 0.0.0.0
|
server = 0.0.0.0
|
||||||
@ -823,7 +825,7 @@ func TestSecretVSphereConfig(t *testing.T) {
|
|||||||
var vs *VSphere
|
var vs *VSphere
|
||||||
var (
|
var (
|
||||||
username = "user"
|
username = "user"
|
||||||
password = "password"
|
password = "password" // Fake value for testing.
|
||||||
)
|
)
|
||||||
var testcases = []struct {
|
var testcases = []struct {
|
||||||
testName string
|
testName string
|
||||||
|
1
test/images/agnhost/porter/README.md
Normal file
1
test/images/agnhost/porter/README.md
Normal file
@ -0,0 +1 @@
|
|||||||
|
Keys in this directory are generated for testing purposes only.
|
@ -3,3 +3,7 @@
|
|||||||
* The container needs to run with docker --privileged
|
* The container needs to run with docker --privileged
|
||||||
|
|
||||||
block.tar.gz is a small ext2 filesystem created by `create_block.sh` (run as root!)
|
block.tar.gz is a small ext2 filesystem created by `create_block.sh` (run as root!)
|
||||||
|
|
||||||
|
# Credentials
|
||||||
|
|
||||||
|
Credentials in this directory are generated for testing purposes only.
|
||||||
|
@ -45,6 +45,7 @@ import (
|
|||||||
func TestNodeAuthorizer(t *testing.T) {
|
func TestNodeAuthorizer(t *testing.T) {
|
||||||
const (
|
const (
|
||||||
// Define credentials
|
// Define credentials
|
||||||
|
// Fake values for testing.
|
||||||
tokenMaster = "master-token"
|
tokenMaster = "master-token"
|
||||||
tokenNodeUnknown = "unknown-token"
|
tokenNodeUnknown = "unknown-token"
|
||||||
tokenNode1 = "node1-token"
|
tokenNode1 = "node1-token"
|
||||||
|
@ -54,6 +54,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
// Fake values for testing.
|
||||||
AliceToken string = "abc123" // username: alice. Present in token file.
|
AliceToken string = "abc123" // username: alice. Present in token file.
|
||||||
BobToken string = "xyz987" // username: bob. Present in token file.
|
BobToken string = "xyz987" // username: bob. Present in token file.
|
||||||
)
|
)
|
||||||
|
@ -46,7 +46,7 @@ import (
|
|||||||
|
|
||||||
const (
|
const (
|
||||||
secretKey = "api_key"
|
secretKey = "api_key"
|
||||||
secretVal = "086a7ffc-0225-11e8-ba89-0ed5f89f718b"
|
secretVal = "086a7ffc-0225-11e8-ba89-0ed5f89f718b" // Fake value for testing.
|
||||||
encryptionConfigFileName = "encryption.conf"
|
encryptionConfigFileName = "encryption.conf"
|
||||||
testNamespace = "secret-encryption-test"
|
testNamespace = "secret-encryption-test"
|
||||||
testSecret = "test-secret"
|
testSecret = "test-secret"
|
||||||
|
@ -55,7 +55,7 @@ import (
|
|||||||
|
|
||||||
const (
|
const (
|
||||||
rootUserName = "root"
|
rootUserName = "root"
|
||||||
rootToken = "root-user-token"
|
rootToken = "root-user-token" // Fake value for testing.
|
||||||
|
|
||||||
readOnlyServiceAccountName = "ro"
|
readOnlyServiceAccountName = "ro"
|
||||||
readWriteServiceAccountName = "rw"
|
readWriteServiceAccountName = "rw"
|
||||||
|
@ -89,7 +89,7 @@ func TestComponentSecureServingAndAuth(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// authenticate to apiserver via bearer token
|
// authenticate to apiserver via bearer token
|
||||||
token := "flwqkenfjasasdfmwerasd"
|
token := "flwqkenfjasasdfmwerasd" // Fake token for testing.
|
||||||
tokenFile, err := ioutil.TempFile("", "kubeconfig")
|
tokenFile, err := ioutil.TempFile("", "kubeconfig")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
|
Loading…
Reference in New Issue
Block a user