Skip to content

Commit

Permalink
Fix stability issues at e2e tests (#191)
Browse files Browse the repository at this point in the history
- Increase golang test timeout to 40m, we have a lot of Eventuallies now and we
  don't want a panic message.
- Mark as "pending" the default bridge network test, we need more time
  to debug why node is not going back to live at stdci + kubevirtci
- Make Client.Get for nodes honor Eventually timeout and interval values.

Signed-off-by: Quique Llorente <[email protected]>
  • Loading branch information
qinqon authored and phoracek committed Sep 30, 2019
1 parent 3cdda76 commit 56c71e1
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ ifdef UNIT_TEST_EXTRA_ARGS
UNIT_TEST_ARGS += $(UNIT_TEST_ARGS)
endif

E2E_TEST_ARGS ?= -test.v -test.timeout=20m -ginkgo.v -ginkgo.slowSpecThreshold=60
E2E_TEST_ARGS ?= -test.v -test.timeout=40m -ginkgo.v -ginkgo.slowSpecThreshold=60
ifdef E2E_TEST_FOCUS
E2E_TEST_ARGS += -ginkgo.focus $(E2E_TEST_FOCUS)
endif
Expand Down
15 changes: 11 additions & 4 deletions test/e2e/default_bridged_network_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ import (
nmstatev1alpha1 "github.com/nmstate/kubernetes-nmstate/pkg/apis/nmstate/v1alpha1"
)

var _ = Describe("NodeNetworkConfigurationPolicy default bridged network", func() {
// FIXME: We have to fix this test https://github.com/nmstate/kubernetes-nmstate/issues/192
var _ = PDescribe("NodeNetworkConfigurationPolicy default bridged network", func() {
createBridgeOnTheDefaultInterface := nmstatev1alpha1.State(`interfaces:
- name: brext
type: linux-bridge
Expand Down Expand Up @@ -142,7 +143,13 @@ func dhcpFlag(node string, name string) bool {
func nodeReadyConditionStatus(nodeName string) (corev1.ConditionStatus, error) {
key := types.NamespacedName{Name: nodeName}
node := corev1.Node{}
err := framework.Global.Client.Get(context.TODO(), key, &node)
// We use a special context here to ensure that Client.Get does not
// get stuck and honor the Eventually timeout and interval values.
// It will return a timeout error in case of .Get takes more time than
// expected so Eventually will retry after expected interval value.
oneSecondTimeoutCtx, cancel := context.WithTimeout(context.Background(), 1*time.Second)
defer cancel()
err := framework.Global.Client.Get(oneSecondTimeoutCtx, key, &node)
if err != nil {
return "", err
}
Expand All @@ -157,8 +164,8 @@ func nodeReadyConditionStatus(nodeName string) (corev1.ConditionStatus, error) {
func waitForNodesReady() {
time.Sleep(5 * time.Second)
for _, node := range nodes {
Eventually(func() (corev1.ConditionStatus, error) {
EventuallyWithOffset(1, func() (corev1.ConditionStatus, error) {
return nodeReadyConditionStatus(node)
}, 60*time.Second, 1*time.Second).Should(Equal(corev1.ConditionTrue))
}, 5*time.Minute, 10*time.Second).Should(Equal(corev1.ConditionTrue))
}
}
2 changes: 1 addition & 1 deletion test/e2e/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,7 @@ func vlansCardinality(node string, connection string) AsyncAssertion {
func bridgeDescription(node string, bridgeName string) AsyncAssertion {
return Eventually(func() (string, error) {
return run(node, "sudo", "ip", "-d", "link", "show", "type", "bridge", bridgeName)
}, ReadTimeout, ReadTimeout)
}, ReadTimeout, ReadInterval)
}

func conditionsToYaml(conditions []nmstatev1alpha1.NodeNetworkStateCondition) string {
Expand Down

0 comments on commit 56c71e1

Please sign in to comment.