From 22f32e060bfe5b5720c5e1b3a2ddce4c5c14537b Mon Sep 17 00:00:00 2001 From: Daniel Hougaard Date: Sun, 1 Jun 2025 21:31:26 +0400 Subject: [PATCH] filter out random request ID value --- .../test-TestUniversalAuth_SecretsGetWrongEnvironment | 2 +- cli/test/helper.go | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/cli/test/.snapshots/test-TestUniversalAuth_SecretsGetWrongEnvironment b/cli/test/.snapshots/test-TestUniversalAuth_SecretsGetWrongEnvironment index 71b8da00c..6047b33e0 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=] [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 21bd261df..74e56237a 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=]") + input = reqIDPattern.ReplaceAllString(input, "[reqId=]") + start := strings.Index(input, "{") end := strings.LastIndex(input, "}") + 1