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

Remove reduntant log assertion from simple service test #570

Merged
merged 2 commits into from
Aug 4, 2021
Merged
Changes from 1 commit
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
11 changes: 5 additions & 6 deletions tests/goth_tests/test_run_simple_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@

logger = logging.getLogger("goth.test.run_simple_service")

RUNNING_TIME = 40 # in seconds
SUBNET_TAG = "goth"


@pytest.mark.asyncio
async def test_run_simple_service(
Expand All @@ -43,7 +46,7 @@ async def test_run_simple_service(
requestor = runner.get_probes(probe_type=RequestorProbe)[0]

async with requestor.run_command_on_host(
f"{requestor_path} --running-time 40 --subnet-tag goth",
f"{requestor_path} --running-time {RUNNING_TIME} --subnet-tag {SUBNET_TAG}",
env=os.environ,
) as (_cmd_task, cmd_monitor):

Expand All @@ -52,14 +55,10 @@ async def test_run_simple_service(
def elapsed_time():
return f"time: {(time.time() - start_time):.1f}"

# Add assertions to the command output monitor `cmd_monitor`:
cmd_monitor.add_assertion(assert_no_errors)
cmd_monitor.add_assertion(assert_all_invoices_accepted)

await cmd_monitor.wait_for_pattern("Starting 1 instance", timeout=20)
await cmd_monitor.wait_for_pattern("instances:.*starting", timeout=20)
logger.info(f"The instance is starting ({elapsed_time()})")

# A longer timeout to account for downloading a VM image
await cmd_monitor.wait_for_pattern("All instances started", timeout=120)
logger.info(f"The instance was started successfully ({elapsed_time()})")
Expand All @@ -72,4 +71,4 @@ def elapsed_time():
logger.info(f"The instance is stopping ({elapsed_time()})")

await cmd_monitor.wait_for_pattern(".*All jobs have finished", timeout=20)
logger.info(f"Requestor script finished ({elapsed_time()}")
logger.info(f"Requestor script finished ({elapsed_time()})")