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 Feb 21, 2024
1 parent 5fbcc8f commit 865dbb8
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 = 1250 * 1024 * 1024

# Formatting. Default colors to empty strings.
DEFAULT, BOLD, GREEN, RED = ("", ""), ("", ""), ("", ""), ("", "")
try:
Expand Down Expand Up @@ -559,6 +562,11 @@ def run_tests(*, test_list, src_dir, build_dir, tmpdir, jobs=1, enable_coverage=
if os.path.isdir(cache_dir):
print("%sWARNING!%s There is a cache directory here: %s. If tests fail unexpectedly, try deleting the cache directory." % (BOLD[1], BOLD[0], cache_dir))

# 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 in directory: {tmpdir}")

# Test Framework Tests
print("Running Unit Tests for Test Framework Modules")

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 865dbb8

Please sign in to comment.