Skip to content

Commit

Permalink
Added backup service SA in test-suite
Browse files Browse the repository at this point in the history
  • Loading branch information
abhishekdwivedi3060 committed Jul 24, 2024
1 parent 00e667b commit be5c567
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 16 deletions.
16 changes: 0 additions & 16 deletions test/backup_service/backup_service_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,12 @@ import (
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
"github.com/onsi/gomega/gexec"
corev1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
k8Runtime "k8s.io/apimachinery/pkg/runtime"
"sigs.k8s.io/controller-runtime/pkg/client"
"sigs.k8s.io/controller-runtime/pkg/envtest"
logf "sigs.k8s.io/controller-runtime/pkg/log"
"sigs.k8s.io/controller-runtime/pkg/log/zap"

"github.com/aerospike/aerospike-kubernetes-operator/controllers/common"
"github.com/aerospike/aerospike-kubernetes-operator/test"
)

Expand All @@ -40,18 +36,6 @@ var _ = BeforeSuite(
var err error
testEnv, _, k8sClient, _, err = test.BootStrapTestEnv(scheme)
Expect(err).NotTo(HaveOccurred())

sa := corev1.ServiceAccount{
ObjectMeta: metav1.ObjectMeta{
Name: common.AerospikeBackupService,
Namespace: namespace,
},
}

err = k8sClient.Create(testCtx, &sa)
if err != nil && !errors.IsAlreadyExists(err) {
Fail(err.Error())
}
})

var _ = AfterSuite(
Expand Down
1 change: 1 addition & 0 deletions test/cleanup-test-namespace.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ for namespace in $namespaces; do

echo "Removing serviceaccount from namespace: $namespace"
kubectl -n "$namespace" delete serviceaccount aerospike-operator-controller-manager --ignore-not-found
kubectl -n "$namespace" delete serviceaccount aerospike-backup-service --ignore-not-found

done

Expand Down
5 changes: 5 additions & 0 deletions test/suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ import (
// +kubebuilder:scaffold:imports

asdbv1 "github.com/aerospike/aerospike-kubernetes-operator/api/v1"
"github.com/aerospike/aerospike-kubernetes-operator/controllers/common"
)

// These tests use Ginkgo (BDD-style Go testing framework). Refer to
Expand Down Expand Up @@ -91,6 +92,10 @@ var _ = BeforeSuite(
Expect(err).NotTo(HaveOccurred())
Expect(k8sClient).NotTo(BeNil())

// Create SA for aerospike backup service
err = createServiceAccount(k8sClient, goctx.TODO(), common.AerospikeBackupService, namespace)
Expect(err).ToNot(HaveOccurred())

// Setup by user function
// test creating resource
// IN operator namespace
Expand Down

0 comments on commit be5c567

Please sign in to comment.