@@ -33,17 +33,24 @@ import (
3333)
3434
3535func TestContainerBuildReconciler (t * testing.T ) {
36- dwSA := & corev1.ServiceAccount {
36+ dwPod := & corev1.Pod {
3737 TypeMeta : metav1.TypeMeta {
38- Kind : "ServiceAccount " ,
38+ Kind : "Pod " ,
3939 APIVersion : "v1" ,
4040 },
4141 ObjectMeta : metav1.ObjectMeta {
42- Name : constants . DevWorkspaceServiceAccountName ,
42+ Name : "devworkspace-controller" ,
4343 Namespace : "eclipse-che" ,
44+ Labels : map [string ]string {
45+ constants .KubernetesNameLabelKey : constants .DevWorkspaceControllerName ,
46+ constants .KubernetesPartOfLabelKey : constants .DevWorkspaceOperatorName ,
47+ },
48+ },
49+ Spec : corev1.PodSpec {
50+ ServiceAccountName : constants .DevWorkspaceServiceAccountName ,
4451 },
4552 }
46- ctx := test .GetDeployContext (nil , []runtime.Object {dwSA })
53+ ctx := test .GetDeployContext (nil , []runtime.Object {dwPod })
4754 containerBuildReconciler := NewContainerBuildReconciler ()
4855
4956 _ , done , err := containerBuildReconciler .Reconcile (ctx )
@@ -83,18 +90,25 @@ func TestContainerBuildReconciler(t *testing.T) {
8390}
8491
8592func TestSyncAndRemoveRBAC (t * testing.T ) {
86- dwSA := & corev1.ServiceAccount {
93+ dwPod := & corev1.Pod {
8794 TypeMeta : metav1.TypeMeta {
88- Kind : "ServiceAccount " ,
95+ Kind : "Pod " ,
8996 APIVersion : "v1" ,
9097 },
9198 ObjectMeta : metav1.ObjectMeta {
92- Name : constants . DevWorkspaceServiceAccountName ,
99+ Name : "devworkspace-controller" ,
93100 Namespace : "eclipse-che" ,
101+ Labels : map [string ]string {
102+ constants .KubernetesNameLabelKey : constants .DevWorkspaceControllerName ,
103+ constants .KubernetesPartOfLabelKey : constants .DevWorkspaceOperatorName ,
104+ },
105+ },
106+ Spec : corev1.PodSpec {
107+ ServiceAccountName : constants .DevWorkspaceServiceAccountName ,
94108 },
95109 }
96- ctx := test .GetDeployContext (nil , []runtime.Object {dwSA })
97- ctx .CheCluster .Spec .DevEnvironments .DisableContainerBuildCapabilities = pointer .BoolPtr (false )
110+ ctx := test .GetDeployContext (nil , []runtime.Object {dwPod })
111+ ctx .CheCluster .Spec .DevEnvironments .DisableContainerBuildCapabilities = pointer .Bool (false )
98112 ctx .CheCluster .Spec .DevEnvironments .ContainerBuildConfiguration = & chev2.ContainerBuildConfiguration {OpenShiftSecurityContextConstraint : "scc" }
99113
100114 containerBuildReconciler := NewContainerBuildReconciler ()
@@ -118,7 +132,7 @@ func TestSyncAndRemoveRBAC(t *testing.T) {
118132
119133func TestSyncAndRemoveSCC (t * testing.T ) {
120134 ctx := test .GetDeployContext (nil , []runtime.Object {})
121- ctx .CheCluster .Spec .DevEnvironments .DisableContainerBuildCapabilities = pointer .BoolPtr (false )
135+ ctx .CheCluster .Spec .DevEnvironments .DisableContainerBuildCapabilities = pointer .Bool (false )
122136 ctx .CheCluster .Spec .DevEnvironments .ContainerBuildConfiguration = & chev2.ContainerBuildConfiguration {OpenShiftSecurityContextConstraint : "scc" }
123137
124138 containerBuildReconciler := NewContainerBuildReconciler ()
0 commit comments