Skip to content

Commit

Permalink
rresolve udpate namespace in comment
Browse files Browse the repository at this point in the history
  • Loading branch information
AlinsRan committed Aug 29, 2022
1 parent 5c28231 commit c94544c
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions test/e2e/suite-ingress/suite-ingress-features/namespace.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
package ingress

import (
"context"
"encoding/json"
"fmt"
"net/http"
Expand All @@ -24,6 +25,7 @@ import (
"github.com/gruntwork-io/terratest/modules/k8s"
ginkgo "github.com/onsi/ginkgo/v2"
"github.com/stretchr/testify/assert"
v1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"

"github.com/apache/apisix-ingress-controller/test/e2e/scaffold"
Expand Down Expand Up @@ -284,6 +286,8 @@ var _ = ginkgo.Describe("suite-ingress-features: namespacing un-label", func() {
namespace1 := fmt.Sprintf("un-label-%d", time.Now().Nanosecond())

ginkgo.It("un-label", func() {
client := s.GetKubernetesClient()

ns := fmt.Sprintf(`
apiVersion: v1
kind: Namespace
Expand Down Expand Up @@ -323,14 +327,16 @@ spec:
_ = s.NewAPISIXClient().GET("/ip").WithHeader("Host", "httpbin.com").Expect().Status(http.StatusOK).Body().Raw()

assert.Nil(ginkgo.GinkgoT(), s.DeleteResourceFromStringWithNamespace(route1, namespace1), "deleting ingress")
ns = fmt.Sprintf(`
apiVersion: v1
kind: Namespace
metadata:
name: %s
`, namespace1)
assert.Nil(ginkgo.GinkgoT(), s.CreateResourceFromString(ns), "creating namespace")
assert.Nil(ginkgo.GinkgoT(), err, "create httpbin service in", namespace1)
// un-label
_, err = client.CoreV1().Namespaces().Update(
context.Background(),
&v1.Namespace{ObjectMeta: metav1.ObjectMeta{
Name: namespace1,
Labels: map[string]string{},
}},
metav1.UpdateOptions{},
)
assert.Nil(ginkgo.GinkgoT(), err, "creating namespace")
time.Sleep(6 * time.Second)
routes, err := s.ListApisixRoutes()
assert.Nil(ginkgo.GinkgoT(), err)
Expand Down

0 comments on commit c94544c

Please sign in to comment.