From bf8ba3aa0c8fa251c5894572be351ff3ee0f3a15 Mon Sep 17 00:00:00 2001 From: Nitishkumar Singh Date: Sat, 27 Mar 2021 23:42:00 +0530 Subject: [PATCH] Multi Namespace Test Support Signed-off-by: Nitishkumar Singh updates for multi-namespaces Signed-off-by: Nitishkumar Singh --- tests/main_test.go | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/tests/main_test.go b/tests/main_test.go index 870ab6f..845bfe9 100644 --- a/tests/main_test.go +++ b/tests/main_test.go @@ -1,6 +1,7 @@ package tests import ( + "encoding/json" "flag" "fmt" "log" @@ -37,6 +38,8 @@ func init() { ) flag.BoolVar(&config.SecretUpdate, "secretUpdate", true, "enable/disable secret update tests") flag.BoolVar(&config.ScaleToZero, "scaleToZero", true, "enable/disable scale from zero tests") + + FromEnv(&config) } func TestMain(m *testing.M) { @@ -70,6 +73,12 @@ func TestMain(m *testing.M) { timeout := 5 * time.Second config.Client = sdk.NewClient(config.Auth, config.Gateway, nil, &timeout) + prettyConfig, err := json.MarshalIndent(config, "", "\t") + if err != nil { + log.Fatalf("Config Pretty Print Failed with %s", err) + } + log.Println(string(prettyConfig)) + os.Exit(m.Run()) } @@ -91,4 +100,15 @@ type Config struct { SecretUpdate bool // ScaleToZero enables/disables the scale from zero test ScaleToZero bool + + // Namespaces to verfiy OpenFaaS provider + Namespaces []string +} + +func FromEnv(config *Config) { + // read CERTIFIER_NAMESPACES variable, parse as csv string + namespaces, present := os.LookupEnv("CERTIFIER_NAMESPACES") + if present { + config.Namespaces = strings.Split(namespaces, ",") + } }