Skip to content

Commit f323a24

Browse files
committed
[WIP] Catch up with the recent changes
1 parent 677d88e commit f323a24

File tree

2 files changed

+26
-117
lines changed

2 files changed

+26
-117
lines changed

charts/test/unit/deployment_test.go

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ func TestDeploymentDefault(t *testing.T) {
4242
Image: "hashicorp/hcp-terraform-operator:2.7.0",
4343
Command: []string{"/manager"},
4444
Args: []string{
45-
"--sync-period=5m",
45+
"--sync-period=1h",
4646
"--agent-pool-workers=1",
4747
"--agent-pool-sync-period=30s",
4848
"--module-workers=1",
@@ -101,7 +101,7 @@ func TestDeploymentDefault(t *testing.T) {
101101
}, spec.Containers[0])
102102
assert.Equal(t, corev1.Container{
103103
Name: "kube-rbac-proxy",
104-
Image: "quay.io/brancz/kube-rbac-proxy:v0.18.0",
104+
Image: "quay.io/brancz/kube-rbac-proxy:v0.18.2",
105105
Args: []string{
106106
"--secure-listen-address=0.0.0.0:8443",
107107
"--upstream=http://127.0.0.1:8080/",
@@ -137,19 +137,7 @@ func TestDeploymentDefault(t *testing.T) {
137137
},
138138
}, spec.Containers[1])
139139

140-
assert.Equal(t, defaultServiceAccountName, deployment.Spec.Template.Spec.ServiceAccountName)
141-
assert.Equal(t, &corev1.PodSecurityContext{RunAsNonRoot: ptr.To(true)}, deployment.Spec.Template.Spec.SecurityContext)
142-
assert.Equal(t, &defaultDeploymentTerminationGracePeriodSeconds, deployment.Spec.Template.Spec.TerminationGracePeriodSeconds)
143-
assert.Equal(t, []corev1.Volume{
144-
{
145-
Name: defaultDeploymentTemplateVolumeName,
146-
VolumeSource: corev1.VolumeSource{
147-
ConfigMap: &corev1.ConfigMapVolumeSource{
148-
LocalObjectReference: corev1.LocalObjectReference{
149-
Name: defaultDeploymentTemplateVolumeConfigMapName,
150-
},
151-
},
152-
},
153-
},
154-
}, deployment.Spec.Template.Spec.Volumes)
140+
assert.Equal(t, defaultServiceAccountName, spec.ServiceAccountName)
141+
assert.Equal(t, &corev1.PodSecurityContext{RunAsNonRoot: ptr.To(true)}, spec.SecurityContext)
142+
assert.Equal(t, &defaultDeploymentTerminationGracePeriodSeconds, spec.TerminationGracePeriodSeconds)
155143
}

charts/test/unit/rbac_clusster_role_manager_test.go

Lines changed: 21 additions & 100 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,10 @@ func testRBACClusterRoleManagerRules(t *testing.T, rbac rbacv1.ClusterRole) {
5050
"watch",
5151
},
5252
APIGroups: []string{""},
53-
Resources: []string{"configmaps"},
53+
Resources: []string{
54+
"configmaps",
55+
"secrets",
56+
},
5457
},
5558
{
5659
Verbs: []string{
@@ -60,29 +63,6 @@ func testRBACClusterRoleManagerRules(t *testing.T, rbac rbacv1.ClusterRole) {
6063
APIGroups: []string{""},
6164
Resources: []string{"events"},
6265
},
63-
{
64-
Verbs: []string{
65-
"create",
66-
"list",
67-
"update",
68-
"watch",
69-
},
70-
APIGroups: []string{""},
71-
Resources: []string{"secrets"},
72-
},
73-
{
74-
Verbs: []string{
75-
"create",
76-
"delete",
77-
"get",
78-
"list",
79-
"patch",
80-
"update",
81-
"watch",
82-
},
83-
APIGroups: []string{"apps"},
84-
Resources: []string{"deployments"},
85-
},
8666
{
8767
Verbs: []string{
8868
"create",
@@ -94,81 +74,38 @@ func testRBACClusterRoleManagerRules(t *testing.T, rbac rbacv1.ClusterRole) {
9474
"watch",
9575
},
9676
APIGroups: []string{"app.terraform.io"},
97-
Resources: []string{"agentpools"},
98-
},
99-
{
100-
Verbs: []string{
101-
"update",
77+
Resources: []string{
78+
"agentpools",
79+
"modules",
80+
"projects",
81+
"workspaces",
10282
},
103-
APIGroups: []string{"app.terraform.io"},
104-
Resources: []string{"agentpools/finalizers"},
10583
},
10684
{
10785
Verbs: []string{
108-
"get",
109-
"patch",
11086
"update",
11187
},
11288
APIGroups: []string{"app.terraform.io"},
113-
Resources: []string{"agentpools/status"},
114-
},
115-
{
116-
Verbs: []string{
117-
"create",
118-
"delete",
119-
"get",
120-
"list",
121-
"patch",
122-
"update",
123-
"watch",
89+
Resources: []string{
90+
"agentpools/finalizers",
91+
"modules/finalizers",
92+
"projects/finalizers",
93+
"workspaces/finalizers",
12494
},
125-
APIGroups: []string{"app.terraform.io"},
126-
Resources: []string{"modules"},
12795
},
12896
{
12997
Verbs: []string{
130-
"update",
131-
},
132-
APIGroups: []string{"app.terraform.io"},
133-
Resources: []string{"modules/finalizers"},
134-
},
135-
{
136-
Verbs: []string{
137-
"get",
138-
"patch",
139-
"update",
140-
},
141-
APIGroups: []string{"app.terraform.io"},
142-
Resources: []string{"modules/status"},
143-
},
144-
{
145-
Verbs: []string{
146-
"create",
147-
"delete",
14898
"get",
149-
"list",
15099
"patch",
151100
"update",
152-
"watch",
153101
},
154102
APIGroups: []string{"app.terraform.io"},
155-
Resources: []string{"projects"},
156-
},
157-
{
158-
Verbs: []string{
159-
"update",
160-
},
161-
APIGroups: []string{"app.terraform.io"},
162-
Resources: []string{"projects/finalizers"},
163-
},
164-
{
165-
Verbs: []string{
166-
"get",
167-
"patch",
168-
"update",
103+
Resources: []string{
104+
"agentpools/status",
105+
"modules/status",
106+
"projects/status",
107+
"workspaces/status",
169108
},
170-
APIGroups: []string{"app.terraform.io"},
171-
Resources: []string{"projects/status"},
172109
},
173110
{
174111
Verbs: []string{
@@ -180,24 +117,8 @@ func testRBACClusterRoleManagerRules(t *testing.T, rbac rbacv1.ClusterRole) {
180117
"update",
181118
"watch",
182119
},
183-
APIGroups: []string{"app.terraform.io"},
184-
Resources: []string{"workspaces"},
185-
},
186-
{
187-
Verbs: []string{
188-
"update",
189-
},
190-
APIGroups: []string{"app.terraform.io"},
191-
Resources: []string{"workspaces/finalizers"},
192-
},
193-
{
194-
Verbs: []string{
195-
"get",
196-
"patch",
197-
"update",
198-
},
199-
APIGroups: []string{"app.terraform.io"},
200-
Resources: []string{"workspaces/status"},
120+
APIGroups: []string{"apps"},
121+
Resources: []string{"deployments"},
201122
},
202123
}
203124
assert.Equal(t, rules, rbac.Rules)

0 commit comments

Comments
 (0)