Skip to content

Commit 731375d

Browse files
committed
Merge branch 'issues/208' of https://github.com/mwvgroup/Pitt-Google-Broker into issues/208
2 parents c7d173d + d10ebe4 commit 731375d

File tree

8 files changed

+1414
-71
lines changed

8 files changed

+1414
-71
lines changed

.github/workflows/BrokerTest.yml

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
name: Test Broker
2+
3+
on:
4+
workflow_dispatch:
5+
workflow_call:
6+
push:
7+
8+
env:
9+
PYTHON_VERSION: 3.11
10+
11+
jobs:
12+
discover:
13+
name: Discover Microservices
14+
runs-on: ubuntu-latest
15+
16+
outputs:
17+
matrix: ${{ steps.find_tests.outputs.matrix }}
18+
19+
steps:
20+
- name: Checkout source
21+
uses: actions/checkout@v4
22+
23+
- name: Find testable apps
24+
id: find_tests
25+
run: |
26+
# Find application directories containing a 'tests' subdirectory nd format the result as JSON
27+
test_dirs=$(find broker/cloud_functions -type d -name "tests" -exec dirname {} \; | jq -R . | jq -s . | tr -d '\n')
28+
echo "found $test_dirs"
29+
echo "matrix={\"app_dir\":$test_dirs}" >> $GITHUB_OUTPUT
30+
31+
test:
32+
name: Test Microservices
33+
runs-on: ubuntu-latest
34+
needs: [ discover ]
35+
36+
strategy:
37+
fail-fast: false
38+
matrix: ${{ fromJSON(needs.discover.outputs.matrix) }}
39+
40+
steps:
41+
- name: Checkout source
42+
uses: actions/checkout@v4
43+
44+
- name: Setup Python
45+
uses: actions/setup-python@v4
46+
with:
47+
python-version: ${{ env.PYTHON_VERSION }}
48+
49+
- name: Install dependencies
50+
run: |
51+
pip install coverage
52+
pip install -r ${{ matrix.app_dir }}/requirements.txt
53+
54+
- name: Test ${{ matrix.app_dir }} app
55+
run: coverage run -m unittest discover ${{ matrix.app_dir }}
56+
57+
report-status:
58+
name: Report Test Status
59+
if: always()
60+
needs: [ test ]
61+
runs-on: ubuntu-latest
62+
63+
steps:
64+
- name: Check build status
65+
if: ${{ contains(needs.*.result, 'failure') }}
66+
run: exit 1

.github/workflows/TestCloudFunction.yml

Lines changed: 0 additions & 61 deletions
This file was deleted.

broker/cloud_functions/classify_snn/tests/test_cloud_fnc.py

Lines changed: 0 additions & 10 deletions
This file was deleted.
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
"""This test module is an example placeholder put in place while deveoping the CI toolchain."""
2+
3+
from unittest import TestCase
4+
5+
6+
class Placeholder(TestCase):
7+
"""A set of placeholder tests"""
8+
9+
def test_pass(self) -> None:
10+
"""This test will always pass"""

broker/setup_broker/setup_gcp.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,8 @@ def _resources(service, survey='ztf', testid='test', versiontag="v3_3"):
142142

143143
if service == 'GCS':
144144
buckets = { # '<bucket-name>': ['<file-name to upload>',]
145+
# the avro bucket f'{PROJECT_ID}-{survey}_alerts_{versiontag}'
146+
# is managed in broker/cloud_functions/ps_to_gcs/deploy.sh
145147
f'{PROJECT_ID}-{survey}-broker_files': [],
146148
f'{PROJECT_ID}-{survey}-testing_bucket':
147149
['ztf_3.3_validschema_1154446891615015011.avro'],

0 commit comments

Comments
 (0)