Skip to content

Commit 586fe02

Browse files
authored
Merge pull request #238 from simvue-io/hotfix/fix-env-ci
Fix CI system for tests requiring server connection Update functional tests to match refactor
2 parents 3cb7c8d + ee07520 commit 586fe02

20 files changed

+23
-24
lines changed

.github/workflows/test_client_macos.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,7 @@ jobs:
2222
run: python -m pip install poetry
2323
- name: Test with pytest
2424
run: |
25+
export SIMVUE_URL=${{ secrets.SIMVUE_URL }}
26+
export SIMVUE_TOKEN=${{ secrets.SIMVUE_TOKEN }}
2527
poetry install --all-extras
2628
poetry run pytest tests/unit/ tests/refactor/

.github/workflows/test_client_ubuntu.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ jobs:
2727
run: python -m pip install poetry
2828
- name: Test with pytest
2929
run: |
30+
export SIMVUE_URL=${{ secrets.SIMVUE_URL }}
31+
export SIMVUE_TOKEN=${{ secrets.SIMVUE_TOKEN }}
3032
poetry install --all-extras
3133
poetry run pytest --cov --cov-report=xml tests/unit/ tests/refactor/
3234
- name: Upload coverage reports to Codecov

.github/workflows/test_client_windows.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,7 @@ jobs:
2222
run: python -m pip install poetry
2323
- name: Test with pytest
2424
run: |
25+
export SIMVUE_URL=${{ secrets.SIMVUE_URL }}
26+
export SIMVUE_TOKEN=${{ secrets.SIMVUE_TOKEN }}
2527
poetry install --all-extras
2628
poetry run pytest tests/unit/ tests/refactor/

tests/functional/test_artifacts_invalid.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ def test_get_artifact_invalid_run(self):
1717
client = Client()
1818
with self.assertRaises(Exception) as context:
1919
client.get_artifact(run, str(uuid.uuid4()))
20-
21-
self.assertTrue('Run does not exist' in str(context.exception))
20+
21+
self.assertTrue(any(i in str(context.exception) for i in ('Run does not exist', 'No such run')))
2222

2323
if __name__ == '__main__':
2424
unittest.main()

tests/functional/test_get_alerts.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ class TestGetAlerts(unittest.TestCase):
1010
def test_get_alerts(self):
1111
"""
1212
Create a run & two alerts, make one alert be triggered
13-
If triggered_only is True, check that only the triggered alert is returned
14-
IF triggered_only is False, check both alerts are returned
13+
If critical_only is True, check that only the triggered alert is returned
14+
IF critical_only is False, check both alerts are returned
1515
If names_only is False, check that full dictionary of information is returned
1616
"""
1717
run = Run()
@@ -51,7 +51,7 @@ def test_get_alerts(self):
5151
self.assertEqual(triggered_alerts_full[0]["alert"]["name"], "value_above_1")
5252
self.assertEqual(triggered_alerts_full[0]["status"]["current"], "critical")
5353

54-
all_alerts_names = client.get_alerts(run_id, triggered_only=False)
54+
all_alerts_names = client.get_alerts(run_id, critical_only=False)
5555
self.assertListEqual(all_alerts_names, ['value_above_1', 'value_below_1'])
5656

5757
run.close()

tests/functional/test_run_execute_process.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ def test_monitor_processes(self):
99
with Run(mode='offline') as _run:
1010
_run.init(f"test_exec_monitor_{uuid.uuid4()}")
1111
_run.add_process("process_1", "Hello world!", executable="echo", n=True)
12-
_run.add_process("process_2", "bash", debug=True, c="'return 1'")
12+
_run.add_process("process_2", "bash", debug=True, c="true")
1313
_run.add_process("process_3", "ls", "-ltr")
1414
def test_abort_all_processes(self):
1515
start_time = time.time()

tests/functional/test_run_folder_get_delete.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ def test_run_folder_find_delete(self):
2323
with self.assertRaises(Exception) as context:
2424
client.get_folder(folder)
2525

26-
self.assertTrue('Folder does not exist' in str(context.exception))
26+
self.assertTrue(f"Folder '{folder}' does not exist" in str(context.exception))
2727

2828
if __name__ == '__main__':
2929
unittest.main()

tests/functional/test_run_folder_metadata_find.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ def test_run_folder_metadata_find(self):
2828
with self.assertRaises(Exception) as context:
2929
client.get_folder(folder)
3030

31-
self.assertTrue('Folder does not exist' in str(context.exception))
31+
self.assertTrue(f"Folder '{folder}' does not exist" in str(context.exception))
3232

3333
if __name__ == '__main__':
3434
unittest.main()

tests/functional/test_run_metadata.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ def test_run_metadata(self):
1919
run.close()
2020

2121
client = Client()
22-
data = client.get_run(run.id, metadata=True)
22+
data = client.get_run(run.id)
2323
self.assertEqual(data['metadata'], metadata)
2424

2525
runs = client.delete_runs(folder)

tests/functional/test_run_metadata_update.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ def test_run_metadata_update(self):
2020
metadata['b'] = 2
2121

2222
client = Client()
23-
data = client.get_run(run.id, metadata=True)
23+
data = client.get_run(run.id)
2424
self.assertEqual(data['metadata'], metadata)
2525

2626
runs = client.delete_runs(folder)

0 commit comments

Comments
 (0)