Skip to content

Commit

Permalink
Merge pull request #115 from slintes/test-openshift-ci
Browse files Browse the repository at this point in the history
Fix e2e test
  • Loading branch information
kubevirt-bot committed Aug 18, 2020
2 parents eaaf9d0 + 7a86b4d commit 9142a03
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 7 deletions.
3 changes: 1 addition & 2 deletions hack/functest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,9 @@ else
# so we create a fake etcd-quorum-guard PDB with maxUnavailable = 0, which will always result in disruptionsAllowed = 0 without a corresponding deployment
# that will make node maintenance requests for master nodes always fail
$CLUSTER_COMMAND apply -f test/manifests/fake-etcd-quorum-guard.yaml
OPERATOR_NS=node-maintenance
fi

OPERATOR_NS=node-maintenance

fi

# Run tests
Expand Down
4 changes: 4 additions & 0 deletions hack/sync-deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,10 @@ until [[ $success -eq 1 ]] || [[ $iterations -eq $max_iterations ]]; do
else
# All resources deployed successfully
success=1
# Fixme Webhook setup is slow... service needs to be created, endpoint needs to be created, and webhook server must be running
# Didn't find an easy but good solution yet, so just wait a bit for now
echo "[INFO] Giving the webhook some time to setup"
sleep 30s
fi
set -e

Expand Down
14 changes: 9 additions & 5 deletions test/e2e/nodemaintenance_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ func getCurrentOperatorPods() (*corev1.Pod, error) {
return nil, err
}

if pods.Size() == 0 {
return nil, fmt.Errorf("There are no pods deployed in cluster to run the operator")
if len(pods.Items) == 0 {
return nil, fmt.Errorf("no NMO pod found in ns %s", ns)
}

return &pods.Items[0], nil
Expand Down Expand Up @@ -88,8 +88,8 @@ func showDeploymentStatus(t *testing.T, callerError error) {

func checkValidLease(t *testing.T, nodeName string) error {

// FIXME this won't work: nmo.LeaseNamespace is overwritten by the operator during runtime, and we will never see that here...
nName := types.NamespacedName{Namespace: nmo.LeaseNamespace, Name: nodeName}
ns := os.Getenv("OPERATOR_NS")
nName := types.NamespacedName{Namespace: ns, Name: nodeName}
lease := &coordv1beta1.Lease{}
err := Client.Get(context.TODO(), nName, lease)
if err != nil {
Expand Down Expand Up @@ -122,7 +122,8 @@ func checkValidLease(t *testing.T, nodeName string) error {
}

func checkInvalidLease(t *testing.T, nodeName string) error {
nName := types.NamespacedName{Namespace: nmo.LeaseNamespace, Name: nodeName}
ns := os.Getenv("OPERATOR_NS")
nName := types.NamespacedName{Namespace: ns, Name: nodeName}
lease := &coordv1beta1.Lease{}
err := Client.Get(context.TODO(), nName, lease)
if err != nil {
Expand Down Expand Up @@ -234,7 +235,10 @@ func enterAndExitMaintenanceMode(t *testing.T) error {
}
} else {
t.Fatalf("unexpexted nr of master nodes, can't run master quorum validation test")
break
}
// the etcd-quorum-guard PDB needs some time to be updated...
time.Sleep(10 * time.Second)
}

err = createSimpleDeployment(t, namespace)
Expand Down

0 comments on commit 9142a03

Please sign in to comment.