Skip to content
This repository has been archived by the owner on Jun 29, 2022. It is now read-only.

Commit

Permalink
test/gangway: add test for service account
Browse files Browse the repository at this point in the history
  • Loading branch information
iaguis committed Oct 20, 2020
1 parent 44ec5c7 commit e7fa41c
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions test/components/gangway/gangway_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,11 @@
package gangway

import (
"context"
"testing"

metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"

testutil "github.com/kinvolk/lokomotive/test/components/util"
)

Expand All @@ -35,3 +38,22 @@ func TestGangwayDeployment(t *testing.T) {
testutil.WaitForDeployment(t, client, namespace, deployment, testutil.RetryInterval, testutil.Timeout)
})
}

func TestGangwayServiceAccount(t *testing.T) {
namespace := "gangway"
deployment := "gangway"
expectedServiceAccountName := "gangway"

client := testutil.CreateKubeClient(t)

testutil.WaitForDeployment(t, client, namespace, deployment, testutil.RetryInterval, testutil.Timeout)

deploy, err := client.AppsV1().Deployments(namespace).Get(context.TODO(), deployment, metav1.GetOptions{})
if err != nil {
t.Fatalf("Couldn't find gangway deployment")
}

if deploy.Spec.Template.Spec.ServiceAccountName != expectedServiceAccountName {
t.Fatalf("Expected serviceAccountName %q, got: %q", deploy.Spec.Template.Spec.ServiceAccountName, deploy.Spec.Template.Spec.ServiceAccountName)
}
}

0 comments on commit e7fa41c

Please sign in to comment.