@@ -2,6 +2,9 @@ NAMESPACE=cozy-e2e-tests
22NAME := sandbox
33CLEAN := 1
44TESTING_APPS := $(shell find ../../apps -maxdepth 1 -mindepth 1 -type d | awk -F/ '{print $$NF}')
5+ SANDBOX_NAME := cozy-e2e-sandbox
6+
7+ ROOT_DIR = $(dir $(abspath $(firstword $(MAKEFILE_LIST ) ) /../../..) )
58
69include ../../../scripts/common-envs.mk
710
@@ -34,27 +37,20 @@ image-e2e-sandbox:
3437 yq -i ' .e2e.image = strenv(IMAGE)' values.yaml
3538 rm -f images/e2e-sandbox.json
3639
37- copy-hack-dir :
38- tar -C ../../../ -cf- hack | kubectl exec -i -n $(NAMESPACE ) deploy/cozystack-e2e-$(NAME ) -- tar -xf-
39-
40- copy-image :
41- cat ../../../_out/assets/nocloud-amd64.raw.xz | kubectl exec -i -n $(NAMESPACE ) deploy/cozystack-e2e-$(NAME ) -- sh -xec ' xz --decompress > /nocloud-amd64.raw'
42-
43- test : wait-for-sandbox copy-hack-dir copy-image # # Run the end-to-end tests in existing sandbox.
44- helm template -n cozy-system installer ../installer | kubectl exec -i -n $(NAMESPACE ) deploy/cozystack-e2e-$(NAME ) -- sh -c ' cat > /cozystack-installer.yaml'
45- kubectl exec -ti -n $(NAMESPACE ) deploy/cozystack-e2e-$(NAME ) -- sh -c ' export COZYSTACK_INSTALLER_YAML=$$(cat /cozystack-installer.yaml) && /hack/e2e.sh'
40+ test : # # Run the end-to-end tests in existing sandbox.
41+ docker exec " ${SANDBOX_NAME} " sh -c ' cd /workspace && export COZYSTACK_INSTALLER_YAML=$$(helm template -n cozy-system installer ./packages/core/installer) && hack/e2e.sh'
4642
47- test-applications : wait-for-sandbox copy-hack-dir # # Run the end-to-end tests in existing sandbox for applications.
43+ test-applications : # # Run the end-to-end tests in existing sandbox for applications.
4844 for app in $( TESTING_APPS) ; do \
49- kubectl exec -ti -n cozy-e2e-tests deploy/cozystack-e2e-sandbox -- bash -c " /hack/e2e.application.sh $$ {app}" ; \
45+ docker exec ${SANDBOX_NAME} bash -c " /hack/e2e.application.sh $$ {app}" ; \
5046 done
51- kubectl exec -ti -n cozy-e2e-tests deploy/cozystack-e2e-sandbox -- bash -c " kubectl get hr -A | grep -v 'True'"
47+ docker exec ${SANDBOX_NAME} bash -c " kubectl get hr -A | grep -v 'True'"
5248
5349delete : # # Remove sandbox from existing Kubernetes cluster.
54- kubectl delete deploy -n $( NAMESPACE ) cozystack-e2e- $( NAME )
50+ docker rm -f " ${SANDBOX_NAME} " || true
5551
5652exec : # # Opens an interactive shell in the sandbox container.
57- kubectl exec -ti -n $( NAMESPACE ) deploy/cozystack-e2e- $( NAME ) -- bash
53+ docker exec -ti " ${SANDBOX_NAME} " -- bash
5854
5955proxy : sync-hosts # # Enable a SOCKS5 proxy server; mirrord and gost must be installed.
6056 mirrord exec --target deploy/cozystack-e2e-sandbox --target-namespace cozy-e2e-tests -- gost -L=127.0.0.1:10080
@@ -65,6 +61,6 @@ login: ## Downloads the kubeconfig into a temporary directory and runs a shell w
6561sync-hosts :
6662 kubectl exec -n $(NAMESPACE ) deploy/cozystack-e2e-$(NAME ) -- sh -c ' kubectl get ing -A -o go-template=' \' ' {{ "127.0.0.1 localhost\n"}}{{ range .items }}{{ range .status.loadBalancer.ingress }}{{ .ip }}{{ end }} {{ range .spec.rules }}{{ .host }}{{ end }}{{ "\n" }}{{ end }}' \' ' > /etc/hosts'
6763
68- wait-for-sandbox :
69- kubectl wait deploy --for=condition=Progressing -n $( NAMESPACE ) cozystack- e2e-$( NAME )
70- kubectl wait pod --for=condition=Ready -n $( NAMESPACE ) -l app=cozystack-e2e- $( NAME )
64+ apply : delete
65+ docker run -d --rm --name " ${SANDBOX_NAME} " --privileged ghcr.io/cozystack/cozystack/ e2e-sandbox:latest@sha256:f41b1e0f76e7820ce87cd3dfa1b680490d0c898105690c79537943f26ab28040 sleep infinity
66+ docker cp " ${ROOT_DIR} " " ${SANDBOX_NAME} " :/workspace
0 commit comments