Skip to content

Commit

Permalink
Merge pull request openshift#249 from creydr/apply-security-context-c…
Browse files Browse the repository at this point in the history
…onstraints-on-reinstalling-operator-in-test

Bug 2023950: Fix operator e2e test for OCP
  • Loading branch information
openshift-merge-robot committed Jan 25, 2022
2 parents f6dbd23 + 7509eee commit a45e0fe
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
4 changes: 4 additions & 0 deletions cluster/sync-operator.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ function deploy_operator() {
$kubectl apply -f $MANIFESTS_DIR/role_binding.yaml
$kubectl apply -f deploy/crds/nmstate.io_nmstates.yaml
$kubectl apply -f $MANIFESTS_DIR/operator.yaml

if isOpenshift; then
$kubectl apply -f $MANIFESTS_DIR/scc.yaml
fi
}

function wait_ready_operator() {
Expand Down
2 changes: 0 additions & 2 deletions hack/ocp-e2e-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,6 @@ fi
while ! oc wait mcp --all --for=condition=Updated --timeout -1s; do sleep 1; done

make cluster-sync-operator
# Will fail on subsequent runs, this is fine.
oc create -f build/_output/manifests/scc.yaml || :
oc create -f test/e2e/nmstate.yaml
# On first deployment, it can take a while for all of the pods to come up
# First wait for the handler pods to be created
Expand Down
4 changes: 3 additions & 1 deletion test/e2e/operator/nmstate_install_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ var _ = Describe("NMState operator", func() {

func installOperator(operator operatorTestData) error {
By(fmt.Sprintf("Creating NMState operator with namespace '%s'", operator.ns))
_, err := cmd.Run("make", false, fmt.Sprintf("OPERATOR_NAMESPACE=%s", operator.ns), fmt.Sprintf("HANDLER_NAMESPACE=%s", operator.ns), "IMAGE_REGISTRY=registry:5000", "manifests")
_, err := cmd.Run("make", false, fmt.Sprintf("OPERATOR_NAMESPACE=%s", operator.ns), fmt.Sprintf("HANDLER_NAMESPACE=%s", operator.ns), "manifests")
Expect(err).ToNot(HaveOccurred())

manifestsDir := "build/_output/manifests/"
Expand All @@ -101,6 +101,8 @@ func installOperator(operator operatorTestData) error {
_, err = cmd.Kubectl("apply", "-f", manifestsDir+manifest)
Expect(err).ToNot(HaveOccurred())
}
cmd.Kubectl("apply", "-f", fmt.Sprintf("%s/scc.yaml", manifestsDir)) //ignore the error to be able to run the test against none OCP clusters as well

deployment.GetEventually(types.NamespacedName{Namespace: operator.ns, Name: "nmstate-operator"}).Should(deployment.BeReady())

return nil
Expand Down

0 comments on commit a45e0fe

Please sign in to comment.