Skip to content

Commit bb1ce80

Browse files
astefanuttiopenshift-merge-robot
authored andcommitted
Add test for custom InstaScale controller image support
1 parent a71303b commit bb1ce80

File tree

3 files changed

+51
-2
lines changed

3 files changed

+51
-2
lines changed

Diff for: controllers/instascale_controller_test.go

+15-2
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,26 @@ package controllers
33
import (
44
"context"
55

6-
mfc "github.com/manifestival/controller-runtime-client"
7-
mf "github.com/manifestival/manifestival"
86
. "github.com/onsi/ginkgo/v2"
97
. "github.com/onsi/gomega"
8+
9+
mfc "github.com/manifestival/controller-runtime-client"
10+
mf "github.com/manifestival/manifestival"
11+
1012
codeflarev1alpha1 "github.com/project-codeflare/codeflare-operator/api/v1alpha1"
1113
)
1214

1315
const (
1416
instascaleCRCase1 = "./testdata/instascale_test_cases/case_1.yaml"
1517
instascaleCRCase2 = "./testdata/instascale_test_cases/case_2.yaml"
18+
instascaleCRCase3 = "./testdata/instascale_test_cases/case_3.yaml"
1619
instascaleConfigMap1 = "./testdata/instascale_test_results/case_1/configmap.yaml"
1720
instascaleServiceAccount1 = "./testdata/instascale_test_results/case_1/serviceaccount.yaml"
1821
instascaleClusterRole1 = "./testdata/instascale_test_results/case_1/clusterrole.yaml"
1922
instascaleClusterRoleBinding1 = "./testdata/instascale_test_results/case_1/clusterrolebinding.yaml"
2023
instascaleDeployment1 = "./testdata/instascale_test_results/case_1/deployment.yaml"
2124
instascaleDeployment2 = "./testdata/instascale_test_results/case_2/deployment.yaml"
25+
instascaleDeployment3 = "./testdata/instascale_test_results/case_3/deployment.yaml"
2226
)
2327

2428
func deployInstaScale(ctx context.Context, path string, opts mf.Option) {
@@ -44,11 +48,20 @@ var _ = Describe("The Instascale Controller", func() {
4448
compareClusterRoleBindings(instascaleClusterRoleBinding1, opts)
4549
})
4650
})
51+
4752
Context("In a namespace, InstaScale ControllerResources is given", func() {
4853

4954
It("It should deploy InstaScale with the given ControllerResources", func() {
5055
deployInstaScale(ctx, instascaleCRCase2, opts)
5156
compareDeployments(instascaleDeployment2, opts)
5257
})
5358
})
59+
60+
Context("When an InstaScale resource with a custom image is given", func() {
61+
62+
It("It should deploy InstaScale with the given controller image", func() {
63+
deployInstaScale(ctx, instascaleCRCase3, opts)
64+
compareDeployments(instascaleDeployment3, opts)
65+
})
66+
})
5467
})
+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
apiVersion: codeflare.codeflare.dev/v1alpha1
2+
kind: InstaScale
3+
metadata:
4+
name: example-custom-image
5+
spec:
6+
controllerImage: quay.io/project-codeflare/instascale-controller:custom
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
kind: Deployment
2+
apiVersion: apps/v1
3+
metadata:
4+
name: instascale-example-custom-image
5+
namespace: codeflare-operator-system
6+
labels:
7+
app: instascale-example-custom-image
8+
spec:
9+
replicas: 1
10+
selector:
11+
matchLabels:
12+
app: instascale-example-custom-image
13+
template:
14+
metadata:
15+
labels:
16+
app: instascale-example-custom-image
17+
spec:
18+
containers:
19+
- name: instascale
20+
args:
21+
- "--configs-namespace=default"
22+
image: quay.io/project-codeflare/instascale-controller:custom
23+
resources:
24+
limits:
25+
cpu: '2'
26+
memory: 2G
27+
requests:
28+
cpu: '200m'
29+
memory: 200M
30+
serviceAccountName: instascale-example-custom-image-sa

0 commit comments

Comments
 (0)