Skip to content

Commit

Permalink
Validating labels of k8s resources in functional tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Yetkin Timocin authored and Yetkin Timocin committed Sep 19, 2023
1 parent 9511b04 commit 215aa18
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 12 deletions.
4 changes: 2 additions & 2 deletions test/functional/shared/resources/recipe_terraform_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ func Test_TerraformRecipe_KubernetesRedis(t *testing.T) {
ValidateLabels(false),
},
secretNamespace: {
validation.NewK8sSecretForResourceWithResourceName(secretPrefix + secretSuffix).
validation.NewK8sSecretForResource(name, secretPrefix+secretSuffix).
ValidateLabels(false),
},
},
Expand Down Expand Up @@ -146,7 +146,7 @@ func Test_TerraformRecipe_Context(t *testing.T) {
validation.NewK8sSecretForResource(name, name),
},
secretNamespace: {
validation.NewK8sSecretForResourceWithResourceName(secretPrefix + secretSuffix).
validation.NewK8sSecretForResource(name, secretPrefix+secretSuffix).
ValidateLabels(false),
},
},
Expand Down
25 changes: 15 additions & 10 deletions test/validation/k8s.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,9 @@ func NewK8sPodForResource(application string, name string) K8sObject {
Version: "v1",
Resource: "pods",
},
Kind: "Pod",
Labels: kuberneteskeys.MakeSelectorLabels(application, name),
Kind: "Pod",
Labels: kuberneteskeys.MakeSelectorLabels(application, name),
ResourceName: name,
}
}

Expand All @@ -94,8 +95,9 @@ func NewK8sHTTPProxyForResource(application string, name string) K8sObject {
Version: "v1",
Resource: "httpproxies",
},
Kind: "HTTPProxy",
Labels: kuberneteskeys.MakeSelectorLabels(application, name),
Kind: "HTTPProxy",
Labels: kuberneteskeys.MakeSelectorLabels(application, name),
ResourceName: name,
}
}

Expand All @@ -107,8 +109,9 @@ func NewK8sServiceForResource(application string, name string) K8sObject {
Version: "v1",
Resource: "services",
},
Kind: "Service",
Labels: kuberneteskeys.MakeSelectorLabels(application, name),
Kind: "Service",
Labels: kuberneteskeys.MakeSelectorLabels(application, name),
ResourceName: name,
}
}

Expand All @@ -120,8 +123,9 @@ func NewK8sSecretForResource(application string, name string) K8sObject {
Version: "v1",
Resource: "secrets",
},
Kind: "Secret",
Labels: kuberneteskeys.MakeSelectorLabels(application, name),
Kind: "Secret",
Labels: kuberneteskeys.MakeSelectorLabels(application, name),
ResourceName: name,
}
}

Expand Down Expand Up @@ -602,7 +606,8 @@ func NewDaprComponent(application string, name string) K8sObject {
Version: "v1alpha1",
Resource: "components",
},
Kind: "Component",
Labels: kuberneteskeys.MakeSelectorLabels(application, name),
Kind: "Component",
Labels: kuberneteskeys.MakeSelectorLabels(application, name),
ResourceName: name,
}
}

0 comments on commit 215aa18

Please sign in to comment.