Skip to content

Commit 2b9d130

Browse files
dan-vclaude
andcommitted
Fix tests to skip when AWS credentials are not available
- Add credential check to status and destroy tests - Tests now skip gracefully in CI environments without AWS creds - Prevents false failures while preserving integration test functionality - Tests still run when AWS credentials are present 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
1 parent a8494ff commit 2b9d130

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

cmd/lambda-nat-proxy/cli_test.go

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,11 +148,17 @@ func testStatusCommand(t *testing.T) {
148148
cmd.Dir = "."
149149

150150
output, err := cmd.CombinedOutput()
151+
outputStr := string(output)
152+
153+
// Skip test if AWS credentials are not available
154+
if err != nil && strings.Contains(outputStr, "invalid AWS credentials") {
155+
t.Skip("Skipping status test - AWS credentials not available")
156+
return
157+
}
158+
151159
if err != nil {
152160
t.Fatalf("Status command failed: %v\nOutput: %s", err, output)
153161
}
154-
155-
outputStr := string(output)
156162
expectedStrings := []string{
157163
"Lambda NAT Proxy Status",
158164
"Overall Status:",
@@ -223,6 +229,13 @@ func testDestroyCommand(t *testing.T) {
223229
// The command should exit with non-zero status when cancelled, but that's expected
224230

225231
outputStr := string(output)
232+
233+
// Skip test if AWS credentials are not available
234+
if strings.Contains(outputStr, "invalid AWS credentials") {
235+
t.Skip("Skipping destroy test - AWS credentials not available")
236+
return
237+
}
238+
226239
expectedStrings := []string{
227240
"Lambda NAT Proxy Destruction Plan",
228241
"The following resources will be PERMANENTLY DELETED:",

0 commit comments

Comments
 (0)