Skip to content
This repository has been archived by the owner on Feb 16, 2021. It is now read-only.

Commit

Permalink
Update E2E tests to use new basic auth credentials (#53)
Browse files Browse the repository at this point in the history
  • Loading branch information
fabianlindfors committed Aug 23, 2019
1 parent 1b55e35 commit 41128ec
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 29 deletions.
4 changes: 2 additions & 2 deletions dev/scripts/evergreen-kubernetes-setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,5 @@ helm install svc-cat/catalog --name service-catalog --namespace catalog
kubectl rollout status --watch deployment/service-catalog-catalog-apiserver --namespace=catalog

echo "Add Docker image to cluster"
# docker image tag $docker_repo/$docker_name $docker_repo/$docker_name:e2e-test
kind load docker-image $docker_image
docker image tag $docker_image $docker_image:e2e-test
kind load docker-image $docker_image:e2e-test
36 changes: 9 additions & 27 deletions test/e2e/e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ var (
kubeClient *kubernetes.Clientset
svcatClient *servicecatalog.Clientset

atlasBaseURL = testutil.GetEnvOrPanic("ATLAS_GROUP_ID")
atlasGroupID = testutil.GetEnvOrPanic("ATLAS_BASE_URL")
atlasBaseURL = testutil.GetEnvOrPanic("ATLAS_BASE_URL")
atlasGroupID = testutil.GetEnvOrPanic("ATLAS_GROUP_ID")
atlasPublicKey = testutil.GetEnvOrPanic("ATLAS_PUBLIC_KEY")
atlasPrivateKey = testutil.GetEnvOrPanic("ATLAS_PRIVATE_KEY")
image = testutil.GetEnvOrPanic("DOCKER_IMAGE")
Expand Down Expand Up @@ -65,7 +65,7 @@ func TestCatalog(t *testing.T) {

// Ensure the service marketplace is empty.
classes, _ := svcatClient.ServicecatalogV1beta1().ServiceClasses(namespace).List(metav1.ListOptions{})
if assert.Emptyf(t, classes.Items, "Expected no service classes to exist") {
if !assert.Emptyf(t, classes.Items, "Expected no service classes to exist") {
return
}

Expand Down Expand Up @@ -111,7 +111,6 @@ func setupTest(t *testing.T) string {

err = registerBroker(namespace)
if err != nil {
fmt.Println(err)
t.Fatal(err)
}

Expand Down Expand Up @@ -167,30 +166,10 @@ func deployBroker(namespace string) error {
},
},
Env: []v1.EnvVar{
v1.EnvVar{
Name: "ATLAS_GROUP_ID",
Value: atlasGroupID,
},
v1.EnvVar{
Name: "ATLAS_BASE_URL",
Value: atlasBaseURL,
},
v1.EnvVar{
Name: "ATLAS_PUBLIC_KEY",
Value: atlasPublicKey,
},
v1.EnvVar{
Name: "ATLAS_PRIVATE_KEY",
Value: atlasPrivateKey,
},
v1.EnvVar{
Name: "BROKER_USERNAME",
Value: basicAuthUsername,
},
v1.EnvVar{
Name: "BROKER_PASSWORD",
Value: basicAuthPassword,
},
v1.EnvVar{
Name: "BROKER_HOST",
Value: "0.0.0.0",
Expand Down Expand Up @@ -236,15 +215,18 @@ func deployBroker(namespace string) error {
func registerBroker(namespace string) error {
authSecretName := name + "-auth"

username := atlasPublicKey + "@" + atlasGroupID
password := atlasPrivateKey

// Create secret to hold the basic auth credentials for the broker.
// The service catalog needs these to come from a secret.
// The broker expects Atlas API credentials as part of the basic auth.
kubeClient.CoreV1().Secrets(namespace).Create(&v1.Secret{
ObjectMeta: metav1.ObjectMeta{
Name: authSecretName,
},
Data: map[string][]byte{
"username": []byte(basicAuthUsername),
"password": []byte(basicAuthPassword),
"username": []byte(username),
"password": []byte(password),
},
})

Expand Down

0 comments on commit 41128ec

Please sign in to comment.