Make tests to be independent of cheFlavor (#714)

Signed-off-by: Anatolii Bazko <abazko@redhat.com>
pull/716/head
Anatolii Bazko 2021-03-12 10:32:51 +02:00 committed by GitHub
parent 40e3dd466c
commit 74ad27194d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 23 additions and 19 deletions

View File

@ -44,6 +44,12 @@ func TestIngressSpec(t *testing.T) {
expectedIngress *v1beta1.Ingress
}
cheCluster := &orgv1.CheCluster{
ObjectMeta: metav1.ObjectMeta{
Namespace: "eclipse-che",
},
}
testCases := []testCase{
{
name: "Test custom host",
@ -63,9 +69,9 @@ func TestIngressSpec(t *testing.T) {
Labels: map[string]string{
"type": "default",
"app.kubernetes.io/component": "test-component",
"app.kubernetes.io/instance": "che",
"app.kubernetes.io/managed-by": "che-operator",
"app.kubernetes.io/name": "che",
"app.kubernetes.io/instance": DefaultCheFlavor(cheCluster),
"app.kubernetes.io/managed-by": DefaultCheFlavor(cheCluster) + "-operator",
"app.kubernetes.io/name": DefaultCheFlavor(cheCluster),
},
OwnerReferences: []metav1.OwnerReference{
{
@ -118,11 +124,7 @@ func TestIngressSpec(t *testing.T) {
cli := fake.NewFakeClientWithScheme(scheme.Scheme, testCase.initObjects...)
deployContext := &DeployContext{
CheCluster: &orgv1.CheCluster{
ObjectMeta: metav1.ObjectMeta{
Namespace: "eclipse-che",
},
},
CheCluster: cheCluster,
ClusterAPI: ClusterAPI{
Client: cli,
Scheme: scheme.Scheme,

View File

@ -46,6 +46,12 @@ func TestRouteSpec(t *testing.T) {
expectedRoute *routev1.Route
}
cheCluster := &orgv1.CheCluster{
ObjectMeta: metav1.ObjectMeta{
Namespace: "eclipse-che",
},
}
testCases := []testCase{
{
name: "Test domain",
@ -65,9 +71,9 @@ func TestRouteSpec(t *testing.T) {
Labels: map[string]string{
"type": "default",
"app.kubernetes.io/component": "test-component",
"app.kubernetes.io/instance": "che",
"app.kubernetes.io/managed-by": "che-operator",
"app.kubernetes.io/name": "che",
"app.kubernetes.io/instance": DefaultCheFlavor(cheCluster),
"app.kubernetes.io/managed-by": DefaultCheFlavor(cheCluster) + "-operator",
"app.kubernetes.io/name": DefaultCheFlavor(cheCluster),
},
OwnerReferences: []metav1.OwnerReference{
{
@ -116,9 +122,9 @@ func TestRouteSpec(t *testing.T) {
Labels: map[string]string{
"type": "default",
"app.kubernetes.io/component": "test-component",
"app.kubernetes.io/instance": "che",
"app.kubernetes.io/managed-by": "che-operator",
"app.kubernetes.io/name": "che",
"app.kubernetes.io/instance": DefaultCheFlavor(cheCluster),
"app.kubernetes.io/managed-by": DefaultCheFlavor(cheCluster) + "-operator",
"app.kubernetes.io/name": DefaultCheFlavor(cheCluster),
},
OwnerReferences: []metav1.OwnerReference{
{
@ -159,11 +165,7 @@ func TestRouteSpec(t *testing.T) {
cli := fake.NewFakeClientWithScheme(scheme.Scheme, testCase.initObjects...)
deployContext := &DeployContext{
CheCluster: &orgv1.CheCluster{
ObjectMeta: metav1.ObjectMeta{
Namespace: "eclipse-che",
},
},
CheCluster: cheCluster,
ClusterAPI: ClusterAPI{
Client: cli,
Scheme: scheme.Scheme,