Skip to content

🐛 Unblock e2e #1683

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

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
6 changes: 0 additions & 6 deletions .bingo/Variables.mk
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,6 @@ $(CRD_REF_DOCS): $(BINGO_DIR)/crd-ref-docs.mod
@echo "(re)installing $(GOBIN)/crd-ref-docs-v0.1.0"
@cd $(BINGO_DIR) && GOWORK=off $(GO) build -mod=mod -modfile=crd-ref-docs.mod -o=$(GOBIN)/crd-ref-docs-v0.1.0 "github.com/elastic/crd-ref-docs"

GINKGO := $(GOBIN)/ginkgo-v2.22.2
$(GINKGO): $(BINGO_DIR)/ginkgo.mod
@# Install binary/ries using Go 1.14+ build command. This is using bwplotka/bingo-controlled, separate go module with pinned dependencies.
@echo "(re)installing $(GOBIN)/ginkgo-v2.22.2"
@cd $(BINGO_DIR) && GOWORK=off $(GO) build -mod=mod -modfile=ginkgo.mod -o=$(GOBIN)/ginkgo-v2.22.2 "github.com/onsi/ginkgo/v2/ginkgo"

GOLANGCI_LINT := $(GOBIN)/golangci-lint-v1.63.4
$(GOLANGCI_LINT): $(BINGO_DIR)/golangci-lint.mod
@# Install binary/ries using Go 1.14+ build command. This is using bwplotka/bingo-controlled, separate go module with pinned dependencies.
Expand Down
7 changes: 0 additions & 7 deletions .bingo/ginkgo.mod

This file was deleted.

8 changes: 0 additions & 8 deletions .bingo/ginkgo.sum

This file was deleted.

2 changes: 0 additions & 2 deletions .bingo/variables.env
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ CRD_DIFF="${GOBIN}/crd-diff-v0.1.0"

CRD_REF_DOCS="${GOBIN}/crd-ref-docs-v0.1.0"

GINKGO="${GOBIN}/ginkgo-v2.22.2"

GOLANGCI_LINT="${GOBIN}/golangci-lint-v1.63.4"

GORELEASER="${GOBIN}/goreleaser-v1.26.2"
Expand Down
6 changes: 4 additions & 2 deletions catalogd/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ TESTDATA_DIR := testdata
CATALOGD_NAMESPACE := olmv1-system
KIND_CLUSTER_IMAGE := kindest/node:v1.30.0@sha256:047357ac0cfea04663786a612ba1eaba9702bef25227a794b52890dd8bcd692e

GINKGO := go run github.com/onsi/ginkgo/v2/ginkgo

##@ General

# The help target prints out all targets with their descriptions organized
Expand Down Expand Up @@ -76,7 +78,7 @@ FOCUS := $(if $(TEST),-v -focus "$(TEST)")
ifeq ($(origin E2E_FLAGS), undefined)
E2E_FLAGS :=
endif
test-e2e: $(GINKGO) ## Run the e2e tests on existing cluster
test-e2e: ## Run the e2e tests on existing cluster
$(GINKGO) $(E2E_FLAGS) -trace -vv $(FOCUS) test/e2e

e2e: KIND_CLUSTER_NAME := catalogd-e2e
Expand Down Expand Up @@ -105,7 +107,7 @@ run-latest-release:
cd ..; curl -L -s https://github.com/operator-framework/operator-controller/releases/latest/download/install.sh | bash -s

.PHONY: post-upgrade-checks
post-upgrade-checks: $(GINKGO)
post-upgrade-checks:
$(GINKGO) $(E2E_FLAGS) -trace -vv $(FOCUS) test/upgrade

##@ Build
Expand Down
11 changes: 11 additions & 0 deletions catalogd/test/upgrade/unpack_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,17 @@ var _ = Describe("ClusterCatalog Unpacking", func() {
managerPod = managerPods.Items[0]
}).Should(Succeed())

By("Waiting for acquired leader election")
// Average case is under 1 minute but in the worst case: (previous leader crashed)
// we could have LeaseDuration (137s) + RetryPeriod (26s) +/- 163s
leaderCtx, leaderCancel := context.WithTimeout(ctx, 3*time.Minute)
defer leaderCancel()

leaderSubstrings := []string{"successfully acquired lease"}
leaderElected, err := watchPodLogsForSubstring(leaderCtx, &managerPod, "manager", leaderSubstrings...)
Expect(err).To(Succeed())
Expect(leaderElected).To(BeTrue())

By("Reading logs to make sure that ClusterCatalog was reconciled by catalogdv1")
logCtx, cancel := context.WithTimeout(ctx, time.Minute)
defer cancel()
Expand Down
11 changes: 11 additions & 0 deletions test/upgrade-e2e/post_upgrade_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,17 @@ func TestClusterExtensionAfterOLMUpgrade(t *testing.T) {
t.Log("Wait for operator-controller deployment to be ready")
managerPod := waitForDeployment(t, ctx, "operator-controller-controller-manager")

t.Log("Wait for acquired leader election")
// Average case is under 1 minute but in the worst case: (previous leader crashed)
// we could have LeaseDuration (137s) + RetryPeriod (26s) +/- 163s
leaderCtx, leaderCancel := context.WithTimeout(ctx, 3*time.Minute)
defer leaderCancel()

leaderSubstrings := []string{"successfully acquired lease"}
leaderElected, err := watchPodLogsForSubstring(leaderCtx, managerPod, "manager", leaderSubstrings...)
require.NoError(t, err)
require.True(t, leaderElected)

t.Log("Reading logs to make sure that ClusterExtension was reconciled by operator-controller before we update it")
// Make sure that after we upgrade OLM itself we can still reconcile old objects without any changes
logCtx, cancel := context.WithTimeout(ctx, time.Minute)
Expand Down
Loading