Skip to content

Commit ecd0124

Browse files
committed
Update tests to check env variables handling
1 parent 889af4a commit ecd0124

File tree

3 files changed

+13
-2
lines changed

3 files changed

+13
-2
lines changed

.github/workflows/dockerimage.yml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,12 @@ jobs:
2525

2626
- name: Serve a static asset
2727
run: |
28-
docker run --detach --rm -p 0.0.0.0:8888:80 -v "$PWD/tests":/static:ro -v "$PWD/tests/static.conf":/etc/nginx/conf.d/static.conf:ro --name test_nginx -t ${{ github.repository }}
28+
docker run --detach --rm -p 0.0.0.0:8888:80 -v "$PWD/tests":/static:ro -v "$PWD/tests/static.conf":/etc/nginx/conf.d/static.conf:ro -v "$PWD/tests/env.conf":/etc/nginx/main.d/env.conf:ro --env FOO=foo-test --name test_nginx -t ${{ github.repository }}
2929
sleep 2; docker ps
30-
curl -v --compressed 0.0.0.0:8888
30+
curl -v --compressed 0.0.0.0:8888 2>&1 | tee /tmp/out
31+
32+
# assert response headers presense
33+
grep 'X-Foo: foo-test' /tmp/out
34+
grep 'Content-Encoding: br' /tmp/out
35+
3136
docker logs test_nginx

tests/env.conf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
env FOO;

tests/static.conf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,10 @@ server {
99
brotli_static on;
1010

1111
expires 1d;
12+
13+
# test lua module, see env.conf too
14+
set_by_lua $foo_from_env 'return os.getenv("FOO")';
15+
16+
add_header X-Foo $foo_from_env;
1217
}
1318
}

0 commit comments

Comments
 (0)