Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multi namespaces Support #62

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions tests/main_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package tests

import (
"encoding/json"
"flag"
"fmt"
"log"
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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())
}

Expand All @@ -91,4 +100,18 @@ 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, ",")
LucasRoesler marked this conversation as resolved.
Show resolved Hide resolved
for index := range config.Namespaces {
config.Namespaces[index] = strings.TrimSpace(config.Namespaces[index])
}
}
}