Skip to content

Commit d309e31

Browse files
s3-coverage-enhancement
Summary: - Mock servers in containers.
1 parent 94354ff commit d309e31

File tree

3 files changed

+75
-1
lines changed

3 files changed

+75
-1
lines changed

docker-compose-testing.yml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
2+
3+
services:
4+
credentialsgen:
5+
restart: "no"
6+
image: stackql/testlib
7+
build:
8+
context: .
9+
dockerfile: testLib.Dockerfile
10+
# cache_from:
11+
# - stackql/testlib
12+
volumes:
13+
- ./test/server/mtls/credentials:/opt/stackql/srv/credentials:rw
14+
command:
15+
- bash
16+
- -c
17+
- |
18+
openssl req -x509 -keyout /opt/stackql/srv/credentials/pg_server_key.pem -out /opt/stackql/srv/credentials/pg_server_cert.pem -config /opt/test/stackql/test/server/mtls/openssl.cnf -days 365 \
19+
&& openssl req -x509 -keyout /opt/stackql/srv/credentials/pg_client_key.pem -out /opt/stackql/srv/credentials/pg_client_cert.pem -config /opt/test/stackql/test/server/mtls/openssl.cnf -days 365 \
20+
&& openssl req -x509 -keyout /opt/stackql/srv/credentials/pg_rubbish_key.pem -out /opt/stackql/srv/credentials/pg_rubbish_cert.pem -config /opt/test/stackql/test/server/mtls/openssl.cnf -days 365
21+
google_mockserver:
22+
networks:
23+
testing-network:
24+
aliases:
25+
- googleapis.com
26+
image: stackql/testlib
27+
hostname: google_mock_server
28+
build:
29+
context: .
30+
dockerfile: testLib.Dockerfile
31+
# cache_from:
32+
# - stackql/testlib
33+
volumes:
34+
- ./test/server/mtls/credentials:/opt/testlib/test/server/mtls/credentials:ro
35+
ports:
36+
- "1093:1093/tcp"
37+
depends_on:
38+
- credentialsgen
39+
command:
40+
- bash
41+
- -c
42+
- |
43+
flask \
44+
--app=/opt/testlib/test/python/stackql_test_tooling/flask/github/app \
45+
run \
46+
--cert=/opt/testlib/test/server/mtls/credentials/pg_server_cert.pem \
47+
--key=/opt/testlib/test/server/mtls/credentials/pg_server_key.pem \
48+
--host 0.0.0.0 \
49+
--port \
50+
1093
51+
52+
networks:
53+
testing-network:
54+
driver: bridge
55+

test/python/stackql_test_tooling/flask/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ pgrep -f flask | xargs kill -9
1515

1616
### To Run
1717

18-
In order to get the environmental variables required, you can go to the repository root ans then `source cicd/scripts/context.sh`, or set manually; hopefully self-explanatory.
18+
In order to get the environmental variables required, you can go to the repository root and then `source cicd/scripts/context.sh`, or set manually; hopefully self-explanatory.
1919

2020
GCP mocks:
2121

testLib.Dockerfile

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
2+
FROM python:3.14.2-trixie AS utility
3+
4+
RUN --mount=type=bind,source=cicd/requirements.txt,target=/tmp/requirements.txt \
5+
pip install --requirement /tmp/requirements.txt \
6+
&& mkdir -p /opt/testlib/test/python \
7+
&& mkdir -p /opt/testlib/cicd/vol/srv/credentials
8+
9+
COPY test/python/stackql_test_tooling /opt/testlib/test/python/stackql_test_tooling
10+
11+
RUN --mount=type=bind,source=cicd/requirements.txt,target=/tmp/requirements.txt \
12+
pip install --requirement /tmp/requirements.txt
13+
14+
RUN apt-get update \
15+
&& apt-get install -y ca-certificates openssl netcat-traditional jq dnsutils \
16+
&& update-ca-certificates
17+
18+
CMD ["python", "-c", "print('Hello from testlib')"]
19+

0 commit comments

Comments
 (0)