Skip to content

Commit

Permalink
Update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Janelle Law committed Dec 1, 2021
1 parent 3613bbc commit 61e73c7
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 8 deletions.
2 changes: 2 additions & 0 deletions internal/controllers/cryostat_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1032,6 +1032,8 @@ func (t *cryostatTestInput) expectRBAC() {
err := t.Client.Get(context.Background(), types.NamespacedName{Name: "cryostat", Namespace: "default"}, sa)
Expect(err).ToNot(HaveOccurred())
expectedSA := test.NewServiceAccount()
Expect(sa.Labels).To(Equal(expectedSA.Labels))
Expect(sa.Annotations).To(Equal(expectedSA.Annotations))
Expect(sa.Secrets).To(Equal(expectedSA.Secrets))
Expect(sa.ImagePullSecrets).To(Equal(expectedSA.ImagePullSecrets))
Expect(sa.AutomountServiceAccountToken).To(Equal(expectedSA.AutomountServiceAccountToken))
Expand Down
26 changes: 18 additions & 8 deletions internal/test/resources.go
Original file line number Diff line number Diff line change
Expand Up @@ -763,14 +763,6 @@ func NewCoreEnvironmentVariables(minimal bool, tls bool, externalTLS bool, opens
Name: "CRYOSTAT_CLIENTLIB_PATH",
Value: "/opt/cryostat.d/clientlib.d",
},
{
Name: "CRYOSTAT_OAUTH_CLIENT_ID",
Value: "cryostat-serviceaccount-name",
},
{
Name: "CRYOSTAT_OAUTH_ROLE",
Value: "cryostat-cluster-role",
},
}

if externalTLS {
Expand Down Expand Up @@ -843,6 +835,14 @@ func NewCoreEnvironmentVariables(minimal bool, tls bool, externalTLS bool, opens
corev1.EnvVar{
Name: "CRYOSTAT_AUTH_MANAGER",
Value: "io.cryostat.net.OpenShiftAuthManager",
},
corev1.EnvVar{
Name: "CRYOSTAT_OAUTH_CLIENT_ID",
Value: "cryostat",
},
corev1.EnvVar{
Name: "CRYOSTAT_OAUTH_ROLE",
Value: "cryostat-operator-cryostat",
})
}
return envs
Expand Down Expand Up @@ -1267,10 +1267,20 @@ func NewNetworkConfiguration(svcName string, svcPort int32, tls bool) operatorv1
}

func NewServiceAccount() *corev1.ServiceAccount {

ref := []byte(`{"metadata":{"creationTimestamp":null},"reference":{"group":"","kind":"Route","name":"cryostat"}}`)

return &corev1.ServiceAccount{
ObjectMeta: metav1.ObjectMeta{
Name: "cryostat",
Namespace: "default",
Labels: map[string]string{
"app": "cryostat",
},
Annotations: map[string]string{
"serviceaccounts.openshift.io/oauth-redirecturi.route": "https://",
"serviceaccounts.openshift.io/oauth-redirectreference.route": string(ref),
},
},
}
}
Expand Down

0 comments on commit 61e73c7

Please sign in to comment.