Skip to content

Commit

Permalink
Fix upgrade test keeping CRD from previous test
Browse files Browse the repository at this point in the history
Signed-off-by: Matheus Pimenta <[email protected]>
  • Loading branch information
matheuscscp committed Dec 13, 2024
1 parent da74708 commit 667a0f8
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions internal/reconcile/upgrade_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -538,6 +538,14 @@ func TestUpgrade_Reconcile_withSubchartWithCRDs(t *testing.T) {
g.Expect(store.Create(r)).To(Succeed())
}

// Delete any prior CRD.
subChartCRD := &apiextensionsv1.CustomResourceDefinition{
ObjectMeta: metav1.ObjectMeta{
Name: "crontabs.stable.example.com",
},
}
_ = testEnv.Delete(context.TODO(), subChartCRD)

chart := testutil.BuildChartWithSubchartWithCRD()
recorder := new(record.FakeRecorder)
got := NewUpgrade(cfg, recorder).Reconcile(context.TODO(), &Request{
Expand Down Expand Up @@ -579,11 +587,6 @@ func TestUpgrade_Reconcile_withSubchartWithCRDs(t *testing.T) {
}

// Assert subchart CRD is absent or present.
subChartCRD := &apiextensionsv1.CustomResourceDefinition{
ObjectMeta: metav1.ObjectMeta{
Name: "crontabs.stable.example.com",
},
}
err = testEnv.Get(context.TODO(), client.ObjectKeyFromObject(subChartCRD), subChartCRD)
if tt.subchartResourcesPresent {
g.Expect(err).NotTo(HaveOccurred())
Expand Down

0 comments on commit 667a0f8

Please sign in to comment.