Skip to content

Commit 74da4a8

Browse files
committed
fix: add vpa check to e2e test
1 parent dddd922 commit 74da4a8

File tree

1 file changed

+28
-8
lines changed

1 file changed

+28
-8
lines changed

test/e2e/bundle_e2e_test.go

Lines changed: 28 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ package e2e
22

33
import (
44
"context"
5+
"k8s.io/apimachinery/pkg/runtime/schema"
6+
"k8s.io/client-go/dynamic"
57

68
. "github.com/onsi/ginkgo"
79
. "github.com/onsi/gomega"
@@ -17,25 +19,25 @@ var _ = Describe("Installing bundles with new object types", func() {
1719
var (
1820
kubeClient operatorclient.ClientInterface
1921
operatorClient versioned.Interface
22+
dynamicClient dynamic.Interface
2023
)
2124

2225
BeforeEach(func() {
2326
kubeClient = ctx.Ctx().KubeClient()
2427
operatorClient = ctx.Ctx().OperatorClient()
28+
dynamicClient = ctx.Ctx().DynamicClient()
2529
})
2630

2731
AfterEach(func() {
2832
cleaner.NotifyTestComplete(true)
2933
})
3034

31-
When("a bundle with a pdb, priorityclass, and vpa object is installed", func() {
35+
When("a bundle with a pdb, priorityclass, and VPA object is installed", func() {
36+
By("including the VPA CRD in the CSV")
3237
const (
33-
packageName = "busybox"
34-
channelName = "alpha"
35-
subName = "test-subscription"
36-
pdbName = "busybox-pdb"
37-
priorityClassName = "high-priority"
38-
vpaName = "busybox-vpa"
38+
packageName = "busybox"
39+
channelName = "alpha"
40+
subName = "test-subscription"
3941
)
4042

4143
BeforeEach(func() {
@@ -74,6 +76,21 @@ var _ = Describe("Installing bundles with new object types", func() {
7476
})
7577

7678
It("should create the additional bundle objects", func() {
79+
const (
80+
vpaGroup = "autoscaling.k8s.io"
81+
vpaVersion = "v1"
82+
vpaResource = "verticalpodautoscalers"
83+
pdbName = "busybox-pdb"
84+
priorityClassName = "high-priority"
85+
vpaName = "busybox-vpa"
86+
)
87+
88+
var resource = schema.GroupVersionResource{
89+
Group: vpaGroup,
90+
Version: vpaVersion,
91+
Resource: vpaResource,
92+
}
93+
7794
// confirm extra bundle objects are installed
7895
Eventually(func() error {
7996
_, err := kubeClient.KubernetesInterface().PolicyV1beta1().PodDisruptionBudgets(testNamespace).Get(context.TODO(), pdbName, metav1.GetOptions{})
@@ -85,7 +102,10 @@ var _ = Describe("Installing bundles with new object types", func() {
85102
return err
86103
}).Should(Succeed(), "expected no error getting priorityclass object associated with CSV")
87104

88-
// TODO check VPA object
105+
Eventually(func() error {
106+
_, err := dynamicClient.Resource(resource).Namespace(testNamespace).Get(context.TODO(), vpaName, metav1.GetOptions{})
107+
return err
108+
}).Should(Succeed(), "expected no error finding vpa object associated with csv")
89109
})
90110
})
91111
})

0 commit comments

Comments
 (0)