Skip to content

Commit

Permalink
Test it
Browse files Browse the repository at this point in the history
  • Loading branch information
KevinMind committed Jan 29, 2025
1 parent 5b30a78 commit 359ed4d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 9 deletions.
11 changes: 5 additions & 6 deletions .github/workflows/health_check.yml
Original file line number Diff line number Diff line change
@@ -1,22 +1,21 @@
name: Health Check

on:
# Run the workflow test on push events
push:
paths:
- scripts/health_check.py
- .github/workflows/health_check.yml
# Run the main workflow on workflow_dispatch or schedule
workflow_dispatch:
schedule:
# Every 5 minutes
- cron: '*/5 * * * *'

jobs:
health-check:
health_check:
runs-on: ubuntu-latest
strategy:
matrix:
environment: ['dev', 'stage', 'prod']
fail-fast: false
matrix:
environment: ${{fromJson(github.event_name == 'push' && '["test"]' || '["dev","stage","prod"]')}}

steps:
- uses: actions/checkout@v4
Expand Down
12 changes: 9 additions & 3 deletions scripts/health_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
('dev', 'https://addons-dev.allizom.org'),
('stage', 'https://addons.allizom.org'),
('prod', 'https://addons.mozilla.org'),
# TODO: maybe we could use the local environmnet here
('test', '')
],
)

Expand Down Expand Up @@ -46,14 +48,18 @@ def _fetch(self, path: str) -> dict[str, str] | None:
return data

def version(self):
if self.environment.name == 'test':
return {}
return self._fetch('__version__')

def monitors(self):
if self.environment.name == 'test':
return {
'up': {'state': True},
'down': {'state': False, 'status': 'something is wrong'}
}
return self._fetch('services/monitor.json')


# Test

def main(env: ENV_ENUM, verbose: bool = False, output: str | None = None):
fetcher = Fetcher(env, verbose)

Expand Down

0 comments on commit 359ed4d

Please sign in to comment.