Skip to content

Commit

Permalink
k8s-tester: add "php-apache"
Browse files Browse the repository at this point in the history
Signed-off-by: Gyuho Lee <[email protected]>
  • Loading branch information
gyuho committed May 30, 2021
1 parent 37d5fb2 commit a9a70d6
Show file tree
Hide file tree
Showing 15 changed files with 1,977 additions and 19 deletions.
16 changes: 16 additions & 0 deletions k8s-tester/README.config.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,22 @@
*------------------------------------------------------*----------------------*-------------------------------------------*---------*
*-------------------------------------------------------*----------------------*-------------------------------------------*-------------------*
| ENVIRONMENTAL VARIABLE | FIELD TYPE | TYPE | GO TYPE |
*-------------------------------------------------------*----------------------*-------------------------------------------*-------------------*
| K8S_TESTER_ADD_ON_PHP_APACHE_ENABLE | SETTABLE VIA ENV VAR | *php_apache.Config.Enable | bool |
| K8S_TESTER_ADD_ON_PHP_APACHE_MINIMUM_NODES | SETTABLE VIA ENV VAR | *php_apache.Config.MinimumNodes | int |
| K8S_TESTER_ADD_ON_PHP_APACHE_NAMESPACE | SETTABLE VIA ENV VAR | *php_apache.Config.Namespace | string |
| K8S_TESTER_ADD_ON_PHP_APACHE_REPOSITORY_PARTITION | SETTABLE VIA ENV VAR | *php_apache.Config.RepositoryPartition | string |
| K8S_TESTER_ADD_ON_PHP_APACHE_REPOSITORY_ACCOUNT_ID | SETTABLE VIA ENV VAR | *php_apache.Config.RepositoryAccountID | string |
| K8S_TESTER_ADD_ON_PHP_APACHE_REPOSITORY_REGION | SETTABLE VIA ENV VAR | *php_apache.Config.RepositoryRegion | string |
| K8S_TESTER_ADD_ON_PHP_APACHE_REPOSITORY_NAME | SETTABLE VIA ENV VAR | *php_apache.Config.RepositoryName | string |
| K8S_TESTER_ADD_ON_PHP_APACHE_REPOSITORY_IMAGE_TAG | SETTABLE VIA ENV VAR | *php_apache.Config.RepositoryImageTag | string |
| K8S_TESTER_ADD_ON_PHP_APACHE_DEPLOYMENT_NODE_SELECTOR | SETTABLE VIA ENV VAR | *php_apache.Config.DeploymentNodeSelector | map[string]string |
| K8S_TESTER_ADD_ON_PHP_APACHE_DEPLOYMENT_REPLICAS | SETTABLE VIA ENV VAR | *php_apache.Config.DeploymentReplicas | int32 |
*-------------------------------------------------------*----------------------*-------------------------------------------*-------------------*
*------------------------------------------------------------*----------------------*------------------------------------------------*-------------------*
| ENVIRONMENTAL VARIABLE | FIELD TYPE | TYPE | GO TYPE |
*------------------------------------------------------------*----------------------*------------------------------------------------*-------------------*
Expand Down
4 changes: 3 additions & 1 deletion k8s-tester/cmd/k8s-tester/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ go 1.16

