Commit 16c492f 1 parent d7ceb57 commit 16c492f Copy full SHA for 16c492f
File tree 4 files changed +21
-5
lines changed
4 files changed +21
-5
lines changed Original file line number Diff line number Diff line change @@ -40,11 +40,18 @@ jobs:
40
40
# run: |
41
41
# npm run test
42
42
43
+ # Integration tests, first docker compose up runs the normal test.
44
+ # The second one runs the test without deleting the FaaS container,
45
+ # and the environment varialbe TEST_FAAS_STARTUP_DEPLOY forces the
46
+ # test to avoid deploying again all the deployments. By this we are
47
+ # testing if the startup initialization works because the deployments
48
+ # are persisted from the previous run.
43
49
- name : Run Integration Tests
44
50
shell : bash
45
51
run : |
46
52
docker compose build
47
53
docker compose up --exit-code-from test
54
+ TEST_FAAS_STARTUP_DEPLOY=true docker compose up --exit-code-from test
48
55
docker compose down
49
56
50
57
- name : Publish
Original file line number Diff line number Diff line change @@ -37,6 +37,8 @@ services:
37
37
context : .
38
38
dockerfile : Dockerfile
39
39
target : test
40
+ environment :
41
+ TEST_FAAS_STARTUP_DEPLOY : ${TEST_FAAS_STARTUP_DEPLOY:-false}
40
42
network_mode : host
41
43
depends_on :
42
44
- faas
Original file line number Diff line number Diff line change @@ -17,10 +17,10 @@ export const createInstallDependenciesScript = (
17
17
path : string
18
18
) : string => {
19
19
const installDependenciesScript : Record < string , string > = {
20
- python : `cd ${ path } && echo "some data for the file" >> randomasd.txt && metacall pip3 install -r requirements.txt` ,
21
- nodejs : `cd ${ path } ; metacall npm i` ,
22
- csharp : `cd ${ path } ; metacall dotnet restore; metacall dotnet release;` ,
23
- ruby : `cd ${ path } ; metacall bundle install`
20
+ python : `cd ${ path } && metacall pip3 install -r requirements.txt` ,
21
+ nodejs : `cd ${ path } && metacall npm i` ,
22
+ csharp : `cd ${ path } && metacall dotnet restore && metacall dotnet release;` ,
23
+ ruby : `cd ${ path } && metacall bundle install`
24
24
} ;
25
25
return installDependenciesScript [ runner ] ;
26
26
} ;
Original file line number Diff line number Diff line change @@ -30,6 +30,13 @@ function getPrefix() {
30
30
echo $prefix
31
31
}
32
32
33
+ # Deploy only if we are not testing startup deployments, otherwise the deployments have been loaded already
34
+ function deploy() {
35
+ if [[ " ${TEST_FAAS_STARTUP_DEPLOY} " != " true" ]]; then
36
+ metacall-deploy --dev
37
+ fi
38
+ }
39
+
33
40
# Wait for the FaaS to be ready
34
41
while [[ ! $( curl -s -o /dev/null -w " %{http_code}" $BASE_URL /readiness) = " 200" ]]; do
35
42
sleep 1
@@ -40,7 +47,7 @@ echo "FaaS ready, starting tests."
40
47
# Test deploy (Python) without dependencies
41
48
app=" python-base-app"
42
49
pushd data/$app
43
- metacall- deploy --dev
50
+ deploy
44
51
prefix=$( getPrefix $app )
45
52
url=$BASE_URL /$prefix /$app /v1/call
46
53
[[ $( curl -s $url /number) = 100 ]] || exit 1
You can’t perform that action at this time.
0 commit comments