Skip to content
Open
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
54 changes: 50 additions & 4 deletions internal/commands/.scripts/integration_up.sh
Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,25 @@ else
# If the file is not empty, rerun the failed tests
echo "Rerunning failed tests..."
rerun_status=0
STILL_FAILING_TESTS_FILE="stillFailingTests"
touch "$STILL_FAILING_TESTS_FILE"

while IFS= read -r testName; do
go test \
echo "Retrying: $testName"
if go test \
-tags integration \
-v \
-timeout 30m \
-coverpkg github.com/checkmarx/ast-cli/internal/commands,github.com/checkmarx/ast-cli/internal/services,github.com/checkmarx/ast-cli/internal/wrappers \
-coverprofile cover_rerun.out \
-run "^$testName$" \
github.com/checkmarx/ast-cli/test/integration || rerun_status=1
github.com/checkmarx/ast-cli/test/integration; then
echo " ✓ $testName passed on retry"
else
echo " ✗ $testName still failing"
echo "$testName" >> "$STILL_FAILING_TESTS_FILE"
rerun_status=1
fi
done < "$FAILED_TESTS_FILE"

# Step 5: Merge the original and rerun coverage profiles
Expand All @@ -83,8 +93,44 @@ fi
echo "Running cleandata to clean up projects..."
go test -v github.com/checkmarx/ast-cli/test/cleandata

# Step 8: Final cleanup and exit
rm -f "$FAILED_TESTS_FILE" test_output.log
# Step 8: Print summary of failed tests (if any)
echo ""
echo "=========================================="
echo " TEST EXECUTION SUMMARY "
echo "=========================================="

if [ $status -ne 0 ] || [ $rerun_status -eq 1 ]; then
echo "Status: FAILED ✗"
echo ""

if [ -f "$STILL_FAILING_TESTS_FILE" ] && [ -s "$STILL_FAILING_TESTS_FILE" ]; then
echo "The following tests FAILED even after retry:"
echo "------------------------------------------"
cat "$STILL_FAILING_TESTS_FILE" | while IFS= read -r testName; do
echo " ✗ $testName"
done
echo ""
echo "Total failed tests: $(wc -l < "$STILL_FAILING_TESTS_FILE")"
echo ""
echo "To rerun these tests individually:"
cat "$STILL_FAILING_TESTS_FILE" | while IFS= read -r testName; do
echo " go test -tags integration -v -run \"^$testName$\" github.com/checkmarx/ast-cli/test/integration"
done
else
echo "Tests failed on initial run but details not available."
echo "Check test_output.log for more information."
fi
else
echo "Status: SUCCESS ✓"
echo ""
echo "All integration tests passed!"
fi

echo "=========================================="
echo ""

# Step 9: Final cleanup and exit
rm -f "$FAILED_TESTS_FILE" "$STILL_FAILING_TESTS_FILE" test_output.log

if [ $status -ne 0 ] || [ $rerun_status -eq 1 ]; then
exit 1
Expand Down
2 changes: 1 addition & 1 deletion test/integration/auth_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const (

// Test validate with credentials used in test env
func TestAuthValidate(t *testing.T) {
err, buffer := executeCommand(t, "auth", "validate")
err, buffer := executeCommand(t, "auth", "validatee")
assertSuccessAuthentication(t, err, buffer, defaultSuccessValidationMessage)
}

Expand Down
Loading