Skip to content

Commit

Permalink
Merge pull request kubevirt#3797 from ormergi/testsuite_nad_cleanup
Browse files Browse the repository at this point in the history
sriov-lane: Fix AfterSuite namespaces deletion timeouts
  • Loading branch information
kubevirt-bot authored Aug 29, 2020
2 parents d9c0a48 + dcfd362 commit b23efb4
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 8 deletions.
11 changes: 9 additions & 2 deletions hack/cluster-deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -56,17 +56,24 @@ if [[ "$KUBEVIRT_STORAGE" == "rook-ceph" ]]; then
done
fi

# Remove cdi manifests for sriov-lane until kubevirt/kubevirt#3850 is fixed
if [[ "$KUBEVIRT_PROVIDER" =~ sriov.* ]]; then
rm -f ${MANIFESTS_OUT_DIR}/testing/cdi-*
fi

# Deploy infra for testing first
_kubectl create -f ${MANIFESTS_OUT_DIR}/testing

# Deploy CDI with operator.
_kubectl apply -f - <<EOF
# Do not deploy cdi-operator for sriov-lane until kubevirt/kubevirt#3850 is fixed
if [[ ! "$KUBEVIRT_PROVIDER" =~ sriov.* ]]; then
_kubectl apply -f - <<EOF
---
apiVersion: cdi.kubevirt.io/v1alpha1
kind: CDI
metadata:
name: cdi
EOF
fi

# Deploy kubevirt operator
_kubectl apply -f ${MANIFESTS_OUT_DIR}/release/kubevirt-operator.yaml
Expand Down
5 changes: 3 additions & 2 deletions tests/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -1694,8 +1694,9 @@ func removeNamespaces() {
fmt.Println("")
for _, namespace := range testNamespaces {
fmt.Printf("Waiting for namespace %s to be removed, this can take a while ...\n", namespace)
EventuallyWithOffset(1, func() bool { return errors.IsNotFound(virtCli.CoreV1().Namespaces().Delete(namespace, nil)) }, 240*time.Second, 1*time.Second).
Should(BeTrue())
EventuallyWithOffset(1, func() error {
return virtCli.CoreV1().Namespaces().Delete(namespace, nil)
}, 240*time.Second, 1*time.Second).Should(SatisfyAll(HaveOccurred(), WithTransform(errors.IsNotFound, BeTrue())), fmt.Sprintf("should successfuly delete namespace '%s'", namespace))
}
}

Expand Down
7 changes: 3 additions & 4 deletions tests/vmi_multus_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ const (
postUrl = "/apis/k8s.cni.cncf.io/v1/namespaces/%s/network-attachment-definitions/%s"
linuxBridgeConfCRD = `{"apiVersion":"k8s.cni.cncf.io/v1","kind":"NetworkAttachmentDefinition","metadata":{"name":"%s","namespace":"%s"},"spec":{"config":"{ \"cniVersion\": \"0.3.1\", \"name\": \"mynet\", \"plugins\": [{\"type\": \"bridge\", \"bridge\": \"br10\", \"vlan\": 100, \"ipam\": {}},{\"type\": \"tuning\"}]}"}}`
ptpConfCRD = `{"apiVersion":"k8s.cni.cncf.io/v1","kind":"NetworkAttachmentDefinition","metadata":{"name":"%s","namespace":"%s"},"spec":{"config":"{ \"cniVersion\": \"0.3.1\", \"name\": \"mynet\", \"plugins\": [{\"type\": \"ptp\", \"ipam\": { \"type\": \"host-local\", \"subnet\": \"10.1.1.0/24\" }},{\"type\": \"tuning\"}]}"}}`
sriovConfCRD = `{"apiVersion":"k8s.cni.cncf.io/v1","kind":"NetworkAttachmentDefinition","metadata":{"name":"%s","namespace":"%s","annotations":{"k8s.v1.cni.cncf.io/resourceName":"%s"}},"spec":{"config":"{ \"name\": \"sriov\", \"type\": \"sriov\", \"ipam\": { \"type\": \"host-local\", \"subnet\": \"10.1.1.0/24\" } }"}}`
sriovLinkEnableConfCRD = `{"apiVersion":"k8s.cni.cncf.io/v1","kind":"NetworkAttachmentDefinition","metadata":{"name":"%s","namespace":"%s","annotations":{"k8s.v1.cni.cncf.io/resourceName":"%s"}},"spec":{"config":"{ \"name\": \"sriov\", \"type\": \"sriov\", \"link_state\": \"enable\", \"ipam\": { \"type\": \"host-local\", \"subnet\": \"10.1.1.0/24\" } }"}}`
sriovConfCRD = `{"apiVersion":"k8s.cni.cncf.io/v1","kind":"NetworkAttachmentDefinition","metadata":{"name":"%s","namespace":"%s","annotations":{"k8s.v1.cni.cncf.io/resourceName":"%s"}},"spec":{"config":"{ \"cniVersion\": \"0.3.1\", \"name\": \"sriov\", \"type\": \"sriov\", \"ipam\": { \"type\": \"host-local\", \"subnet\": \"10.1.1.0/24\" } }"}}`
sriovLinkEnableConfCRD = `{"apiVersion":"k8s.cni.cncf.io/v1","kind":"NetworkAttachmentDefinition","metadata":{"name":"%s","namespace":"%s","annotations":{"k8s.v1.cni.cncf.io/resourceName":"%s"}},"spec":{"config":"{ \"cniVersion\": \"0.3.1\", \"name\": \"sriov\", \"type\": \"sriov\", \"link_state\": \"enable\", \"ipam\": { \"type\": \"host-local\", \"subnet\": \"10.1.1.0/24\" } }"}}`
)

var _ = Describe("Multus", func() {
Expand Down Expand Up @@ -920,10 +920,9 @@ func checkMacAddress(vmi *v1.VirtualMachineInstance, interfaceName, macAddress s
cmdCheck := fmt.Sprintf("ip link show %s\n", interfaceName)
err := tests.CheckForTextExpecter(vmi, []expect.Batcher{
&expect.BSnd{S: "\n"},
&expect.BExp{R: "#"},
&expect.BExp{R: tests.PromptExpression},
&expect.BSnd{S: cmdCheck},
&expect.BExp{R: macAddress},
&expect.BExp{R: "#"},
&expect.BSnd{S: "echo $?\n"},
&expect.BExp{R: tests.RetValue("0")},
}, 15)
Expand Down

0 comments on commit b23efb4

Please sign in to comment.