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

Better failed assertion message, print return code #12615

Merged
merged 2 commits into from
Jul 28, 2022
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
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,10 @@ def assert_metadata(self, check_id, data):
assert data == actual

def assert_metadata_count(self, count):
assert len(self._metadata) == count
metadata_items = len(self._metadata)
assert metadata_items == count, 'Expected {} metadata items, found {}. Submitted metadata: {}'.format(
count, metadata_items, repr(self._metadata)
)

def get_hostname(self):
return self._hostname
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ def _run_start_commands(metadata, environment, check, env):
result = environment.exec_command(command, capture=True)
if result.code:
click.echo()
echo_failure('An error occurred running "{}"'.format(str(command)))
echo_failure('An error occurred running "{}". Exit code: {}'.format(str(command), result.code))
echo_failure(result.stdout + result.stderr, indent=True)
echo_waiting('Stopping the environment...')
stop_environment(check, env, metadata=metadata)
Expand Down