@@ -8,52 +8,9 @@ POOL_FILES = $(shell find cache-entry)
88
99TEST_CLUSTER =testing/test-cluster
1010KILL_WORKER =./bin/admin kill -cluster=$(TEST_CLUSTER ) ;rm -rf $(TEST_CLUSTER ) /workers/*
11- RUN_LAMBDA =curl -XPOST localhost:8080/runLambda
12-
13- STARTUP_PKGS ='{"startup_pkgs": ["parso", "jedi", "urllib3", "idna", "chardet", "certifi", "requests", "simplejson"]}'
14- REGISTRY_DIR ='{"registry_dir": "$(abspath testing/registry) "}'
15-
16- SOCK_NOCACHE ='{"sandbox": "sock", "handler_cache_size": 0, "import_cache_size": 0, "cg_pool_size": 10}'
17- SOCK_HANDLER ='{"sandbox": "sock", "handler_cache_size": 10000000, "import_cache_size": 0, "cg_pool_size": 10}'
18- SOCK_IMPORT ='{"sandbox": "sock", "handler_cache_size": 0, "import_cache_size": 10000000, "cg_pool_size": 10}'
19- SOCK_BOTH ='{"sandbox": "sock", "handler_cache_size": 10000000, "import_cache_size": 10000000, "cg_pool_size": 10}'
20-
21- DOCKER_NOCACHE ='{"sandbox": "docker", "handler_cache_size": 0, "import_cache_size": 0, "cg_pool_size": 0}'
22- DOCKER_HANDLER ='{"sandbox": "docker", "handler_cache_size": 10000000, "import_cache_size": 0, "cg_pool_size": 0}'
23- DOCKER_IMPORT ='{"sandbox": "docker", "handler_cache_size": 0, "import_cache_size": 10000000, "cg_pool_size": 0}'
24- DOCKER_BOTH ='{"sandbox": "docker", "handler_cache_size": 10000000, "import_cache_size": 10000000, "cg_pool_size": 0}'
25-
26- WORKER_TIMEOUT =60
27-
28- define RUN_TEST=
29- @echo "Killing worker if running..."
30- -$(KILL_WORKER )
31- @echo
32- @echo "Starting worker..."
33- ./bin/admin setconf -cluster=$(TEST_CLUSTER ) CONDITION
34- ./bin/admin workers -cluster=$(TEST_CLUSTER )
35- @echo
36- @echo "Waiting for worker to initialize..."
37- @for i in $$(seq 1 $(WORKER_TIMEOUT ) ) ; \
38- do \
39- [ $$i -gt 1 ] && sleep 2; \
40- ./bin/admin status -cluster=$(TEST_CLUSTER ) 1>/dev/null && s=0 && break || s=$$? ; \
41- done; ([ $$s -eq 0 ] || (echo "Worker failed to initialize after $(WORKER_TIMEOUT ) s" && exit 1))
42- @echo "Worker ready. Requesting lambdas..."
43- $(RUN_LAMBDA ) /echo -d '{}'
44- @echo
45- $(RUN_LAMBDA ) /install -d '{}'
46- @echo
47- $(RUN_LAMBDA ) /install2 -d '{}'
48- @echo
49- $(RUN_LAMBDA ) /install3 -d '{}'
50- @echo
51- @echo
52- endef
5311
5412GO = $(abspath ./hack/go.sh)
5513GO_PATH = hack/go
56- WORKER_DIR = $(GO_PATH ) /src/github.com/open-lambda/open-lambda/worker
5714ADMIN_DIR = $(GO_PATH ) /src/github.com/open-lambda/open-lambda/worker/admin
5815
5916LAMBDA_DIR = $(abspath ./lambda)
@@ -80,21 +37,15 @@ bin/admin: $(WORKER_GO_FILES)
8037
8138.PHONY : test-all test-sock-all test-docker-all test-cluster
8239
83- test-all : test-sock-all test-docker-all
84-
85- test-sock-all : test-sock-nocache test-sock-handler test-sock-import test-sock-both
40+ test-all : bin/admin imgs/lambda
41+ python -m unittest discover testing/integration-tests/ -p " *_test.py"
8642
87- test-docker-all : test-docker-nocache test-docker-handler
43+ test-sock-all : bin/admin imgs/lambda
44+ python testing/integration-tests/sock_test.py
8845
89- test-cluster : imgs/test-cluster
46+ test-docker-all : bin/admin imgs/lambda
47+ python testing/integration-tests/docker_test.py
9048
91- imgs/test-cluster :
92- @echo " Starting test cluster..."
93- ./bin/admin new -cluster=$(TEST_CLUSTER )
94- ./bin/admin setconf -cluster=$(TEST_CLUSTER ) $(REGISTRY_DIR )
95- ./bin/admin setconf -cluster=$(TEST_CLUSTER ) $(STARTUP_PKGS )
96- @echo
97- touch imgs/test-cluster
9849
9950clean-test :
10051 @echo " Killing worker if running..."
@@ -104,30 +55,6 @@ clean-test:
10455 rm -rf $(TEST_CLUSTER ) imgs/test-cluster
10556 @echo
10657
107- test-sock-nocache : bin/admin imgs/lambda test-cluster
108- $(subst CONDITION, $(SOCK_NOCACHE ) , $(RUN_TEST ) )
109-
110- test-sock-handler : bin/admin imgs/lambda test-cluster
111- $(subst CONDITION, $(SOCK_HANDLER ) , $(RUN_TEST ) )
112-
113- test-sock-import : bin/admin imgs/lambda test-cluster
114- $(subst CONDITION, $(SOCK_IMPORT ) , $(RUN_TEST ) )
115-
116- test-sock-both : bin/admin imgs/lambda test-cluster
117- $(subst CONDITION, $(SOCK_BOTH ) , $(RUN_TEST ) )
118-
119- test-docker-nocache : bin/admin imgs/lambda test-cluster
120- $(subst CONDITION, $(DOCKER_NOCACHE ) , $(RUN_TEST ) )
121-
122- test-docker-handler : bin/admin imgs/lambda test-cluster
123- $(subst CONDITION, $(DOCKER_HANDLER ) , $(RUN_TEST ) )
124-
125- test-docker-import : bin/admin imgs/lambda test-cluster
126- $(subst CONDITION, $(DOCKER_IMPORT ) , $(RUN_TEST ) )
127-
128- test-docker-both : bin/admin imgs/lambda test-cluster
129- $(subst CONDITION, $(DOCKER_BOTH ) , $(RUN_TEST ) )
130-
13158.PHONY : clean
13259clean : clean-test
13360 rm -rf bin
0 commit comments