Ensure testing credentials are labeled as such

This commit is contained in:
Tim Allclair
2020-02-04 10:36:05 -08:00
parent 4b29407945
commit 9d3670f358
32 changed files with 57 additions and 28 deletions

View File

@@ -0,0 +1 @@
Keys in this directory are generated for testing purposes only.

View File

@@ -0,0 +1 @@
Keys in this directory are generated for testing purposes only.

View File

@@ -0,0 +1 @@
Keys and secrets in this directory are generated for testing purposes only.

View File

@@ -0,0 +1 @@
Keys in this directory are generated for testing purposes only.

View File

@@ -1546,7 +1546,7 @@ func TestToken(t *testing.T) {
func TestUnmarshalClaimError(t *testing.T) {
// 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(`{
"token": "%s"
}`, token)

View File

@@ -479,7 +479,7 @@ func TestV1WebhookTokenAuthenticator(t *testing.T) {
expectedAuthenticated: false,
},
}
token := "my-s3cr3t-t0ken"
token := "my-s3cr3t-t0ken" // Fake token for testing.
for _, tt := range tests {
t.Run(tt.description, func(t *testing.T) {
wh, err := newV1TokenAuthenticator(s.URL, clientCert, clientKey, caCert, 0, tt.implicitAuds)

View File

@@ -481,7 +481,7 @@ func TestV1beta1WebhookTokenAuthenticator(t *testing.T) {
expectedAuthenticated: false,
},
}
token := "my-s3cr3t-t0ken"
token := "my-s3cr3t-t0ken" // Fake token for testing.
for _, tt := range tests {
t.Run(tt.description, func(t *testing.T) {
wh, err := newV1beta1TokenAuthenticator(s.URL, clientCert, clientKey, caCert, 0, tt.implicitAuds)

View File

@@ -296,7 +296,7 @@ func TestCertificateData(t *testing.T) {
func TestBasicAuthData(t *testing.T) {
username := "myuser"
password := "mypass"
password := "mypass" // Fake value for testing.
config := clientcmdapi.NewConfig()
config.Clusters["clean"] = &clientcmdapi.Cluster{

View File

@@ -0,0 +1 @@
Keys in this directory are generated for testing purposes only.

View File

@@ -136,7 +136,7 @@ func TestSetNonExistentContext(t *testing.T) {
func TestSetIntoExistingStruct(t *testing.T) {
expectedConfig := newRedFederalCowHammerConfig()
expectedConfig.AuthInfos["red-user"].Password = "new-path-value"
expectedConfig.AuthInfos["red-user"].Password = "new-path-value" // Fake value for testing.
test := configCommandTest{
args: []string{"set", "users.red-user.password", "new-path-value"},
startingConfig: newRedFederalCowHammerConfig(),
@@ -391,7 +391,7 @@ func TestBasicClearsToken(t *testing.T) {
authInfoWithBasic := clientcmdapi.NewAuthInfo()
authInfoWithBasic.Username = "myuser"
authInfoWithBasic.Password = "mypass"
authInfoWithBasic.Password = "mypass" // Fake value for testing.
startingConfig := newRedFederalCowHammerConfig()
startingConfig.AuthInfos["another-user"] = authInfoWithToken
@@ -411,7 +411,7 @@ func TestBasicClearsToken(t *testing.T) {
func TestTokenClearsBasic(t *testing.T) {
authInfoWithBasic := clientcmdapi.NewAuthInfo()
authInfoWithBasic.Username = "myuser"
authInfoWithBasic.Password = "mypass"
authInfoWithBasic.Password = "mypass" // Fake value for testing.
authInfoWithToken := clientcmdapi.NewAuthInfo()
authInfoWithToken.Token = "token"

View File

@@ -20,11 +20,12 @@ import (
"reflect"
"testing"
"k8s.io/api/core/v1"
v1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
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/"
secretData, err := handleDockerCfgJSONContent(username, password, email, server)
if err != nil {

View File

@@ -1484,6 +1484,7 @@ func TestProtocolTranslationUDP(t *testing.T) {
// Test Configuration deserialization (json)
func TestNewCloudFromJSON(t *testing.T) {
// Fake values for testing.
config := `{
"tenantId": "--tenant-id--",
"subscriptionId": "--subscription-id--",

View File

@@ -95,7 +95,7 @@ func TestReadConfig(t *testing.T) {
env := clearEnviron(t)
defer resetEnviron(t, env)
os.Setenv("OS_PASSWORD", "mypass")
os.Setenv("OS_PASSWORD", "mypass") // Fake value for testing.
defer os.Unsetenv("OS_PASSWORD")
os.Setenv("OS_TENANT_NAME", "admin")
@@ -174,7 +174,7 @@ func TestReadConfig(t *testing.T) {
func TestToAuthOptions(t *testing.T) {
cfg := Config{}
cfg.Global.Username = "user"
cfg.Global.Password = "pass"
cfg.Global.Password = "pass" // Fake value for testing.
cfg.Global.DomainID = "2a73b8f597c04551a0fdc8e95544be8a"
cfg.Global.DomainName = "local"
cfg.Global.AuthURL = "http://auth.url"
@@ -679,7 +679,7 @@ func TestInstanceIDFromProviderID(t *testing.T) {
func TestToAuth3Options(t *testing.T) {
cfg := Config{}
cfg.Global.Username = "user"
cfg.Global.Password = "pass"
cfg.Global.Password = "pass" // Fake value for testing.
cfg.Global.DomainID = "2a73b8f597c04551a0fdc8e95544be8a"
cfg.Global.DomainName = "local"
cfg.Global.AuthURL = "http://auth.url"

View File

@@ -0,0 +1 @@
Keys in this directory are generated for testing purposes only.

View File

@@ -75,6 +75,7 @@ W6CzB7pZ9Nj1YLpgzc1r6oONHLokMJJIz/IvkQ==
-----END CERTIFICATE-----`
// localhostKey is the private key for localhostCert.
// Fake value for testing.
var localhostKey = `-----BEGIN RSA PRIVATE KEY-----
MIIEowIBAAKCAQEA1Z5/aTwqY706M34tn60l8ZHkanWDl8mM1pYf4Q7qg3zA9XqW
LX6S4rTYDYCb4stEasC72lQnbEWHbthiQE76zubP8WOFHdvGR3mjAvHWz4FxvLOT
@@ -206,6 +207,7 @@ func TestReadConfig(t *testing.T) {
t.Errorf("Should fail when no config is provided: %s", err)
}
// Fake values for testing.
cfg, err := readConfig(strings.NewReader(`
[Global]
server = 0.0.0.0
@@ -823,7 +825,7 @@ func TestSecretVSphereConfig(t *testing.T) {
var vs *VSphere
var (
username = "user"
password = "password"
password = "password" // Fake value for testing.
)
var testcases = []struct {
testName string