Skip to content

fix: add installplan status check after subscription status check for gc e2e tests #1636

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
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
70 changes: 50 additions & 20 deletions test/e2e/gc_e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,8 @@ var _ = Describe("Garbage collection for dependent resources", func() {
sourceName = "test-catalog"
imageName = "quay.io/olmtest/single-bundle-index:objects"
)
var installPlanRef string

// create catalog source
source := &v1alpha1.CatalogSource{
TypeMeta: metav1.TypeMeta{
Expand All @@ -322,10 +324,16 @@ var _ = Describe("Garbage collection for dependent resources", func() {
_ = createSubscriptionForCatalog(operatorClient, source.GetNamespace(), subName, source.GetName(), packageName, channelName, "", v1alpha1.ApprovalAutomatic)

// Wait for the Subscription to succeed
Eventually(func() error {
_, err = fetchSubscription(operatorClient, testNamespace, subName, subscriptionStateAtLatestChecker)
return err
}).Should(BeNil())
sub, err := fetchSubscription(operatorClient, testNamespace, subName, subscriptionStateAtLatestChecker)
Expect(err).ToNot(HaveOccurred(), "could not get subscription at latest status")

installPlanRef = sub.Status.InstallPlanRef.Name

// Wait for the installplan to complete (5 minute timeout)
_, err = fetchInstallPlan(GinkgoT(), operatorClient, installPlanRef, buildInstallPlanPhaseCheckFunc(v1alpha1.InstallPlanPhaseComplete))
Expect(err).ToNot(HaveOccurred(), "could not get installplan at complete phase")

ctx.Ctx().Logf("install plan %s completed", installPlanRef)

// confirm extra bundle objects (secret and configmap) are installed
Eventually(func() error {
Expand Down Expand Up @@ -393,6 +401,8 @@ var _ = Describe("Garbage collection for dependent resources", func() {
sourceName = "test-catalog"
imageName = "quay.io/olmtest/single-bundle-index:objects-upgrade-samename"
)

var installPlanRef string
// create catalog source
source := &v1alpha1.CatalogSource{
TypeMeta: metav1.TypeMeta{
Expand All @@ -417,10 +427,14 @@ var _ = Describe("Garbage collection for dependent resources", func() {
_ = createSubscriptionForCatalog(operatorClient, source.GetNamespace(), subName, source.GetName(), packageName, channelName, "", v1alpha1.ApprovalAutomatic)

// Wait for the Subscription to succeed
Eventually(func() error {
_, err = fetchSubscription(operatorClient, testNamespace, subName, subscriptionStateAtLatestChecker)
return err
}).Should(BeNil())
sub, err := fetchSubscription(operatorClient, testNamespace, subName, subscriptionStateAtLatestChecker)
Expect(err).ToNot(HaveOccurred(), "could not get subscription at latest status")

installPlanRef = sub.Status.InstallPlanRef.Name

// Wait for the installplan to complete (5 minute timeout)
_, err = fetchInstallPlan(GinkgoT(), operatorClient, installPlanRef, buildInstallPlanPhaseCheckFunc(v1alpha1.InstallPlanPhaseComplete))
Expect(err).ToNot(HaveOccurred(), "could not get installplan at complete phase")

Eventually(func() error {
_, err := kubeClient.GetConfigMap(testNamespace, configmapName)
Expand All @@ -433,6 +447,7 @@ var _ = Describe("Garbage collection for dependent resources", func() {
upgradeChannelName = "beta"
newCSVname = "busybox.v3.0.0"
)
var installPlanRef string

BeforeEach(func() {
// update subscription first
Expand All @@ -445,10 +460,14 @@ var _ = Describe("Garbage collection for dependent resources", func() {
Expect(err).ToNot(HaveOccurred(), "could not update subscription")

// Wait for the Subscription to succeed
Eventually(func() error {
_, err = fetchSubscription(operatorClient, testNamespace, subName, subscriptionStateAtLatestChecker)
return err
}).Should(BeNil())
sub, err = fetchSubscription(operatorClient, testNamespace, subName, subscriptionStateAtLatestChecker)
Expect(err).ToNot(HaveOccurred(), "could not get subscription at latest status")

installPlanRef = sub.Status.InstallPlanRef.Name

// Wait for the installplan to complete (5 minute timeout)
_, err = fetchInstallPlan(GinkgoT(), operatorClient, installPlanRef, buildInstallPlanPhaseCheckFunc(v1alpha1.InstallPlanPhaseComplete))
Expect(err).ToNot(HaveOccurred(), "could not get installplan at complete phase")

// Ensure the new csv is installed
Eventually(func() error {
Expand Down Expand Up @@ -485,6 +504,8 @@ var _ = Describe("Garbage collection for dependent resources", func() {
sourceName = "test-catalog"
imageName = "quay.io/olmtest/single-bundle-index:objects-upgrade-diffname"
)

var installPlanRef string
// create catalog source
source := &v1alpha1.CatalogSource{
TypeMeta: metav1.TypeMeta{
Expand All @@ -509,10 +530,14 @@ var _ = Describe("Garbage collection for dependent resources", func() {
_ = createSubscriptionForCatalog(operatorClient, source.GetNamespace(), subName, source.GetName(), packageName, channelName, "", v1alpha1.ApprovalAutomatic)

// Wait for the Subscription to succeed
Eventually(func() error {
_, err = fetchSubscription(operatorClient, testNamespace, subName, subscriptionStateAtLatestChecker)
return err
}).Should(BeNil())
sub, err := fetchSubscription(operatorClient, testNamespace, subName, subscriptionStateAtLatestChecker)
Expect(err).ToNot(HaveOccurred(), "could not get subscription at latest status")

installPlanRef = sub.Status.InstallPlanRef.Name

// Wait for the installplan to complete (5 minute timeout)
_, err = fetchInstallPlan(GinkgoT(), operatorClient, installPlanRef, buildInstallPlanPhaseCheckFunc(v1alpha1.InstallPlanPhaseComplete))
Expect(err).ToNot(HaveOccurred(), "could not get installplan at complete phase")

Eventually(func() error {
_, err := kubeClient.GetConfigMap(testNamespace, configmapName)
Expand All @@ -526,6 +551,7 @@ var _ = Describe("Garbage collection for dependent resources", func() {
upgradedConfigMapName = "not-special-config"
newCSVname = "busybox.v3.0.0"
)
var installPlanRef string

BeforeEach(func() {
// update subscription first
Expand All @@ -538,10 +564,14 @@ var _ = Describe("Garbage collection for dependent resources", func() {
Expect(err).ToNot(HaveOccurred(), "could not update subscription")

// Wait for the Subscription to succeed
Eventually(func() error {
_, err = fetchSubscription(operatorClient, testNamespace, subName, subscriptionStateAtLatestChecker)
return err
}).Should(BeNil())
sub, err = fetchSubscription(operatorClient, testNamespace, subName, subscriptionStateAtLatestChecker)
Expect(err).ToNot(HaveOccurred(), "could not get subscription at latest status")

installPlanRef = sub.Status.InstallPlanRef.Name

// Wait for the installplan to complete (5 minute timeout)
_, err = fetchInstallPlan(GinkgoT(), operatorClient, installPlanRef, buildInstallPlanPhaseCheckFunc(v1alpha1.InstallPlanPhaseComplete))
Expect(err).ToNot(HaveOccurred(), "could not get installplan at complete phase")

// Ensure the new csv is installed
Eventually(func() error {
Expand Down