Skip to content

Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.

filter out random request ID value

Daniel Hougaard22f32e060bfe
diff --git a/cli/test/.snapshots/test-TestUniversalAuth_SecretsGetWrongEnvironment b/cli/test/.snapshots/test-TestUniversalAuth_SecretsGetWrongEnvironment
index 71b8da00c2..6047b33e00 100644
--- a/cli/test/.snapshots/test-TestUniversalAuth_SecretsGetWrongEnvironment
+++ b/cli/test/.snapshots/test-TestUniversalAuth_SecretsGetWrongEnvironment
@@ -1,4 +1,4 @@
-error: CallGetRawSecretsV3 Unsuccessful response [GET https://app.infisical.com/api/v3/secrets/raw?environment=invalid-env&expandSecretReferences=true&include_imports=true&recursive=true&secretPath=%2F&workspaceId=bef697d4-849b-4a75-b284-0922f87f8ba2] [status-code=404] [request-id=req-vp69RebVGgAs83] [message="Environment with slug 'invalid-env' in project with ID bef697d4-849b-4a75-b284-0922f87f8ba2 not found"]
+error: CallGetRawSecretsV3 Unsuccessful response [GET https://app.infisical.com/api/v3/secrets/raw?environment=invalid-env&expandSecretReferences=true&include_imports=true&recursive=true&secretPath=%2F&workspaceId=bef697d4-849b-4a75-b284-0922f87f8ba2] [status-code=404] [request-id=<unknown-value>] [message="Environment with slug 'invalid-env' in project with ID bef697d4-849b-4a75-b284-0922f87f8ba2 not found"]
If this issue continues, get support at https://infisical.com/slack
diff --git a/cli/test/helper.go b/cli/test/helper.go
index 21bd261df8..74e56237a8 100644
--- a/cli/test/helper.go
+++ b/cli/test/helper.go
@@ -6,6 +6,7 @@ import (
"log"
"os"
"os/exec"
+ "regexp"
"strings"
)
@@ -71,7 +72,11 @@ func SetupCli() {
}
func FilterRequestID(input string) string {
- // Find the JSON part of the error message
+ requestIDPattern := regexp.MustCompile(`\[request-id=[^\]]+\]`)
+ reqIDPattern := regexp.MustCompile(`\[reqId=[^\]]+\]`)
+ input = requestIDPattern.ReplaceAllString(input, "[request-id=<unknown-value>]")
+ input = reqIDPattern.ReplaceAllString(input, "[reqId=<unknown-value>]")
+
start := strings.Index(input, "{")
end := strings.LastIndex(input, "}") + 1