chore: Refactor test setup for Gin framework
- Removed redundant `gin.SetMode(gin.TestMode)` calls from individual test files. - Introduced a centralized `TestMain` function in `testmain_test.go` to set the Gin mode for all tests. - Ensured consistent test environment setup across various handler test files.
This commit is contained in:
@@ -203,7 +203,7 @@ func (h *CrowdsecHandler) fetchActiveDecisionCount(ctx context.Context) int64 {
|
||||
}
|
||||
}
|
||||
|
||||
baseURL, err := validateCrowdsecLAPIBaseURL(lapiURL)
|
||||
baseURL, err := h.resolveLAPIURLValidator(lapiURL)
|
||||
if err != nil {
|
||||
return -1
|
||||
}
|
||||
@@ -476,7 +476,7 @@ func (h *CrowdsecHandler) fetchLAPIAlerts(ctx context.Context, since time.Time,
|
||||
}
|
||||
}
|
||||
|
||||
baseURL, err := validateCrowdsecLAPIBaseURL(lapiURL)
|
||||
baseURL, err := h.resolveLAPIURLValidator(lapiURL)
|
||||
if err != nil {
|
||||
return h.fetchAlertsCscli(ctx, scenario, limit)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user