This commit is contained in:
parent
c75f55c050
commit
79ef0a093c
@ -17,3 +17,11 @@ jobs:
|
|||||||
- name: Deploy testing environment
|
- name: Deploy testing environment
|
||||||
shell: sh
|
shell: sh
|
||||||
run: docker-compose -f backend/docker-compose-x86_64.yaml up -d
|
run: docker-compose -f backend/docker-compose-x86_64.yaml up -d
|
||||||
|
- name: Run test requests
|
||||||
|
shell: sh
|
||||||
|
run: |
|
||||||
|
chmod +x tests/backend.sh
|
||||||
|
tests/backend.sh
|
||||||
|
- name: Clean up testing environment
|
||||||
|
shell: sh
|
||||||
|
run: docker-compose -f backend/docker-compose-x86_64.yaml up -d
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
FROM alpine:latest
|
FROM alpine:latest
|
||||||
|
|
||||||
RUN apk --update add git docker docker-compose postgresql
|
RUN --mount=type=bind,source=/var/run/docker.sock,target=/var/run/docker.sock apk --update add git docker docker-compose postgresql
|
||||||
RUN docker pull postgres
|
RUN --mount=type=bind,source=/var/run/docker.sock,target=/var/run/docker.sock docker pull postgres
|
||||||
|
37
tests/backend.sh
Normal file
37
tests/backend.sh
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
assert_good_status () {
|
||||||
|
if [ $? -ne 0 ]; then
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
assert_bad_status () {
|
||||||
|
if [ $? -eq 0 ]; then
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
HOST=127.0.0.1
|
||||||
|
|
||||||
|
curl -f http://$HOST/movies
|
||||||
|
assert_good_status
|
||||||
|
|
||||||
|
curl -f http://$HOST/passes
|
||||||
|
assert_good_status
|
||||||
|
|
||||||
|
curl -X POST -f http://$HOST/apply_for_pass
|
||||||
|
assert_bad_status
|
||||||
|
|
||||||
|
curl -X POST -f http://$HOST/apply_for_pass \
|
||||||
|
-H "Content-Type: application/json" \
|
||||||
|
--data '{"first": "Hannah",
|
||||||
|
"last": "Dirt",
|
||||||
|
"email": "hannah.dirt@mail.com",
|
||||||
|
"type": 1,
|
||||||
|
"price": 50,
|
||||||
|
"movie_uuid": "742a2542-2b50-11f0-ae4c-f7bedd5fcc88"}'
|
||||||
|
assert_good_status
|
||||||
|
|
||||||
|
curl -f http://$HOST/passes | jq '.result.[0]'
|
||||||
|
assert_good_status
|
Loading…
x
Reference in New Issue
Block a user