Skip to content

Commit 16368c2

Browse files
committed
update test var
Signed-off-by: Ashima-Ashima1 <[email protected]>
1 parent 0dfc95d commit 16368c2

File tree

3 files changed

+41
-42
lines changed

3 files changed

+41
-42
lines changed

controllers/ibmobjectcsi_controller_test.go

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ var (
3939
ibmObjectCSIReconcileRequest = reconcile.Request{
4040
NamespacedName: types.NamespacedName{
4141
Name: ibmObjectCSICRName,
42-
Namespace: ibmObjectCSICRNamespace,
42+
Namespace: TestNamespace,
4343
},
4444
}
4545

@@ -75,7 +75,7 @@ var (
7575
ibmObjectCSICR = &v1alpha1.IBMObjectCSI{
7676
ObjectMeta: metav1.ObjectMeta{
7777
Name: ibmObjectCSICRName,
78-
Namespace: ibmObjectCSICRNamespace,
78+
Namespace: TestNamespace,
7979
},
8080
Spec: v1alpha1.IBMObjectCSISpec{
8181
Controller: v1alpha1.IBMObjectCSIControllerSpec{
@@ -128,7 +128,7 @@ var (
128128
ibmObjectCSICRWithDeletionTS = &v1alpha1.IBMObjectCSI{
129129
ObjectMeta: metav1.ObjectMeta{
130130
Name: ibmObjectCSICRName,
131-
Namespace: ibmObjectCSICRNamespace,
131+
Namespace: TestNamespace,
132132
Finalizers: []string{ibmObjectCSIfinalizer},
133133
DeletionTimestamp: &currentTime,
134134
},
@@ -137,7 +137,7 @@ var (
137137
ibmObjectCSICRWithFinaliser = &v1alpha1.IBMObjectCSI{
138138
ObjectMeta: metav1.ObjectMeta{
139139
Name: ibmObjectCSICRName,
140-
Namespace: ibmObjectCSICRNamespace,
140+
Namespace: TestNamespace,
141141
Finalizers: []string{ibmObjectCSIfinalizer},
142142
},
143143
Spec: ibmObjectCSICR.Spec,
@@ -156,7 +156,7 @@ var (
156156
csiNode = &appsv1.DaemonSet{
157157
ObjectMeta: metav1.ObjectMeta{
158158
Name: config.GetNameForResource(config.CSINode, ibmObjectCSICRName),
159-
Namespace: ibmObjectCSICRNamespace,
159+
Namespace: TestNamespace,
160160
Annotations: annotations,
161161
},
162162
Spec: appsv1.DaemonSetSpec{
@@ -167,7 +167,7 @@ var (
167167
controllerDeployment = &appsv1.Deployment{
168168
ObjectMeta: metav1.ObjectMeta{
169169
Name: config.GetNameForResource(config.CSIController, ibmObjectCSICRName),
170-
Namespace: ibmObjectCSICRNamespace,
170+
Namespace: TestNamespace,
171171
Annotations: annotations,
172172
},
173173
Spec: appsv1.DeploymentSpec{
@@ -178,7 +178,7 @@ var (
178178
controllerPod = &corev1.Pod{
179179
ObjectMeta: metav1.ObjectMeta{
180180
Name: controllerDeployment.Name + "-pod",
181-
Namespace: ibmObjectCSICRNamespace,
181+
Namespace: TestNamespace,
182182
},
183183
}
184184

@@ -197,15 +197,15 @@ var (
197197
controllerSA = &corev1.ServiceAccount{
198198
ObjectMeta: metav1.ObjectMeta{
199199
Name: config.GetNameForResource(config.CSIControllerServiceAccount, ibmObjectCSICRName),
200-
Namespace: ibmObjectCSICRNamespace,
200+
Namespace: TestNamespace,
201201
},
202202
ImagePullSecrets: secrets,
203203
}
204204

205205
nodeSA = &corev1.ServiceAccount{
206206
ObjectMeta: metav1.ObjectMeta{
207207
Name: config.GetNameForResource(config.CSINodeServiceAccount, ibmObjectCSICRName),
208-
Namespace: ibmObjectCSICRNamespace,
208+
Namespace: TestNamespace,
209209
},
210210
ImagePullSecrets: secrets,
211211
}
@@ -218,7 +218,7 @@ var (
218218
{
219219
Kind: "ServiceAccount",
220220
Name: config.GetNameForResource(config.CSIControllerServiceAccount, ibmObjectCSICRName),
221-
Namespace: ibmObjectCSICRNamespace,
221+
Namespace: TestNamespace,
222222
},
223223
},
224224
RoleRef: rbacv1.RoleRef{
@@ -236,7 +236,7 @@ var (
236236
{
237237
Kind: "ServiceAccount",
238238
Name: config.GetNameForResource(config.CSIControllerServiceAccount, ibmObjectCSICRName),
239-
Namespace: ibmObjectCSICRNamespace,
239+
Namespace: TestNamespace,
240240
},
241241
},
242242
RoleRef: rbacv1.RoleRef{
@@ -254,7 +254,7 @@ var (
254254
{
255255
Kind: "ServiceAccount",
256256
Name: config.GetNameForResource(config.CSINodeServiceAccount, ibmObjectCSICRName),
257-
Namespace: ibmObjectCSICRNamespace,
257+
Namespace: TestNamespace,
258258
},
259259
},
260260
RoleRef: rbacv1.RoleRef{
@@ -441,7 +441,7 @@ func TestIBMObjectCSIReconcile(t *testing.T) {
441441
&corev1.Pod{
442442
ObjectMeta: metav1.ObjectMeta{
443443
Name: controllerDeployment.Name + "-pod2",
444-
Namespace: ibmObjectCSICRNamespace,
444+
Namespace: TestNamespace,
445445
},
446446
},
447447
},
@@ -791,7 +791,7 @@ func TestIBMObjectCSIReconcile(t *testing.T) {
791791

792792
for _, testcase := range testCases {
793793
t.Run(testcase.testCaseName, func(t *testing.T) {
794-
testLog.Info("Testcase being executed", "testcase", testcase.testCaseName)
794+
TestLog.Info("Testcase being executed", "testcase", testcase.testCaseName)
795795

796796
scheme := setupScheme()
797797
client := testcase.clientFunc(testcase.objects)
@@ -803,8 +803,8 @@ func TestIBMObjectCSIReconcile(t *testing.T) {
803803
ControllerHelper: common.NewControllerHelper(client),
804804
}
805805

806-
res, err := ibmObjectCSIReconciler.Reconcile(testCtx, ibmObjectCSIReconcileRequest)
807-
testLog.Info("Testcase return values", "result", res, "error", err)
806+
res, err := ibmObjectCSIReconciler.Reconcile(TestCtx, ibmObjectCSIReconcileRequest)
807+
TestLog.Info("Testcase return values", "result", res, "error", err)
808808

809809
assert.Equal(t, testcase.expectedResp, res)
810810

controllers/recoverstalevolume_controller_test.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,14 @@ var (
2929
recoverStaleVolumeReconcileRequest = reconcile.Request{
3030
NamespacedName: types.NamespacedName{
3131
Name: recoverStaleVolCRName,
32-
Namespace: recoverStaleVolCRNamespace,
32+
Namespace: TestNamespace,
3333
},
3434
}
3535

3636
recoverStaleVolumeCR = &v1alpha1.RecoverStaleVolume{
3737
ObjectMeta: metav1.ObjectMeta{
3838
Name: recoverStaleVolCRName,
39-
Namespace: recoverStaleVolCRNamespace,
39+
Namespace: TestNamespace,
4040
},
4141
Spec: v1alpha1.RecoverStaleVolumeSpec{
4242
NoOfLogLines: int64(100),
@@ -133,7 +133,7 @@ var (
133133
nodeServerPod1 = &corev1.Pod{
134134
ObjectMeta: metav1.ObjectMeta{
135135
Name: csiNodePodPrefix + "-pod1",
136-
Namespace: csiOperatorNamespace,
136+
Namespace: TestNamespace,
137137
},
138138
Spec: corev1.PodSpec{
139139
NodeName: testNode1,
@@ -143,7 +143,7 @@ var (
143143
nodeServerPod2 = &corev1.Pod{
144144
ObjectMeta: metav1.ObjectMeta{
145145
Name: csiNodePodPrefix + "-pod2",
146-
Namespace: csiOperatorNamespace,
146+
Namespace: TestNamespace,
147147
},
148148
Spec: corev1.PodSpec{
149149
NodeName: testNode2,
@@ -153,7 +153,7 @@ var (
153153
nodeServerPod3 = &corev1.Pod{
154154
ObjectMeta: metav1.ObjectMeta{
155155
Name: csiNodePodPrefix + "-pod3",
156-
Namespace: csiOperatorNamespace,
156+
Namespace: TestNamespace,
157157
},
158158
Spec: corev1.PodSpec{
159159
NodeName: testNode3,
@@ -382,7 +382,7 @@ func TestRecoverStaleVolumeReconcile(t *testing.T) {
382382

383383
for _, testcase := range testCases {
384384
t.Run(testcase.testCaseName, func(t *testing.T) {
385-
testLog.Info("Testcase being executed", "testcase", testcase.testCaseName)
385+
TestLog.Info("Testcase being executed", "testcase", testcase.testCaseName)
386386

387387
scheme := setupScheme()
388388
client := testcase.clientFunc(testcase.objects)
@@ -394,8 +394,8 @@ func TestRecoverStaleVolumeReconcile(t *testing.T) {
394394
IsTest: true,
395395
}
396396

397-
res, err := recoverStaleVolumeReconciler.Reconcile(testCtx, recoverStaleVolumeReconcileRequest)
398-
testLog.Info("Testcase return values", "result", res, "error", err)
397+
res, err := recoverStaleVolumeReconciler.Reconcile(TestCtx, recoverStaleVolumeReconcileRequest)
398+
TestLog.Info("Testcase return values", "result", res, "error", err)
399399

400400
assert.Equal(t, testcase.expectedResp, res)
401401

controllers/test_variables.go

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -27,27 +27,26 @@ const (
2727
)
2828

2929
var (
30-
testLog = log.Log.WithName("test")
31-
testCtx = context.TODO()
30+
TestLog = log.Log.WithName("test")
31+
TestCtx = context.TODO()
32+
TestNamespace = "test-namespace"
3233

3334
currentTime = metav1.Now()
3435

35-
ibmObjectCSICRName = "test-csi-cr"
36-
ibmObjectCSICRNamespace = "test-namespace"
37-
ibmObjectCSIfinalizer = "ibmobjectcsi.objectdriver.csi.ibm.com"
38-
39-
recoverStaleVolCRName = "test-vol-cr"
40-
recoverStaleVolCRNamespace = "test-namespace"
41-
testDeploymentName = "test-deployment"
42-
testDeploymentNamespace = "default"
43-
testPVName1 = "test-pv-1"
44-
testPVName2 = "test-pv-2"
45-
testPVCName1 = "test-pvc-1"
46-
testPVCName2 = "test-pvc-2"
47-
testStorageClassName = "test-csi-storage-class"
48-
testNode1 = "test-node-1"
49-
testNode2 = "test-node-2"
50-
testNode3 = "test-node-3"
36+
ibmObjectCSICRName = "test-csi-cr"
37+
ibmObjectCSIfinalizer = "ibmobjectcsi.objectdriver.csi.ibm.com"
38+
39+
recoverStaleVolCRName = "test-vol-cr"
40+
testDeploymentName = "test-deployment"
41+
testDeploymentNamespace = "default"
42+
testPVName1 = "test-pv-1"
43+
testPVName2 = "test-pv-2"
44+
testPVCName1 = "test-pvc-1"
45+
testPVCName2 = "test-pvc-2"
46+
testStorageClassName = "test-csi-storage-class"
47+
testNode1 = "test-node-1"
48+
testNode2 = "test-node-2"
49+
testNode3 = "test-node-3"
5150
)
5251

5352
var testNodeServerPodLogs = `E0319 05:32:00.429871 1 nodeserver.go:245] NodeGetVolumeStats: error occurred while getting volume stats map[Error:transport endpoint is not connected VolumeId:test-pv-1]`

0 commit comments

Comments
 (0)