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 16, 2023
1 parent 2eb5df4 commit a7e1917
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 50 deletions.
17 changes: 5 additions & 12 deletions test/functional/daprrp/resources/dapr_pubsub_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,9 @@ func Test_DaprPubSubBroker_Manual(t *testing.T) {
Namespaces: map[string][]validation.K8sObject{
appNamespace: {
validation.NewK8sPodForResource(name, "dpsb-manual-app-ctnr"),
validation.NewK8sPodForResource(name, "dpsb-manual-redis").
ValidateLabels(false),
validation.NewK8sServiceForResource(name, "dpsb-manual-redis").
ValidateLabels(false),

validation.NewDaprComponent(name, "dpsb-manual").
ValidateLabels(false),
validation.NewK8sPodForResource(name, "dpsb-manual-redis"),
validation.NewK8sServiceForResource(name, "dpsb-manual-redis"),
validation.NewDaprComponent(name, "dpsb-manual"),
},
},
},
Expand Down Expand Up @@ -113,11 +109,8 @@ func Test_DaprPubSubBroker_Recipe(t *testing.T) {
K8sObjects: &validation.K8sObjectSet{
Namespaces: map[string][]validation.K8sObject{
appNamespace: {
validation.NewK8sPodForResource(name, "dpsb-recipe-ctnr").
ValidateLabels(false),

validation.NewDaprComponent(name, "dpsb-recipe").
ValidateLabels(false),
validation.NewK8sPodForResource(name, "dpsb-recipe-ctnr"),
validation.NewDaprComponent(name, "dpsb-recipe"),
},
},
},
Expand Down
12 changes: 3 additions & 9 deletions test/functional/daprrp/resources/dapr_secretstore_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,7 @@ func Test_DaprSecretStore_Manual(t *testing.T) {
Namespaces: map[string][]validation.K8sObject{
appNamespace: {
validation.NewK8sPodForResource(name, "gnrc-scs-ctnr"),

// Not sure why we skip validating the labels
validation.NewDaprComponent(name, "gnrc-scs-manual").
ValidateLabels(false),
validation.NewDaprComponent(name, "gnrc-scs-manual"),
},
},
},
Expand Down Expand Up @@ -104,11 +101,8 @@ func Test_DaprSecretStore_Recipe(t *testing.T) {
K8sObjects: &validation.K8sObjectSet{
Namespaces: map[string][]validation.K8sObject{
appNamespace: {
validation.NewK8sPodForResource(name, "gnrc-scs-ctnr-recipe").
ValidateLabels(false),

validation.NewDaprComponent(name, "gnrc-scs-recipe").
ValidateLabels(false),
validation.NewK8sPodForResource(name, "gnrc-scs-ctnr-recipe"),
validation.NewDaprComponent(name, "gnrc-scs-recipe"),
},
},
},
Expand Down
18 changes: 5 additions & 13 deletions test/functional/daprrp/resources/dapr_statestore_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,15 +57,10 @@ func Test_DaprStateStore_Manual(t *testing.T) {
Namespaces: map[string][]validation.K8sObject{
appNamespace: {
validation.NewK8sPodForResource(name, "dapr-sts-manual-ctnr"),

// Deployed as supporting resources using Kubernetes Bicep extensibility.
validation.NewK8sPodForResource(name, "dapr-sts-manual-redis").
ValidateLabels(false),
validation.NewK8sServiceForResource(name, "dapr-sts-manual-redis").
ValidateLabels(false),

validation.NewDaprComponent(name, "dapr-sts-manual").
ValidateLabels(false),
validation.NewK8sPodForResource(name, "dapr-sts-manual-redis"),
validation.NewK8sServiceForResource(name, "dapr-sts-manual-redis"),
validation.NewDaprComponent(name, "dapr-sts-manual"),
},
},
},
Expand Down Expand Up @@ -115,11 +110,8 @@ func Test_DaprStateStore_Recipe(t *testing.T) {
K8sObjects: &validation.K8sObjectSet{
Namespaces: map[string][]validation.K8sObject{
appNamespace: {
validation.NewK8sPodForResource(name, "dapr-sts-recipe-ctnr").
ValidateLabels(false),

validation.NewDaprComponent(name, "dapr-sts-recipe").
ValidateLabels(false),
validation.NewK8sPodForResource(name, "dapr-sts-recipe-ctnr"),
validation.NewDaprComponent(name, "dapr-sts-recipe"),
},
},
},
Expand Down
12 changes: 6 additions & 6 deletions test/functional/datastoresrp/resources/mongodb_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,9 @@ func Test_MongoDB_Manual(t *testing.T) {
K8sObjects: &validation.K8sObjectSet{
Namespaces: map[string][]validation.K8sObject{
appNamespace: {
validation.NewK8sPodForResource(name, "mdb-us-app-ctnr").ValidateLabels(false),
validation.NewK8sPodForResource(name, "mdb-us-ctnr").ValidateLabels(false),
validation.NewK8sServiceForResource(name, "mdb-us-rte").ValidateLabels(false),
validation.NewK8sPodForResource(name, "mdb-us-app-ctnr"),
validation.NewK8sPodForResource(name, "mdb-us-ctnr"),
validation.NewK8sServiceForResource(name, "mdb-us-rte"),
},
},
},
Expand Down Expand Up @@ -114,7 +114,7 @@ func Test_MongoDB_Recipe(t *testing.T) {
K8sObjects: &validation.K8sObjectSet{
Namespaces: map[string][]validation.K8sObject{
appNamespace: {
validation.NewK8sPodForResource(name, "mongodb-app-ctnr").ValidateLabels(false),
validation.NewK8sPodForResource(name, "mongodb-app-ctnr"),
},
},
},
Expand Down Expand Up @@ -170,7 +170,7 @@ func Test_MongoDB_RecipeParameters(t *testing.T) {
K8sObjects: &validation.K8sObjectSet{
Namespaces: map[string][]validation.K8sObject{
appNamespace: {
validation.NewK8sPodForResource(name, "mdb-param-ctnr").ValidateLabels(false),
validation.NewK8sPodForResource(name, "mdb-param-ctnr"),
},
},
},
Expand Down Expand Up @@ -225,7 +225,7 @@ func Test_MongoDB_Recipe_ContextParameter(t *testing.T) {
K8sObjects: &validation.K8sObjectSet{
Namespaces: map[string][]validation.K8sObject{
appNamespace: {
validation.NewK8sPodForResource(name, "mdb-ctx-ctnr").ValidateLabels(false),
validation.NewK8sPodForResource(name, "mdb-ctx-ctnr"),
},
},
},
Expand Down
4 changes: 2 additions & 2 deletions test/functional/datastoresrp/resources/sql_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,8 @@ func Test_SQLDatabase_Recipe(t *testing.T) {
K8sObjects: &validation.K8sObjectSet{
Namespaces: map[string][]validation.K8sObject{
appNamespace: {
validation.NewK8sPodForResource(name, "sql-recipe-app-ctnr").ValidateLabels(false),
validation.NewK8sPodForResource(name, "sql-recipe-resource").ValidateLabels(false),
validation.NewK8sPodForResource(name, "sql-recipe-app-ctnr"),
validation.NewK8sPodForResource(name, "sql-recipe-resource"),
},
},
},
Expand Down
4 changes: 2 additions & 2 deletions test/functional/messagingrp/resources/rabbitmq_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,8 @@ func Test_RabbitMQ_Recipe(t *testing.T) {
K8sObjects: &validation.K8sObjectSet{
Namespaces: map[string][]validation.K8sObject{
appNamespace: {
validation.NewK8sPodForResource(name, "rmq-recipe-app-ctnr").ValidateLabels(false),
validation.NewK8sPodForResource(name, "rmq-recipe-resource").ValidateLabels(false),
validation.NewK8sPodForResource(name, "rmq-recipe-app-ctnr"),
validation.NewK8sPodForResource(name, "rmq-recipe-resource"),
},
},
},
Expand Down
9 changes: 3 additions & 6 deletions test/functional/shared/resources/recipe_terraform_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,12 +90,10 @@ func Test_TerraformRecipe_KubernetesRedis(t *testing.T) {
K8sObjects: &validation.K8sObjectSet{
Namespaces: map[string][]validation.K8sObject{
appName: {
validation.NewK8sServiceForResource(appName, redisCacheName).
ValidateLabels(false),
validation.NewK8sServiceForResource(appName, redisCacheName),
},
secretNamespace: {
validation.NewK8sSecretForResourceWithResourceName(secretPrefix + secretSuffix).
ValidateLabels(false),
validation.NewK8sSecretForResourceWithResourceName(secretPrefix + secretSuffix),
},
},
},
Expand Down Expand Up @@ -146,8 +144,7 @@ func Test_TerraformRecipe_Context(t *testing.T) {
validation.NewK8sSecretForResource(name, name),
},
secretNamespace: {
validation.NewK8sSecretForResourceWithResourceName(secretPrefix + secretSuffix).
ValidateLabels(false),
validation.NewK8sSecretForResourceWithResourceName(secretPrefix + secretSuffix),
},
},
},
Expand Down

0 comments on commit a7e1917

Please sign in to comment.