require (
github.com/aws/aws-k8s-tester/k8s-tester v0.0.0-00010101000000-000000000000
github.com/aws/aws-k8s-tester/k8s-tester/php-apache v0.0.0-00010101000000-000000000000 // indirect
github.com/aws/aws-k8s-tester/utils v0.0.0-00010101000000-000000000000
github.com/spf13/cobra v1.1.3
)
Expand All @@ -13,14 +14,15 @@ replace (

github.com/aws/aws-k8s-tester/k8s-tester => ../..
github.com/aws/aws-k8s-tester/k8s-tester/cloudwatch-agent => ../../cloudwatch-agent
github.com/aws/aws-k8s-tester/k8s-tester/fluent-bit => ../../fluent-bit
github.com/aws/aws-k8s-tester/k8s-tester/csi-ebs => ../../csi-ebs
github.com/aws/aws-k8s-tester/k8s-tester/fluent-bit => ../../fluent-bit
github.com/aws/aws-k8s-tester/k8s-tester/helm => ../../helm
github.com/aws/aws-k8s-tester/k8s-tester/jobs-echo => ../../jobs-echo
github.com/aws/aws-k8s-tester/k8s-tester/jobs-pi => ../../jobs-pi
github.com/aws/aws-k8s-tester/k8s-tester/kubernetes-dashboard => ../../kubernetes-dashboard
github.com/aws/aws-k8s-tester/k8s-tester/metrics-server => ../../metrics-server
github.com/aws/aws-k8s-tester/k8s-tester/nlb-hello-world => ../../nlb-hello-world
github.com/aws/aws-k8s-tester/k8s-tester/php-apache => ../../php-apache
github.com/aws/aws-k8s-tester/k8s-tester/tester => ../../tester
github.com/aws/aws-k8s-tester/utils => ../../../utils
)
573 changes: 572 additions & 1 deletion k8s-tester/cmd/k8s-tester/go.sum

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions k8s-tester/cmd/readme-gen/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ require (
github.com/aws/aws-k8s-tester/k8s-tester/kubernetes-dashboard v0.0.0-00010101000000-000000000000
github.com/aws/aws-k8s-tester/k8s-tester/metrics-server v0.0.0-00010101000000-000000000000
github.com/aws/aws-k8s-tester/k8s-tester/nlb-hello-world v0.0.0-00010101000000-000000000000
github.com/aws/aws-k8s-tester/k8s-tester/php-apache v0.0.0-00010101000000-000000000000
github.com/olekukonko/tablewriter v0.0.5
)

Expand All @@ -28,6 +29,7 @@ replace (
github.com/aws/aws-k8s-tester/k8s-tester/kubernetes-dashboard => ../../kubernetes-dashboard
github.com/aws/aws-k8s-tester/k8s-tester/metrics-server => ../../metrics-server
github.com/aws/aws-k8s-tester/k8s-tester/nlb-hello-world => ../../nlb-hello-world
github.com/aws/aws-k8s-tester/k8s-tester/php-apache => ../../php-apache
github.com/aws/aws-k8s-tester/k8s-tester/tester => ../../tester
github.com/aws/aws-k8s-tester/utils => ../../../utils
)
5 changes: 5 additions & 0 deletions k8s-tester/cmd/readme-gen/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import (
kubernetes_dashboard "github.com/aws/aws-k8s-tester/k8s-tester/kubernetes-dashboard"
metrics_server "github.com/aws/aws-k8s-tester/k8s-tester/metrics-server"
nlb_hello_world "github.com/aws/aws-k8s-tester/k8s-tester/nlb-hello-world"
php_apache "github.com/aws/aws-k8s-tester/k8s-tester/php-apache"
"github.com/olekukonko/tablewriter"
)

