Skip to content
This repository was archived by the owner on Nov 9, 2022. It is now read-only.
This repository is currently being migrated. It's locked while the migration is in progress.

Commit 6f84771

Browse files
committed
e2e: Run operator locally with go run
This runs the e2e operator-sdk tests (non-OLM) with go run, instead of running as a container. Container image is built only for OLM bases test setup. Also, uses the new kind load command to upload the container image from host to a KinD environment.
1 parent 3799b11 commit 6f84771

File tree

2 files changed

+14
-31
lines changed

2 files changed

+14
-31
lines changed

test/e2e.sh

Lines changed: 14 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -227,23 +227,18 @@ main() {
227227

228228
NODE_NAME=$(kubectl get nodes --no-headers=true -o=name)
229229

230-
# Build the operator container image.
231-
# This would build a container with tag storageos/cluster-operator:test,
232-
# which is used in the e2e test setup below.
233-
make image/cluster-operator
234-
235-
# Move the operator container inside Kind container so that the image is
236-
# available to the docker in docker environment.
237-
if [ "$1" = "kind" ]; then
238-
x=$(docker ps -f name=kind-1-control-plane -q)
239-
docker save storageos/cluster-operator:test > cluster-operator.tar
240-
docker cp cluster-operator.tar $x:/cluster-operator.tar
241-
242-
# containerd load image from tar archive (KinD with containerd).
243-
docker exec $x bash -c "ctr -n k8s.io images import --base-name docker.io/storageos/cluster-operator:test /cluster-operator.tar"
244-
fi
245-
246230
if [ "$2" = "olm" ]; then
231+
# Build the operator container image.
232+
# This would build a container with tag storageos/cluster-operator:test,
233+
# which is used in the e2e test setup below.
234+
make image/cluster-operator
235+
236+
# Move the operator container inside Kind container so that the image is
237+
# available to the docker in docker environment.
238+
if [ "$1" = "kind" ]; then
239+
kind load docker-image storageos/cluster-operator:test
240+
fi
241+
247242
# Lint the OLM CSV bundle.
248243
make olm-lint
249244

@@ -294,13 +289,13 @@ main() {
294289
# NOTE: Append this test command with `|| true` to debug by inspecting the
295290
# resource details. Also comment `defer ctx.Cleanup()` in the cluster to
296291
# avoid resouce cleanup.
297-
operator-sdk test local ./test/e2e --go-test-flags "-v -tags csi" --namespace storageos-operator
292+
operator-sdk test local ./test/e2e --up-local --go-test-flags "-v -tags csi" --namespace storageos-operator
298293
operator-sdk-e2e-cleanup
299294

300-
operator-sdk test local ./test/e2e --go-test-flags "-v -tags csideployment" --namespace storageos-operator
295+
operator-sdk test local ./test/e2e --up-local --go-test-flags "-v -tags csideployment" --namespace storageos-operator
301296
operator-sdk-e2e-cleanup
302297

303-
operator-sdk test local ./test/e2e --go-test-flags "-v -tags intree" --namespace storageos-operator
298+
operator-sdk test local ./test/e2e --up-local --go-test-flags "-v -tags intree" --namespace storageos-operator
304299
operator-sdk-e2e-cleanup
305300

306301
# echo "**** Resource details for storageos-operator namespace ****"

test/e2e/util/cluster.go

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -68,18 +68,6 @@ func SetupOperator(t *testing.T, ctx *framework.TestCtx) {
6868
t.Fatalf("failed to initialize cluster resources: %v", err)
6969
}
7070
t.Log("Initialized cluster resources")
71-
72-
namespace, err := ctx.GetNamespace()
73-
if err != nil {
74-
t.Fatal(err)
75-
}
76-
77-
f := framework.Global
78-
79-
err = e2eutil.WaitForDeployment(t, f.KubeClient, namespace, "storageos-cluster-operator", 1, RetryInterval, Timeout)
80-
if err != nil {
81-
t.Fatal(err)
82-
}
8371
}
8472

8573
// ClusterStatusCheck checks the values of cluster status based on a given

0 commit comments

Comments
 (0)