This is an automated email from the ASF dual-hosted git repository.
zhangjintao pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/apisix-ingress-controller.git
The following commit(s) were added to refs/heads/master by this push:
new c871bdf test: dump the namespace content when e2e test cases failed
(#571)
c871bdf is described below
commit c871bdfb76fee37227d7de5a246cd94b867aad1d
Author: Alex Zhang <[email protected]>
AuthorDate: Mon Jul 5 20:22:50 2021 +0800
test: dump the namespace content when e2e test cases failed (#571)
* chore: fix the count field type in apisix client
* fix: show k8s nodes
* change: kind version
---
.github/workflows/e2e-test-ci.yml | 6 +++++-
test/e2e/scaffold/k8s.go | 4 ++--
test/e2e/scaffold/scaffold.go | 13 +++++++++++++
3 files changed, 20 insertions(+), 3 deletions(-)
diff --git a/.github/workflows/e2e-test-ci.yml
b/.github/workflows/e2e-test-ci.yml
index a05bc85..4cc767c 100644
--- a/.github/workflows/e2e-test-ci.yml
+++ b/.github/workflows/e2e-test-ci.yml
@@ -73,7 +73,7 @@ jobs:
submodules: recursive
- name: Install kind
run: |
- curl -Lo ./kind https://kind.sigs.k8s.io/dl/v0.10.0/kind-linux-amd64
+ curl -Lo ./kind https://kind.sigs.k8s.io/dl/v0.11.1/kind-linux-amd64
chmod +x ./kind
sudo mv kind /usr/local/bin
- name: Setup Go Env
@@ -84,6 +84,10 @@ jobs:
run: |
go get -u github.com/onsi/ginkgo/ginkgo
sudo cp ~/go/bin/ginkgo /usr/local/bin
+ - name: Create K8s cluster
+ run: |
+ make kind-up
+ kubectl wait --for=condition=Ready nodes --all
- name: Run e2e test cases
working-directory: ./
run: |
diff --git a/test/e2e/scaffold/k8s.go b/test/e2e/scaffold/k8s.go
index 40e6c76..4517bda 100644
--- a/test/e2e/scaffold/k8s.go
+++ b/test/e2e/scaffold/k8s.go
@@ -150,12 +150,12 @@ func (s *Scaffold) ensureNumApisixCRDsCreated(url string,
desired int) error {
ginkgo.GinkgoT().Logf("got status code %d from APISIX",
resp.StatusCode)
return false, nil
}
- c := &counter{}
+ var c counter
b, err := ioutil.ReadAll(resp.Body)
if err != nil {
return false, err
}
- err = json.Unmarshal(b, c)
+ err = json.Unmarshal(b, &c)
if err != nil {
return false, err
}
diff --git a/test/e2e/scaffold/scaffold.go b/test/e2e/scaffold/scaffold.go
index 2e0998c..a1c8dd2 100644
--- a/test/e2e/scaffold/scaffold.go
+++ b/test/e2e/scaffold/scaffold.go
@@ -299,6 +299,19 @@ func (s *Scaffold) beforeEach() {
func (s *Scaffold) afterEach() {
defer ginkgo.GinkgoRecover()
+
+ if ginkgo.CurrentGinkgoTestDescription().Failed {
+ fmt.Fprintln(ginkgo.GinkgoWriter, "Dumping namespace contents")
+ output, _ := k8s.RunKubectlAndGetOutputE(ginkgo.GinkgoT(),
s.kubectlOptions, "get", "deploy,sts,svc,pods")
+ if output != "" {
+ fmt.Fprintln(ginkgo.GinkgoWriter, output)
+ }
+ output, _ = k8s.RunKubectlAndGetOutputE(ginkgo.GinkgoT(),
s.kubectlOptions, "describe", "pods")
+ if output != "" {
+ fmt.Fprintln(ginkgo.GinkgoWriter, output)
+ }
+ }
+
err := k8s.DeleteNamespaceE(s.t, s.kubectlOptions, s.namespace)
assert.Nilf(ginkgo.GinkgoT(), err, "deleting namespace %s", s.namespace)