Expand Down Expand Up @@ -56,6 +57,10 @@ func createDoc() string {
b.WriteByte('\n')
b.WriteString(es.writeDoc(k8s_tester.ENV_PREFIX+kubernetes_dashboard.Env()+"_", &kubernetes_dashboard.Config{}))

b.WriteByte('\n')
b.WriteByte('\n')
b.WriteString(es.writeDoc(k8s_tester.ENV_PREFIX+php_apache.Env()+"_", &php_apache.Config{}))

b.WriteByte('\n')
b.WriteByte('\n')
b.WriteString(es.writeDoc(k8s_tester.ENV_PREFIX+nlb_hello_world.Env()+"_", &nlb_hello_world.Config{}))
Expand Down
13 changes: 13 additions & 0 deletions k8s-tester/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import (
kubernetes_dashboard "github.com/aws/aws-k8s-tester/k8s-tester/kubernetes-dashboard"
metrics_server "github.com/aws/aws-k8s-tester/k8s-tester/metrics-server"
nlb_hello_world "github.com/aws/aws-k8s-tester/k8s-tester/nlb-hello-world"
php_apache "github.com/aws/aws-k8s-tester/k8s-tester/php-apache"
"github.com/aws/aws-k8s-tester/utils/log"
"github.com/aws/aws-k8s-tester/utils/rand"
utils_time "github.com/aws/aws-k8s-tester/utils/time"
Expand Down Expand Up @@ -80,6 +81,7 @@ type Config struct {
AddOnMetricsServer *metrics_server.Config `json:"add_on_metrics_server"`
AddOnCSIEBS *csi_ebs.Config `json:"add_on_csi_ebs"`
AddOnKubernetesDashboard *kubernetes_dashboard.Config `json:"add_on_kubernetes_dashboard"`
AddOnPHPApache *php_apache.Config `json:"add_on_php_apache"`
AddOnNLBHelloWorld *nlb_hello_world.Config `json:"add_on_nlb_hello_world"`
AddOnJobsPi *jobs_pi.Config `json:"add_on_jobs_pi"`
AddOnJobsEcho *jobs_echo.Config `json:"add_on_jobs_echo"`
Expand Down Expand Up @@ -121,6 +123,7 @@ func NewDefault() *Config {
AddOnMetricsServer: metrics_server.NewDefault(),
AddOnCSIEBS: csi_ebs.NewDefault(),
AddOnKubernetesDashboard: kubernetes_dashboard.NewDefault(),
AddOnPHPApache: php_apache.NewDefault(),
AddOnNLBHelloWorld: nlb_hello_world.NewDefault(),
AddOnJobsPi: jobs_pi.NewDefault(),
AddOnJobsEcho: jobs_echo.NewDefault("Job"),
Expand Down Expand Up @@ -267,6 +270,16 @@ func (cfg *Config) UpdateFromEnvs() (err error) {
return fmt.Errorf("expected *kubernetes_dashboard.Config, got %T", vv)
}

vv, err = parseEnvs(ENV_PREFIX+php_apache.Env()+"_", cfg.AddOnPHPApache)
if err != nil {
return err
}
if av, ok := vv.(*php_apache.Config); ok {
cfg.AddOnPHPApache = av
} else {
return fmt.Errorf("expected *php_apache.Config, got %T", vv)
}

vv, err = parseEnvs(ENV_PREFIX+nlb_hello_world.Env()+"_", cfg.AddOnNLBHelloWorld)
if err != nil {
return err
Expand Down
132 changes: 116 additions & 16 deletions k8s-tester/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,6 @@ func TestEnvAddOnCSIEBS(t *testing.T) {

os.Setenv("K8S_TESTER_ADD_ON_CSI_EBS_ENABLE", "true")
defer os.Unsetenv("K8S_TESTER_ADD_ON_CSI_EBS_ENABLE")
os.Setenv("K8S_TESTER_ADD_ON_CSI_EBS_NAMESPACE", "hello")
defer os.Unsetenv("K8S_TESTER_ADD_ON_CSI_EBS_NAMESPACE")

if err := cfg.UpdateFromEnvs(); err != nil {
t.Fatal(err)
Expand All @@ -121,9 +119,6 @@ func TestEnvAddOnCSIEBS(t *testing.T) {
if !cfg.AddOnCSIEBS.Enable {
t.Fatalf("unexpected cfg.AddOnCSIEBS.Enable %v", cfg.AddOnCSIEBS.Enable)
}
if cfg.AddOnCSIEBS.Namespace != "hello" {
t.Fatalf("unexpected cfg.AddOnCSIEBS.Namespace %v", cfg.AddOnCSIEBS.Namespace)
}
}

func TestEnvAddOnKubernetesDashboard(t *testing.T) {
Expand All @@ -146,17 +141,72 @@ func TestEnvAddOnKubernetesDashboard(t *testing.T) {
}
}

func TestEnvAddOnPHPApache(t *testing.T) {
cfg := NewDefault()

os.Setenv("K8S_TESTER_ADD_ON_PHP_APACHE_ENABLE", "true")
defer os.Unsetenv("K8S_TESTER_ADD_ON_PHP_APACHE_ENABLE")
os.Setenv("K8S_TESTER_ADD_ON_PHP_APACHE_MINIMUM_NODES", "100")
defer os.Unsetenv("K8S_TESTER_ADD_ON_PHP_APACHE_MINIMUM_NODES")
os.Setenv("K8S_TESTER_ADD_ON_PHP_APACHE_NAMESPACE", "hello")
defer os.Unsetenv("K8S_TESTER_ADD_ON_PHP_APACHE_NAMESPACE")
os.Setenv("K8S_TESTER_ADD_ON_PHP_APACHE_REPOSITORY_PARTITION", "aws")
defer os.Unsetenv("K8S_TESTER_ADD_ON_PHP_APACHE_REPOSITORY_PARTITION")
os.Setenv("K8S_TESTER_ADD_ON_PHP_APACHE_REPOSITORY_ACCOUNT_ID", "123")
defer os.Unsetenv("K8S_TESTER_ADD_ON_PHP_APACHE_REPOSITORY_ACCOUNT_ID")
os.Setenv("K8S_TESTER_ADD_ON_PHP_APACHE_REPOSITORY_REGION", "hello")
defer os.Unsetenv("K8S_TESTER_ADD_ON_PHP_APACHE_REPOSITORY_REGION")
os.Setenv("K8S_TESTER_ADD_ON_PHP_APACHE_REPOSITORY_NAME", "hello")
defer os.Unsetenv("K8S_TESTER_ADD_ON_PHP_APACHE_REPOSITORY_NAME")
os.Setenv("K8S_TESTER_ADD_ON_PHP_APACHE_REPOSITORY_IMAGE_TAG", "hello")
defer os.Unsetenv("K8S_TESTER_ADD_ON_PHP_APACHE_REPOSITORY_IMAGE_TAG")
os.Setenv("K8S_TESTER_ADD_ON_PHP_APACHE_DEPLOYMENT_NODE_SELECTOR", `{"a":"b","c":"d"}`)
defer os.Unsetenv("K8S_TESTER_ADD_ON_PHP_APACHE_DEPLOYMENT_NODE_SELECTOR")

if err := cfg.UpdateFromEnvs(); err != nil {
t.Fatal(err)
}

if !cfg.AddOnPHPApache.Enable {
t.Fatalf("unexpected cfg.AddOnPHPApache.Enable %v", cfg.AddOnPHPApache.Enable)
}
if cfg.AddOnPHPApache.MinimumNodes != 100 {
t.Fatalf("unexpected cfg.AddOnPHPApache.MinimumNodes %v", cfg.AddOnPHPApache.MinimumNodes)
}
if cfg.AddOnPHPApache.Namespace != "hello" {
t.Fatalf("unexpected cfg.AddOnPHPApache.Namespace %v", cfg.AddOnPHPApache.Namespace)
}
if cfg.AddOnPHPApache.RepositoryPartition != "aws" {
t.Fatalf("unexpected cfg.AddOnPHPApache.RepositoryPartition %v", cfg.AddOnPHPApache.RepositoryPartition)
}
if cfg.AddOnPHPApache.RepositoryAccountID != "123" {
t.Fatalf("unexpected cfg.AddOnPHPApache.RepositoryAccountID %v", cfg.AddOnPHPApache.RepositoryAccountID)
}
if cfg.AddOnPHPApache.RepositoryRegion != "hello" {
t.Fatalf("unexpected cfg.AddOnPHPApache.RepositoryRegion %v", cfg.AddOnPHPApache.RepositoryRegion)
}
if cfg.AddOnPHPApache.RepositoryName != "hello" {
t.Fatalf("unexpected cfg.AddOnPHPApache.RepositoryName %v", cfg.AddOnPHPApache.RepositoryName)
}
if cfg.AddOnPHPApache.RepositoryImageTag != "hello" {
t.Fatalf("unexpected cfg.AddOnPHPApache.RepositoryImageTag %v", cfg.AddOnPHPApache.RepositoryImageTag)
}
if !reflect.DeepEqual(cfg.AddOnPHPApache.DeploymentNodeSelector, map[string]string{"a": "b", "c": "d"}) {
t.Fatalf("unexpected cfg.AddOnPHPApache.DeploymentNodeSelector %v", cfg.AddOnPHPApache.DeploymentNodeSelector)
}
}

func TestEnvAddOnNLBHelloWorld(t *testing.T) {
cfg := NewDefault()

os.Setenv("K8S_TESTER_CONFIG_PATH", "test.yaml")
defer os.Unsetenv("K8S_TESTER_CONFIG_PATH")
os.Setenv("K8S_TESTER_ADD_ON_NLB_HELLO_WORLD_ENABLE", "true")
defer os.Unsetenv("K8S_TESTER_ADD_ON_NLB_HELLO_WORLD_ENABLE")
os.Setenv("K8S_TESTER_ADD_ON_NLB_HELLO_WORLD_NAMESPACE", "hello")
defer os.Unsetenv("K8S_TESTER_ADD_ON_NLB_HELLO_WORLD_NAMESPACE")
os.Setenv("K8S_TESTER_ADD_ON_NLB_HELLO_WORLD_MINIMUM_NODES", "100")
defer os.Unsetenv("K8S_TESTER_ADD_ON_NLB_HELLO_WORLD_MINIMUM_NODES")
os.Setenv("K8S_TESTER_ADD_ON_NLB_HELLO_WORLD_NAMESPACE", "hello")
defer os.Unsetenv("K8S_TESTER_ADD_ON_NLB_HELLO_WORLD_NAMESPACE")
os.Setenv("K8S_TESTER_ADD_ON_NLB_HELLO_WORLD_DEPLOYMENT_NODE_SELECTOR", `{"a":"b","c":"d"}`)
defer os.Unsetenv("K8S_TESTER_ADD_ON_NLB_HELLO_WORLD_DEPLOYMENT_NODE_SELECTOR")

Expand Down Expand Up @@ -186,10 +236,10 @@ func TestEnvAddOnJobsPi(t *testing.T) {

os.Setenv("K8S_TESTER_ADD_ON_JOBS_PI_ENABLE", "true")
defer os.Unsetenv("K8S_TESTER_ADD_ON_JOBS_PI_ENABLE")
os.Setenv("K8S_TESTER_ADD_ON_JOBS_PI_NAMESPACE", "hello")
defer os.Unsetenv("K8S_TESTER_ADD_ON_JOBS_PI_NAMESPACE")
os.Setenv("K8S_TESTER_ADD_ON_JOBS_PI_MINIMUM_NODES", "100")
defer os.Unsetenv("K8S_TESTER_ADD_ON_JOBS_PI_MINIMUM_NODES")
os.Setenv("K8S_TESTER_ADD_ON_JOBS_PI_NAMESPACE", "hello")
defer os.Unsetenv("K8S_TESTER_ADD_ON_JOBS_PI_NAMESPACE")
os.Setenv("K8S_TESTER_ADD_ON_JOBS_PI_COMPLETES", `222`)
defer os.Unsetenv("K8S_TESTER_ADD_ON_JOBS_PI_COMPLETES")
os.Setenv("K8S_TESTER_ADD_ON_JOBS_PI_PARALLELS", `333`)
Expand All @@ -199,12 +249,12 @@ func TestEnvAddOnJobsPi(t *testing.T) {
t.Fatal(err)
}

if cfg.AddOnJobsPi.MinimumNodes != 100 {
t.Fatalf("unexpected cfg.AddOnJobsPi.MinimumNodes %v", cfg.AddOnJobsPi.MinimumNodes)
}
if !cfg.AddOnJobsPi.Enable {
t.Fatalf("unexpected cfg.AddOnJobsPi.Enable %v", cfg.AddOnJobsPi.Enable)
}
if cfg.AddOnJobsPi.MinimumNodes != 100 {
t.Fatalf("unexpected cfg.AddOnJobsPi.MinimumNodes %v", cfg.AddOnJobsPi.MinimumNodes)
}
if cfg.AddOnJobsPi.Namespace != "hello" {
t.Fatalf("unexpected cfg.AddOnJobsPi.Namespace %v", cfg.AddOnJobsPi.Namespace)
}
Expand All @@ -221,10 +271,20 @@ func TestEnvAddOnJobsEcho(t *testing.T) {

os.Setenv("K8S_TESTER_ADD_ON_JOBS_ECHO_ENABLE", "true")
defer os.Unsetenv("K8S_TESTER_ADD_ON_JOBS_ECHO_ENABLE")
os.Setenv("K8S_TESTER_ADD_ON_JOBS_ECHO_NAMESPACE", "hello")
defer os.Unsetenv("K8S_TESTER_ADD_ON_JOBS_ECHO_NAMESPACE")
os.Setenv("K8S_TESTER_ADD_ON_JOBS_ECHO_MINIMUM_NODES", "100")
defer os.Unsetenv("K8S_TESTER_ADD_ON_JOBS_ECHO_MINIMUM_NODES")
os.Setenv("K8S_TESTER_ADD_ON_JOBS_ECHO_NAMESPACE", "hello")
defer os.Unsetenv("K8S_TESTER_ADD_ON_JOBS_ECHO_NAMESPACE")
os.Setenv("K8S_TESTER_ADD_ON_JOBS_ECHO_REPOSITORY_BUSYBOX_PARTITION", "aws")
defer os.Unsetenv("K8S_TESTER_ADD_ON_JOBS_ECHO_REPOSITORY_BUSYBOX_PARTITION")
os.Setenv("K8S_TESTER_ADD_ON_JOBS_ECHO_REPOSITORY_BUSYBOX_ACCOUNT_ID", "123")
defer os.Unsetenv("K8S_TESTER_ADD_ON_JOBS_ECHO_REPOSITORY_BUSYBOX_ACCOUNT_ID")
os.Setenv("K8S_TESTER_ADD_ON_JOBS_ECHO_REPOSITORY_BUSYBOX_REGION", "hello")
defer os.Unsetenv("K8S_TESTER_ADD_ON_JOBS_ECHO_REPOSITORY_BUSYBOX_REGION")
os.Setenv("K8S_TESTER_ADD_ON_JOBS_ECHO_REPOSITORY_BUSYBOX_NAME", "hello")
defer os.Unsetenv("K8S_TESTER_ADD_ON_JOBS_ECHO_REPOSITORY_BUSYBOX_NAME")
os.Setenv("K8S_TESTER_ADD_ON_JOBS_ECHO_REPOSITORY_BUSYBOX_IMAGE_TAG", "hello")
defer os.Unsetenv("K8S_TESTER_ADD_ON_JOBS_ECHO_REPOSITORY_BUSYBOX_IMAGE_TAG")
os.Setenv("K8S_TESTER_ADD_ON_JOBS_ECHO_COMPLETES", `222`)
defer os.Unsetenv("K8S_TESTER_ADD_ON_JOBS_ECHO_COMPLETES")
os.Setenv("K8S_TESTER_ADD_ON_JOBS_ECHO_PARALLELS", `333`)
Expand All @@ -245,6 +305,21 @@ func TestEnvAddOnJobsEcho(t *testing.T) {
if cfg.AddOnJobsEcho.Namespace != "hello" {
t.Fatalf("unexpected cfg.AddOnJobsEcho.Namespace %v", cfg.AddOnJobsEcho.Namespace)
}
if cfg.AddOnJobsEcho.RepositoryBusyboxPartition != "aws" {
t.Fatalf("unexpected cfg.AddOnJobsEcho.RepositoryBusyboxPartition %v", cfg.AddOnJobsEcho.RepositoryBusyboxPartition)
}
if cfg.AddOnJobsEcho.RepositoryBusyboxAccountID != "123" {
t.Fatalf("unexpected cfg.AddOnJobsEcho.RepositoryBusyboxAccountID %v", cfg.AddOnJobsEcho.RepositoryBusyboxAccountID)
}
if cfg.AddOnJobsEcho.RepositoryBusyboxRegion != "hello" {
t.Fatalf("unexpected cfg.AddOnJobsEcho.RepositoryBusyboxRegion %v", cfg.AddOnJobsEcho.RepositoryBusyboxRegion)
}
if cfg.AddOnJobsEcho.RepositoryBusyboxName != "hello" {
t.Fatalf("unexpected cfg.AddOnJobsEcho.RepositoryBusyboxName %v", cfg.AddOnJobsEcho.RepositoryBusyboxName)
}
if cfg.AddOnJobsEcho.RepositoryBusyboxImageTag != "hello" {
t.Fatalf("unexpected cfg.AddOnJobsEcho.RepositoryBusyboxImageTag %v", cfg.AddOnJobsEcho.RepositoryBusyboxImageTag)
}
if cfg.AddOnJobsEcho.Completes != 222 {
t.Fatalf("unexpected cfg.AddOnJobsEcho.Completes %v", cfg.AddOnJobsEcho.Completes)
}
Expand All @@ -261,10 +336,20 @@ func TestEnvAddOnCronJobsEcho(t *testing.T) {

os.Setenv("K8S_TESTER_ADD_ON_CRON_JOBS_ECHO_ENABLE", "true")
defer os.Unsetenv("K8S_TESTER_ADD_ON_CRON_JOBS_ECHO_ENABLE")
os.Setenv("K8S_TESTER_ADD_ON_CRON_JOBS_ECHO_NAMESPACE", "hello")
defer os.Unsetenv("K8S_TESTER_ADD_ON_CRON_JOBS_ECHO_NAMESPACE")
os.Setenv("K8S_TESTER_ADD_ON_CRON_JOBS_ECHO_MINIMUM_NODES", "100")
defer os.Unsetenv("K8S_TESTER_ADD_ON_CRON_JOBS_ECHO_MINIMUM_NODES")
os.Setenv("K8S_TESTER_ADD_ON_CRON_JOBS_ECHO_NAMESPACE", "hello")
defer os.Unsetenv("K8S_TESTER_ADD_ON_CRON_JOBS_ECHO_NAMESPACE")
os.Setenv("K8S_TESTER_ADD_ON_CRON_JOBS_ECHO_REPOSITORY_BUSYBOX_PARTITION", "aws")
defer os.Unsetenv("K8S_TESTER_ADD_ON_CRON_JOBS_ECHO_REPOSITORY_BUSYBOX_PARTITION")
os.Setenv("K8S_TESTER_ADD_ON_CRON_JOBS_ECHO_REPOSITORY_BUSYBOX_ACCOUNT_ID", "123")
defer os.Unsetenv("K8S_TESTER_ADD_ON_CRON_JOBS_ECHO_REPOSITORY_BUSYBOX_ACCOUNT_ID")
os.Setenv("K8S_TESTER_ADD_ON_CRON_JOBS_ECHO_REPOSITORY_BUSYBOX_REGION", "hello")
defer os.Unsetenv("K8S_TESTER_ADD_ON_CRON_JOBS_ECHO_REPOSITORY_BUSYBOX_REGION")
os.Setenv("K8S_TESTER_ADD_ON_CRON_JOBS_ECHO_REPOSITORY_BUSYBOX_NAME", "hello")
defer os.Unsetenv("K8S_TESTER_ADD_ON_CRON_JOBS_ECHO_REPOSITORY_BUSYBOX_NAME")
os.Setenv("K8S_TESTER_ADD_ON_CRON_JOBS_ECHO_REPOSITORY_BUSYBOX_IMAGE_TAG", "hello")
defer os.Unsetenv("K8S_TESTER_ADD_ON_CRON_JOBS_ECHO_REPOSITORY_BUSYBOX_IMAGE_TAG")
os.Setenv("K8S_TESTER_ADD_ON_CRON_JOBS_ECHO_COMPLETES", `222`)
defer os.Unsetenv("K8S_TESTER_ADD_ON_CRON_JOBS_ECHO_COMPLETES")
os.Setenv("K8S_TESTER_ADD_ON_CRON_JOBS_ECHO_PARALLELS", `333`)
Expand All @@ -291,6 +376,21 @@ func TestEnvAddOnCronJobsEcho(t *testing.T) {
if cfg.AddOnCronJobsEcho.Namespace != "hello" {
t.Fatalf("unexpected cfg.AddOnCronJobsEcho.Namespace %v", cfg.AddOnCronJobsEcho.Namespace)
}
if cfg.AddOnCronJobsEcho.RepositoryBusyboxPartition != "aws" {
t.Fatalf("unexpected cfg.AddOnCronJobsEcho.RepositoryBusyboxPartition %v", cfg.AddOnCronJobsEcho.RepositoryBusyboxPartition)
}
if cfg.AddOnCronJobsEcho.RepositoryBusyboxAccountID != "123" {
t.Fatalf("unexpected cfg.AddOnCronJobsEcho.RepositoryBusyboxAccountID %v", cfg.AddOnCronJobsEcho.RepositoryBusyboxAccountID)
}
if cfg.AddOnCronJobsEcho.RepositoryBusyboxRegion != "hello" {
t.Fatalf("unexpected cfg.AddOnCronJobsEcho.RepositoryBusyboxRegion %v", cfg.AddOnCronJobsEcho.RepositoryBusyboxRegion)
}
if cfg.AddOnCronJobsEcho.RepositoryBusyboxName != "hello" {
t.Fatalf("unexpected cfg.AddOnCronJobsEcho.RepositoryBusyboxName %v", cfg.AddOnCronJobsEcho.RepositoryBusyboxName)
}
if cfg.AddOnCronJobsEcho.RepositoryBusyboxImageTag != "hello" {
t.Fatalf("unexpected cfg.AddOnCronJobsEcho.RepositoryBusyboxImageTag %v", cfg.AddOnCronJobsEcho.RepositoryBusyboxImageTag)
}
if cfg.AddOnCronJobsEcho.Completes != 222 {
t.Fatalf("unexpected cfg.AddOnCronJobsEcho.Completes %v", cfg.AddOnCronJobsEcho.Completes)
}
Expand Down
Loading

0 comments on commit a9a70d6

Please sign in to comment.