Skip to content

Commit 359ed4d

Browse files
committed
Test it
1 parent 5b30a78 commit 359ed4d

File tree

2 files changed

+14
-9
lines changed

2 files changed

+14
-9
lines changed

.github/workflows/health_check.yml

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,21 @@
11
name: Health Check
22

33
on:
4+
# Run the workflow test on push events
45
push:
5-
paths:
6-
- scripts/health_check.py
7-
- .github/workflows/health_check.yml
6+
# Run the main workflow on workflow_dispatch or schedule
87
workflow_dispatch:
98
schedule:
109
# Every 5 minutes
1110
- cron: '*/5 * * * *'
1211

1312
jobs:
14-
health-check:
13+
health_check:
1514
runs-on: ubuntu-latest
1615
strategy:
17-
matrix:
18-
environment: ['dev', 'stage', 'prod']
1916
fail-fast: false
17+
matrix:
18+
environment: ${{fromJson(github.event_name == 'push' && '["test"]' || '["dev","stage","prod"]')}}
2019

2120
steps:
2221
- uses: actions/checkout@v4

scripts/health_check.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
('dev', 'https://addons-dev.allizom.org'),
1414
('stage', 'https://addons.allizom.org'),
1515
('prod', 'https://addons.mozilla.org'),
16+
# TODO: maybe we could use the local environmnet here
17+
('test', '')
1618
],
1719
)
1820

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

4850
def version(self):
51+
if self.environment.name == 'test':
52+
return {}
4953
return self._fetch('__version__')
5054

5155
def monitors(self):
56+
if self.environment.name == 'test':
57+
return {
58+
'up': {'state': True},
59+
'down': {'state': False, 'status': 'something is wrong'}
60+
}
5261
return self._fetch('services/monitor.json')
5362

54-
55-
# Test
56-
5763
def main(env: ENV_ENUM, verbose: bool = False, output: str | None = None):
5864
fetcher = Fetcher(env, verbose)
5965

0 commit comments

Comments
 (0)