-
Notifications
You must be signed in to change notification settings - Fork 2
69 lines (66 loc) · 2.68 KB
/
test-docker.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
name: test-docker-image
on:
[ push, pull_request ]
permissions:
contents: read
packages: write
issues: write
pull-requests: write
jobs:
test-docker-image:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Build test environment
working-directory: docker/tests
run: |
docker compose build
- name: Run containers
working-directory: docker/tests
run: |
docker compose up -d
- name: Run CLI tests
working-directory: docker/tests
run: |
# test adding a subscription
docker exec subscriber wis2downloader add-subscription --topic cache/a/wis2/+/services/#
# test listing subscriptions
docker exec subscriber wis2downloader list-subscriptions
# publish a test message
docker exec publisher pywis-pubsub publish --topic cache/a/wis2/my-centre/services/downloader \
--config /pywis-pubsub/config/config.yml \
-i test -u "http://subscriber:5000/openapi"
sleep 1s
# cat file contents (check the published file has been downloaded)
cat ./data/downloads/$(date +"%Y")/$(date +"%m")/$(date +"%d")/cache/a/wis2/my-centre/services/downloader/openapi.bin
# test deleting subscriptions
docker exec subscriber wis2downloader remove-subscription --topic cache/a/wis2/+/services/#
- name: Run API tests
working-directory: docker/tests
run: |
# get metrics
curl http://localhost:5000/metrics
# test adding a subscription
curl -X 'POST' \
'http://localhost:5000/subscriptions' \
-H 'accept: application/json' \
-H 'Content-Type: application/json' \
-d '{
"topic": "cache/a/wis2/+/services/#"
}'
# test listing subscriptions
curl http://localhost:5000/subscriptions
# publish a test message
docker exec publisher pywis-pubsub publish --topic cache/a/wis2/my-centre/services/downloader \
--config /pywis-pubsub/config/config.yml \
-i test -u "http://subscriber:5000/metrics"
sleep 1s
# cat file contents (check the published file has been downloaded)
cat ./data/downloads/`date +"%Y"`/`date +"%m"`/`date +"%d"`/cache/a/wis2/my-centre/services/downloader/metrics.bin
# test deleting subscriptions
curl -X DELETE http://localhost:5000/subscriptions/cache/a/wis2/%2B/services/%23
- name: Shutdown
working-directory: docker/tests
run: |
docker compose down