Skip to content

Commit 4cad489

Browse files
committed
fix(ci): fix orphaned tests, frontend assertion, Trivy exit code
- Delete compute/helpers_test.go: all tested functions (startsWithAny, genUUIDv4, validateImportURL, NodeInfoFromEnv) were removed in V2 overhaul - Fix usage/service_test.go: update route expectations to match actual SetupRoutes (only GET /api/v1/usage/records), remove TestSeedDefaultTariffs referencing undefined Tariff type - Fix api.test.ts: withCredentials is now true per SEC-02 cookie auth - Fix Dockerfile.build: CGO_ENABLED=1 for sqlite test driver - Fix security-scan.yml: Trivy exit-code: 0 so SARIF is always generated even when vulnerabilities are found All tests pass locally: compute, network, storage, usage OK.
1 parent 0817cc7 commit 4cad489

5 files changed

Lines changed: 5 additions & 204 deletions

File tree

.github/workflows/security-scan.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ jobs:
4848
output: 'trivy-${{ matrix.target }}.sarif'
4949
severity: 'CRITICAL,HIGH'
5050
ignore-unfixed: true
51+
exit-code: '0'
5152

5253
- name: Upload Trivy scan results
5354
uses: github/codeql-action/upload-sarif@v3

Dockerfile.build

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ RUN go mod download
3333
# Copy source
3434
COPY . .
3535

36-
# Run Tests (skip ceph-tagged tests in CI for speed)
37-
RUN CGO_ENABLED=0 go test -short ./internal/management/storage/... ./internal/management/network/...
36+
# Run Tests (CGO_ENABLED=1 required for sqlite test driver)
37+
RUN CGO_ENABLED=1 go test -short -count=1 ./internal/management/network/... ./internal/management/storage/...
3838

3939
# Build binaries
4040
RUN mkdir -p bin && \

internal/compute/helpers_test.go

Lines changed: 0 additions & 179 deletions
This file was deleted.

internal/management/usage/service_test.go

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -47,32 +47,11 @@ func TestSetupRoutes(t *testing.T) {
4747
}
4848

4949
required := []string{
50-
"GET:/api/v1/usage",
51-
"GET:/api/v1/usage/summary",
52-
"GET:/api/v1/tariffs",
53-
"POST:/api/v1/tariffs",
54-
"PUT:/api/v1/tariffs/:id",
55-
"DELETE:/api/v1/tariffs/:id",
56-
"GET:/api/v1/billing/summary",
57-
"POST:/api/v1/billing/credit",
50+
"GET:/api/v1/usage/records",
5851
}
5952
for _, r := range required {
6053
if !paths[r] {
6154
t.Errorf("missing route: %s", r)
6255
}
6356
}
6457
}
65-
66-
func TestSeedDefaultTariffs(t *testing.T) {
67-
db := testDB(t)
68-
l, _ := zap.NewDevelopment()
69-
svc, _ := NewService(Config{DB: db, Logger: l})
70-
71-
// seedDefaultTariffs is called during NewService.
72-
// Verify tariffs were created.
73-
var count int64
74-
svc.db.Model(&Tariff{}).Count(&count)
75-
if count == 0 {
76-
t.Error("seedDefaultTariffs did not create any tariffs")
77-
}
78-
}

web/console/src/__tests__/api.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,6 @@ describe('api interceptors', () => {
2626
it('exports default api instance', async () => {
2727
const { default: api } = await import('@/lib/api')
2828
expect(api).toBeDefined()
29-
expect(api.defaults.withCredentials).toBe(false)
29+
expect(api.defaults.withCredentials).toBe(true)
3030
})
3131
})

0 commit comments

Comments
 (0)