Skip to content

Commit e4b4dd3

Browse files
perigrinclaude
andcommitted
Fix test to properly fail when setup fails
- Move setup execution outside subtest so result is available for checking - Add explicit critical failure check with bail_out outside subtest - Use plan tests => 1 to make subtest expectations clear - Use diag() for critical failure messages to improve visibility - Ensure test properly fails AND stops when setup fails This addresses the issue where tests were continuing even when app creation failed, making test results misleading. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
1 parent 13eebe3 commit e4b4dd3

File tree

1 file changed

+15
-8
lines changed

1 file changed

+15
-8
lines changed

t/03-integration-dev-environment.t

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -75,25 +75,32 @@ subtest 'environment cleanup before test' => sub {
7575
pass("Using production Postgres cluster (not cleaned up per-user)")
7676
};
7777

78-
# Test 3: Development environment setup
78+
# Test 3: Development environment setup (CRITICAL - must pass for other tests to work)
79+
note("Setting up development environment for $USERNAME");
80+
note("This may take 5-10 minutes as it creates real Fly.io apps, volumes, and Postgres clusters");
81+
82+
# Run setup script with proper timeout handling
83+
my $setup_cmd = "perl scripts/setup-dev-env.pl --user $USERNAME 2>&1";
84+
my ($setup_output, $setup_exit) = run_with_timeout($setup_cmd, $TEST_TIMEOUT);
85+
7986
subtest 'development environment setup' => sub {
80-
note("Setting up development environment for $USERNAME");
81-
note("This may take 5-10 minutes as it creates real Fly.io apps, volumes, and Postgres clusters");
82-
83-
# Run setup script with proper timeout handling
84-
my $setup_cmd = "perl scripts/setup-dev-env.pl --user $USERNAME 2>&1";
85-
my ($setup_output, $setup_exit) = run_with_timeout($setup_cmd, $TEST_TIMEOUT);
87+
plan tests => 1;
8688

8789
if ($setup_exit == 0) {
8890
pass("Development environment setup completed successfully");
8991
note("Setup output: $setup_output");
9092
} else {
9193
fail("Development environment setup failed with exit code $setup_exit");
9294
note("Setup error output: $setup_output");
93-
bail_out("Setup failed - cannot proceed with integration tests");
9495
}
9596
};
9697

98+
# Critical failure check - bail out if setup failed
99+
if ($setup_exit != 0) {
100+
diag("CRITICAL: Setup failed, cannot proceed with integration tests");
101+
bail_out("Setup failed - cannot proceed with integration tests");
102+
}
103+
97104
# Test 4: Verify apps are created and running
98105
subtest 'verify dev apps created and status' => sub {
99106
foreach my $app (@DEV_APPS) {

0 commit comments

Comments
 (0)