fix: remove t.Parallel from VAT tests to eliminate deadlock flakiness
CI / Nginx config check (push) Successful in 10s
CI / Docker compose check (push) Successful in 11s
CI / Env docs check (push) Successful in 11s
CI / Frontend major deps (push) Failing after 25s
CI / Frontend deps check (push) Successful in 26s
CI / Secrets scan (push) Successful in 40s
CI / Go build (push) Successful in 40s
CI / Frontend build (push) Successful in 1m8s
CI / Knip (push) Successful in 38s
CI / Go vet (prod) (push) Successful in 1m51s
CI / Frontend a11y check (push) Failing after 2m3s
CI / Go vet (dev) (push) Successful in 2m1s
CI / go mod tidy (push) Successful in 1m24s
CI / Staticcheck (prod) (push) Failing after 3m19s
CI / Staticcheck (dev) (push) Successful in 3m20s
CI / golangci-lint (push) Successful in 3m22s
CI / Go vulnerabilities (push) Successful in 1m30s
CI / Frontend QC (audit) (push) Successful in 2m14s
CI / Frontend QC (lint) (push) Failing after 1m5s
CI / Frontend QC (typecheck) (push) Successful in 1m16s
CI / Security scan (dev) (push) Failing after 4m7s
CI / Security scan (prod) (push) Failing after 4m4s
CI / Tests (prod) (push) Has been skipped
CI / Tests (dev) (push) Has been skipped
CI / Race (prod) (push) Has been skipped
CI / Race (dev) (push) Has been skipped
CI / Svelte strict check (push) Has been skipped

This commit is contained in:
2026-07-10 12:49:57 +01:00
parent 19d1d8dd47
commit 3d337b61b8
+30 -9
View File
@@ -2994,14 +2994,21 @@ func TestVAT_DisableVATRegistration_Lifecycle(t *testing.T) {
t.Fatalf("phase 3: expected 200, got %d: %s", w3.Code, w3.Body.String()) t.Fatalf("phase 3: expected 200, got %d: %s", w3.Code, w3.Body.String())
} }
// Verify NO VAT on the second payment (the latest cash payment) var phase3Resp CheckoutResponse
if err := json.Unmarshal(w3.Body.Bytes(), &phase3Resp); err != nil {
t.Fatalf("phase 3: failed to parse response: %v", err)
}
// Verify NO VAT on the second payment (query by specific payment ID
// avoids non-deterministic ORDER BY created_at DESC when all payments
// share the same transaction start time from NOW()).
var vat3 sql.NullFloat64 var vat3 sql.NullFloat64
var net3 sql.NullFloat64 var net3 sql.NullFloat64
var vatApplicable3 bool var vatApplicable3 bool
var amount3 float64 var amount3 float64
err = tx.QueryRow(ctx, `SELECT amount, is_vat_applicable, vat_amount, net_amount FROM payments WHERE booking_id = $1 AND payment_method = 'cash' ORDER BY created_at DESC LIMIT 1`, bookingID).Scan(&amount3, &vatApplicable3, &vat3, &net3) err = tx.QueryRow(ctx, `SELECT amount, is_vat_applicable, vat_amount, net_amount FROM payments WHERE id = $1`, phase3Resp.CheckoutID).Scan(&amount3, &vatApplicable3, &vat3, &net3)
if err != nil { if err != nil {
t.Fatalf("phase 3: failed to query latest payment: %v", err) t.Fatalf("phase 3: failed to query payment: %v", err)
} }
if vatApplicable3 { if vatApplicable3 {
@@ -3138,14 +3145,21 @@ func TestVAT_DisableAndReEnable_Lifecycle(t *testing.T) {
t.Fatalf("phase 2: expected 200, got %d: %s", w2.Code, w2.Body.String()) t.Fatalf("phase 2: expected 200, got %d: %s", w2.Code, w2.Body.String())
} }
// Get the latest cash payment (the second one, without VAT) var phase2Resp CheckoutResponse
if err := json.Unmarshal(w2.Body.Bytes(), &phase2Resp); err != nil {
t.Fatalf("phase 2: failed to parse response: %v", err)
}
// Get the specific payment by its ID from the response (avoiding
// non-deterministic ORDER BY created_at DESC when NOW() returns the same
// transaction start time for all inserts within a transaction).
var p2VAT sql.NullFloat64 var p2VAT sql.NullFloat64
var p2Net sql.NullFloat64 var p2Net sql.NullFloat64
var p2VATApplicable bool var p2VATApplicable bool
var p2Amount float64 var p2Amount float64
err = tx.QueryRow(ctx, `SELECT amount, is_vat_applicable, vat_amount, net_amount FROM payments WHERE booking_id = $1 AND payment_method = 'cash' ORDER BY created_at DESC LIMIT 1`, bookingID).Scan(&p2Amount, &p2VATApplicable, &p2VAT, &p2Net) err = tx.QueryRow(ctx, `SELECT amount, is_vat_applicable, vat_amount, net_amount FROM payments WHERE id = $1`, phase2Resp.CheckoutID).Scan(&p2Amount, &p2VATApplicable, &p2VAT, &p2Net)
if err != nil { if err != nil {
t.Fatalf("phase 2: failed to query latest payment: %v", err) t.Fatalf("phase 2: failed to query payment: %v", err)
} }
if p2VATApplicable { if p2VATApplicable {
@@ -3182,13 +3196,20 @@ func TestVAT_DisableAndReEnable_Lifecycle(t *testing.T) {
t.Fatalf("phase 3: expected 200, got %d: %s", w3.Code, w3.Body.String()) t.Fatalf("phase 3: expected 200, got %d: %s", w3.Code, w3.Body.String())
} }
// Get the latest cash payment (the third one, with VAT re-enabled) var phase3Resp CheckoutResponse
if err := json.Unmarshal(w3.Body.Bytes(), &phase3Resp); err != nil {
t.Fatalf("phase 3: failed to parse response: %v", err)
}
// Get the specific payment by its ID from the response (avoiding
// non-deterministic ORDER BY created_at DESC when NOW() returns the same
// transaction start time for all inserts within a transaction).
var p3VAT sql.NullFloat64 var p3VAT sql.NullFloat64
var p3Net sql.NullFloat64 var p3Net sql.NullFloat64
var p3VATApplicable bool var p3VATApplicable bool
err = tx.QueryRow(ctx, `SELECT is_vat_applicable, vat_amount, net_amount FROM payments WHERE booking_id = $1 AND payment_method = 'cash' ORDER BY created_at DESC LIMIT 1`, bookingID).Scan(&p3VATApplicable, &p3VAT, &p3Net) err = tx.QueryRow(ctx, `SELECT is_vat_applicable, vat_amount, net_amount FROM payments WHERE id = $1`, phase3Resp.CheckoutID).Scan(&p3VATApplicable, &p3VAT, &p3Net)
if err != nil { if err != nil {
t.Fatalf("phase 3: failed to query latest payment: %v", err) t.Fatalf("phase 3: failed to query payment: %v", err)
} }
if !p3VATApplicable { if !p3VATApplicable {