Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use specified test case environments and move label up to run #6

Merged
merged 1 commit into from
Feb 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

setup(
name="sri-test-harness",
version="0.1.0",
version="0.1.1",
author="Max Wang",
author_email="[email protected]",
url="https://github.com/TranslatorSRI/TestHarness",
Expand Down
2 changes: 1 addition & 1 deletion test_harness/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ async def main(args):
logger=logger,
)
await reporter.get_auth()
await reporter.create_test_run()
await reporter.create_test_run(next(iter(tests.values())))
slacker = Slacker()
report = await run_tests(reporter, slacker, tests, logger)

Expand Down
9 changes: 4 additions & 5 deletions test_harness/reporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,17 @@ async def get_auth(self):
}
)

async def create_test_run(self):
async def create_test_run(self, test: TestCase):
"""Create a test run in the IR."""
res = await self.authenticated_client.post(
url=f"{self.base_path}/api/reporting/v1/test-runs",
json={
"name": f"Test Harness Automated Tests: {datetime.now().strftime('%Y_%m_%d_%H_%M')}",
"startedAt": datetime.now().astimezone().isoformat(),
"framework": "Translator Automated Testing",
"config": {
"environment": test.test_env,
},
},
)
res.raise_for_status()
Expand All @@ -77,10 +80,6 @@ async def create_test(self, test: TestCase, asset: TestAsset):
"key": "TestAsset",
"value": asset.id,
},
{
"key": "Environment",
"value": test.test_env,
},
],
},
)
Expand Down
6 changes: 2 additions & 4 deletions test_harness/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,7 @@ async def run_tests(
try:
test_input = json.dumps(
{
# "environment": test.test_env,
"environment": "test",
"environment": test.test_env,
"predicate": test.test_case_predicate_name,
"runner_settings": test.test_case_runner_settings,
"expected_output": asset.expected_output,
Expand All @@ -82,8 +81,7 @@ async def run_tests(
output_ids = [asset.output_id for asset in assets]
expected_outputs = [asset.expected_output for asset in assets]
test_inputs = [
# test.test_env,
"test",
test.test_env,
test.test_case_predicate_name,
test.test_case_runner_settings,
expected_outputs,
Expand Down
Loading