From e481a4ff5f04a4f4ddc64268c7b12ff6ef13510f Mon Sep 17 00:00:00 2001 From: Dario Tranchitella Date: Fri, 21 Aug 2020 22:45:19 +0200 Subject: [PATCH] Implementing e2e during CI (#62) --- .github/workflows/{lint.yml => main.yml} | 28 +++++++++++++++++++++++- e2e/ingress_class_test.go | 11 +++++----- 2 files changed, 33 insertions(+), 6 deletions(-) rename .github/workflows/{lint.yml => main.yml} (54%) diff --git a/.github/workflows/lint.yml b/.github/workflows/main.yml similarity index 54% rename from .github/workflows/lint.yml rename to .github/workflows/main.yml index b12ee539..e813fde3 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/main.yml @@ -18,7 +18,6 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - - name: Run golangci-lint uses: golangci/golangci-lint-action@v2.2.0 with: @@ -27,3 +26,30 @@ jobs: # if set to true and the action runs on a pull request - the action outputs only newly found issues only-new-issues: false args: --timeout 2m + kind: + name: e2e + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@master + # Cache Go modules + - name: Cache Go Modules + uses: actions/cache@v1 + env: + cache-name: cache-go-modules + with: + path: ~/go/pkg/mod + key: ${{ runner.os }}-build-${{ env.cache-name }} + restore-keys: | + ${{ runner.os }}-build- + ${{ runner.os }}- + # Installing Ginkgo + - name: installing Ginkgo + run: go get github.com/onsi/ginkgo/ginkgo + - uses: actions/setup-go@v2 + with: + go-version: '^1.13.8' + - uses: engineerd/setup-kind@v0.4.0 + with: + skipClusterCreation: true + - name: e2e testing + run: make e2e diff --git a/e2e/ingress_class_test.go b/e2e/ingress_class_test.go index f5d2ae34..34c8922b 100644 --- a/e2e/ingress_class_test.go +++ b/e2e/ingress_class_test.go @@ -20,7 +20,6 @@ package e2e import ( "context" - "time" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" @@ -82,7 +81,7 @@ var _ = Describe("when Tenant handles Ingress classes", func() { } _, err = cs.ExtensionsV1beta1().Ingresses(ns.GetName()).Create(context.TODO(), i, metav1.CreateOptions{}) return - }, 30*time.Second, time.Second).ShouldNot(Succeed()) + }, defaultTimeoutInterval, defaultPollInterval).ShouldNot(Succeed()) }) By("specifying a forbidden class", func() { Eventually(func() (err error) { @@ -100,7 +99,7 @@ var _ = Describe("when Tenant handles Ingress classes", func() { } _, err = cs.ExtensionsV1beta1().Ingresses(ns.GetName()).Create(context.TODO(), i, metav1.CreateOptions{}) return - }, 30*time.Second, time.Second).ShouldNot(Succeed()) + }, defaultTimeoutInterval, defaultPollInterval).ShouldNot(Succeed()) }) }) It("should allow enabled Ingress class", func() { @@ -116,9 +115,11 @@ var _ = Describe("when Tenant handles Ingress classes", func() { i := &v1beta12.Ingress{ ObjectMeta: metav1.ObjectMeta{ Name: c, + Annotations: map[string]string{ + "kubernetes.io/ingress.class": c, + }, }, Spec: v1beta12.IngressSpec{ - IngressClassName: pointer.StringPtr(c), Backend: &v1beta12.IngressBackend{ ServiceName: "foo", ServicePort: intstr.FromInt(8080), @@ -127,7 +128,7 @@ var _ = Describe("when Tenant handles Ingress classes", func() { } _, err = cs.ExtensionsV1beta1().Ingresses(ns.GetName()).Create(context.TODO(), i, metav1.CreateOptions{}) return - }, 30*time.Second, time.Second).Should(Succeed()) + }, defaultTimeoutInterval, defaultPollInterval).Should(Succeed()) } }) })