From 403866dcc2fbca9d1a513554f33812eeedea03f6 Mon Sep 17 00:00:00 2001 From: p53 Date: Sat, 8 Jan 2022 13:29:09 +0100 Subject: [PATCH] Fix Duration options, not taken by env var #135 (#134) * Add E2E tests also to pull requests * Fix Duration options, not taken by env var --- .github/workflows/build.yml | 11 +++++++++++ cli.go | 7 ++++--- e2e_test.go | 2 ++ 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 01049769..f995da6a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -24,6 +24,17 @@ jobs: # Verify downloaded dependencies - name: Verify dependencies run: go mod verify + - name: "Create k3d Cluster for E2E testing" + uses: AbsaOSS/k3d-action@v1.5.0 + with: + cluster-name: "testcluster" + args: >- + -p "8081:80@loadbalancer" + - name: "Run E2E tests" + run: | + k3d kubeconfig merge testcluster --kubeconfig-switch-context + KUBECONFIG=~/.k3d/kubeconfig-testcluster.yaml kubectl apply -f ./e2e/k8s/manifest.yml + go test -v --tags=e2e # Run tests and generates a coverage profile - name: Test run: | diff --git a/cli.go b/cli.go index 1142be47..cf87b7a3 100644 --- a/cli.go +++ b/cli.go @@ -141,9 +141,10 @@ func getCommandLineOptions() []cli.Flag { case durationType: dv := reflect.ValueOf(defaults).Elem().FieldByName(field.Name).Int() flags = append(flags, cli.DurationFlag{ - Name: optName, - Usage: usage, - Value: time.Duration(dv), + Name: optName, + Usage: usage, + Value: time.Duration(dv), + EnvVar: envName, }) default: panic("unknown uint64 type in the Config struct") diff --git a/e2e_test.go b/e2e_test.go index 60c8f3ca..3b7b8e86 100644 --- a/e2e_test.go +++ b/e2e_test.go @@ -57,6 +57,8 @@ func TestMain(m *testing.M) { os.Exit(1) } + time.Sleep(30 * time.Second) + code := m.Run() os.Exit(code) }