Skip to content

Commit

Permalink
Merge branch 'issues/208' of https://github.com/mwvgroup/Pitt-Google-…
Browse files Browse the repository at this point in the history
…Broker into issues/208
  • Loading branch information
troyraen committed Feb 2, 2024
2 parents c7d173d + d10ebe4 commit 731375d
Show file tree
Hide file tree
Showing 8 changed files with 1,414 additions and 71 deletions.
66 changes: 66 additions & 0 deletions .github/workflows/BrokerTest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
name: Test Broker

on:
workflow_dispatch:
workflow_call:
push:

env:
PYTHON_VERSION: 3.11

jobs:
discover:
name: Discover Microservices
runs-on: ubuntu-latest

outputs:
matrix: ${{ steps.find_tests.outputs.matrix }}

steps:
- name: Checkout source
uses: actions/checkout@v4

- name: Find testable apps
id: find_tests
run: |
# Find application directories containing a 'tests' subdirectory nd format the result as JSON
test_dirs=$(find broker/cloud_functions -type d -name "tests" -exec dirname {} \; | jq -R . | jq -s . | tr -d '\n')
echo "found $test_dirs"
echo "matrix={\"app_dir\":$test_dirs}" >> $GITHUB_OUTPUT
test:
name: Test Microservices
runs-on: ubuntu-latest
needs: [ discover ]

strategy:
fail-fast: false
matrix: ${{ fromJSON(needs.discover.outputs.matrix) }}

steps:
- name: Checkout source
uses: actions/checkout@v4

- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: ${{ env.PYTHON_VERSION }}

- name: Install dependencies
run: |
pip install coverage
pip install -r ${{ matrix.app_dir }}/requirements.txt
- name: Test ${{ matrix.app_dir }} app
run: coverage run -m unittest discover ${{ matrix.app_dir }}

report-status:
name: Report Test Status
if: always()
needs: [ test ]
runs-on: ubuntu-latest

steps:
- name: Check build status
if: ${{ contains(needs.*.result, 'failure') }}
run: exit 1
61 changes: 0 additions & 61 deletions .github/workflows/TestCloudFunction.yml

This file was deleted.

10 changes: 0 additions & 10 deletions broker/cloud_functions/classify_snn/tests/test_cloud_fnc.py

This file was deleted.

10 changes: 10 additions & 0 deletions broker/cloud_functions/tag/tests/test_cloud_fnc.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
"""This test module is an example placeholder put in place while deveoping the CI toolchain."""

from unittest import TestCase


class Placeholder(TestCase):
"""A set of placeholder tests"""

def test_pass(self) -> None:
"""This test will always pass"""
2 changes: 2 additions & 0 deletions broker/setup_broker/setup_gcp.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,8 @@ def _resources(service, survey='ztf', testid='test', versiontag="v3_3"):

if service == 'GCS':
buckets = { # '<bucket-name>': ['<file-name to upload>',]
# the avro bucket f'{PROJECT_ID}-{survey}_alerts_{versiontag}'
# is managed in broker/cloud_functions/ps_to_gcs/deploy.sh
f'{PROJECT_ID}-{survey}-broker_files': [],
f'{PROJECT_ID}-{survey}-testing_bucket':
['ztf_3.3_validschema_1154446891615015011.avro'],
Expand Down
Loading

0 comments on commit 731375d

Please sign in to comment.