Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhance E2E Test Suite to support Parallel Execution #833

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -204,9 +204,9 @@ test-e2e: $(KUBECTL) $(HELM) $(SKAFFOLD) $(KUSTOMIZE)
@VERSION=$(VERSION) GIT_SHA=$(GIT_SHA) $(HACK_DIR)/e2e-test/run-e2e-test.sh $(PROVIDERS)

.PHONY: ci-e2e-kind
ci-e2e-kind:
ci-e2e-kind: $(GINKGO)
@BUCKET_NAME=$(BUCKET_NAME) $(HACK_DIR)/ci-e2e-kind.sh

.PHONY: ci-e2e-kind-azure
ci-e2e-kind-azure:
ci-e2e-kind-azure: $(GINKGO)
@BUCKET_NAME=$(BUCKET_NAME) $(HACK_DIR)/ci-e2e-kind-azure.sh
2 changes: 1 addition & 1 deletion hack/e2e-test/run-e2e-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ function test_e2e {
echo "-------------------"

SOURCE_PATH=$PWD \
go test -timeout=0 ./test/e2e --v -args -ginkgo.v -ginkgo.show-node-events
ginkgo -v -p ./test/e2e
fi
}

Expand Down
34 changes: 9 additions & 25 deletions test/e2e/etcd_backup_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import (
"time"

"github.com/gardener/etcd-druid/api/v1alpha1"
druidstore "github.com/gardener/etcd-druid/internal/store"

brtypes "github.com/gardener/etcd-backup-restore/pkg/types"
"github.com/gardener/gardener/pkg/utils/test/matchers"
Expand Down Expand Up @@ -49,32 +48,11 @@ var _ = Describe("Etcd Backup", func() {
provider := p
Context(fmt.Sprintf("with provider %s", provider.Name), func() {
BeforeEach(func() {
etcdName = fmt.Sprintf("etcd-%s", provider.Name)
etcdName = fmt.Sprintf("etcd-single-node-%s", provider.Name)
storePrefix = etcdName
storageContainer = getEnvAndExpectNoError(envStorageContainer)

By("Purge snapstore")
snapstoreProvider := provider.Storage.Provider
if snapstoreProvider == druidstore.Local {
purgeLocalSnapstoreJob := purgeLocalSnapstore(parentCtx, cl, storageContainer)
defer cleanUpTestHelperJob(parentCtx, cl, purgeLocalSnapstoreJob.Name)
} else {
store, err := getSnapstore(string(snapstoreProvider), storageContainer, storePrefix)
Expect(err).ShouldNot(HaveOccurred())
Expect(purgeSnapstore(store)).To(Succeed())
}
})

AfterEach(func() {
ctx, cancelFunc := context.WithTimeout(parentCtx, 10*time.Minute)
defer cancelFunc()

By("Delete debug pod")
etcd := getDefaultEtcd(etcdName, namespace, storageContainer, storePrefix, provider)
debugPod := getDebugPod(etcd)
Expect(client.IgnoreNotFound(cl.Delete(ctx, debugPod))).ToNot(HaveOccurred())

By("Purge etcd")
purgeEtcd(ctx, cl, providers)
purgeSnapstoreIfNeeded(parentCtx, cl, provider, storageContainer, etcdName)
})

It("Should create, test backup and delete etcd with backup", func() {
Expand Down Expand Up @@ -187,6 +165,12 @@ var _ = Describe("Etcd Backup", func() {
for i := 1; i <= 15; i++ {
Expect(keyValueMap[fmt.Sprintf("%s-%d", etcdKeyPrefix, i)]).To(Equal(fmt.Sprintf("%s-%d", etcdValuePrefix, i)))
}

By("Deleting debug pod")
Expect(client.IgnoreNotFound(cl.Delete(ctx, debugPod))).ToNot(HaveOccurred())

By("Deleting etcd")
deleteAndCheckEtcd(ctx, cl, objLogger, etcd, multiNodeEtcdTimeout)
})
})
}
Expand Down
34 changes: 9 additions & 25 deletions test/e2e/etcd_compaction_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import (
"time"

druidv1alpha1 "github.com/gardener/etcd-druid/api/v1alpha1"
druidstore "github.com/gardener/etcd-druid/internal/store"

brtypes "github.com/gardener/etcd-backup-restore/pkg/types"
. "github.com/onsi/ginkgo/v2"
Expand Down Expand Up @@ -43,32 +42,11 @@ var _ = Describe("Etcd Compaction", func() {
provider := p
Context(fmt.Sprintf("with provider %s", provider.Name), func() {
BeforeEach(func() {
etcdName = fmt.Sprintf("etcd-%s", provider.Name)
etcdName = fmt.Sprintf("etcd-compaction-%s", provider.Name)
storePrefix = etcdName
storageContainer = getEnvAndExpectNoError(envStorageContainer)

By("Purge snapstore")
snapstoreProvider := provider.Storage.Provider
if snapstoreProvider == druidstore.Local {
purgeLocalSnapstoreJob := purgeLocalSnapstore(parentCtx, cl, storageContainer)
defer cleanUpTestHelperJob(parentCtx, cl, purgeLocalSnapstoreJob.Name)
} else {
store, err := getSnapstore(string(snapstoreProvider), storageContainer, storePrefix)
Expect(err).ShouldNot(HaveOccurred())
Expect(purgeSnapstore(store)).To(Succeed())
}
})

AfterEach(func() {
ctx, cancelFunc := context.WithTimeout(parentCtx, 10*time.Minute)
defer cancelFunc()

By("Delete debug pod")
etcd := getDefaultEtcd(etcdName, namespace, storageContainer, storePrefix, provider)
debugPod := getDebugPod(etcd)
Expect(client.IgnoreNotFound(cl.Delete(ctx, debugPod))).ToNot(HaveOccurred())

By("Purge etcd")
purgeEtcd(ctx, cl, providers)
purgeSnapstoreIfNeeded(parentCtx, cl, provider, storageContainer, etcdName)
})

It("should test compaction on backup", func() {
Expand Down Expand Up @@ -195,6 +173,12 @@ var _ = Describe("Etcd Compaction", func() {
Expect(err).ShouldNot(HaveOccurred())

Expect(len(latestSnapshotsAfterPopulate.DeltaSnapshots)).Should(BeNumerically(">", 0))

By("Deleting debug pod")
Expect(client.IgnoreNotFound(cl.Delete(ctx, debugPod))).ToNot(HaveOccurred())

By("Deleting etcd")
deleteAndCheckEtcd(ctx, cl, objLogger, etcd, multiNodeEtcdTimeout)
})
})
}
Expand Down
Loading