Skip to content

Commit

Permalink
fix: confirm that the SpiderSubnet AutoPool feature is really disabled
Browse files Browse the repository at this point in the history
Signed-off-by: ty-dc <[email protected]>
  • Loading branch information
ty-dc committed Apr 23, 2024
1 parent e39097a commit 6d74809
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
29 changes: 29 additions & 0 deletions test/e2e/subnet/subnet_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2018,9 +2018,38 @@ var _ = Describe("test subnet", Label("subnet"), func() {
configmap.Data[configYamlStr] = string(marshal)
err = frame.KClient.Update(context.TODO(), configmap)
Expect(err).NotTo(HaveOccurred())
GinkgoWriter.Printf("succeeded to update ConfigMap spiderpool-conf EnableAutoPoolForApplication to be false")

Eventually(func() bool {
var newCmConfig types.SpiderpoolConfigmapConfig
configmap, err := frame.GetConfigmap(common.SpiderPoolConfigmapName, common.SpiderPoolConfigmapNameSpace)
GinkgoWriter.Printf("debug %v \n", configmap)
if err != nil {
return false
}
configStr, ok := configmap.Data[configYamlStr]
if !ok {
return false
}
err = yaml.Unmarshal([]byte(configStr), &newCmConfig)
if err != nil {
return false
}
GinkgoWriter.Println("newCmConfig.EnableAutoPoolForApplication:", newCmConfig.EnableAutoPoolForApplication)
if newCmConfig.EnableAutoPoolForApplication != false {
GinkgoWriter.Printf("enableAutoPoolForApplication is not false, but %v ,waiting...\n", newCmConfig.EnableAutoPoolForApplication)
return false
}
return true
}, common.ResourceDeleteTimeout, common.ForcedWaitingTime).Should(BeTrue())
}

DeferCleanup(func() {
if CurrentSpecReport().Failed() {
GinkgoWriter.Println("If the use case fails, the cleanup step will be skipped")
return
}

// change the configmap 'enableAutoPoolForApplication' back to be 'true'
configmap, err := frame.GetConfigmap(common.SpiderPoolConfigmapName, common.SpiderPoolConfigmapNameSpace)
Expect(err).NotTo(HaveOccurred())
Expand Down
4 changes: 4 additions & 0 deletions test/scripts/debugEnv.sh
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,10 @@ elif [ "$TYPE"x == "detail"x ] ; then
echo "--------- kubectl get network-attachment-definitions.k8s.cni.cncf.io -A -o json"
kubectl get network-attachment-definitions.k8s.cni.cncf.io -o json --kubeconfig ${E2E_KUBECONFIG}

echo ""
echo "--------- kubectl get configmaps -n kube-system spiderpool-conf -ojson"
kubectl get configmaps -n kube-system spiderpool-conf -ojson --kubeconfig ${E2E_KUBECONFIG}

echo ""
echo "=============== IPAM log ============== "
KIND_CLUSTER_NAME=${KIND_CLUSTER_NAME:-"spider"}
Expand Down

0 comments on commit 6d74809

Please sign in to comment.