Skip to content

Commit

Permalink
test: Handle functional test disk-full error
Browse files Browse the repository at this point in the history
  • Loading branch information
BrandonOdiwuor committed Jan 29, 2024
1 parent 5fbcc8f commit ebb842a
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion test/functional/test_runner.py
Expand Up @@ -30,6 +30,9 @@

os.environ["REQUIRE_WALLET_TYPE_SET"] = "1"

# Should fail testing and immediately stop if free space falls below.
MIN_FREE_SPACE = (50 + 16) * 1024 * 1024

# Formatting. Default colors to empty strings.
DEFAULT, BOLD, GREEN, RED = ("", ""), ("", ""), ("", ""), ("", "")
try:
Expand Down Expand Up @@ -574,6 +577,11 @@ def run_tests(*, test_list, src_dir, build_dir, tmpdir, jobs=1, enable_coverage=
if not result.wasSuccessful():
sys.exit("Early exiting after failure in TestFramework unit tests")

# Exit the test if there is not enough space on the testing dir
testdir_disk_usage_stats = shutil.disk_usage(tmpdir)
if (testdir_disk_usage_stats.free < MIN_FREE_SPACE):
sys.exit(f"Tests aborted: Insufficient space available on the device. Directory: {tmpdir}")

flags = ['--cachedir={}'.format(cache_dir)] + args

if enable_coverage:
Expand Down Expand Up @@ -655,7 +663,7 @@ def run_tests(*, test_list, src_dir, build_dir, tmpdir, jobs=1, enable_coverage=

all_passed = all_passed and coverage_passed

# Clean up dangling processes if any. This may only happen with --failfast option.
# Clean up dangling processes if any. This may only happen with --failfast option or not enough space on test directory.
# Killing the process group will also terminate the current process but that is
# not an issue
if not os.getenv("CI_FAILFAST_TEST_LEAVE_DANGLING") and len(job_queue.jobs):
Expand Down

0 comments on commit ebb842a

Please sign in to comment.