From f95e18cc8055a3e53044a443706c7e9b57fbffbc Mon Sep 17 00:00:00 2001 From: Luca Guerra Date: Fri, 30 Aug 2024 07:16:38 +0000 Subject: [PATCH] fix(tests/legacy): relax json string requirement Signed-off-by: Luca Guerra --- tests/falco/legacy_test.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/tests/falco/legacy_test.go b/tests/falco/legacy_test.go index d01aaae..6007caa 100644 --- a/tests/falco/legacy_test.go +++ b/tests/falco/legacy_test.go @@ -41,6 +41,7 @@ import ( "context" "errors" "os" + "strings" "sync" "testing" "time" @@ -159,10 +160,16 @@ func TestFalco_Legacy_StdoutOutputJsonStrict(t *testing.T) { assert.Nil(t, err) scanner := bufio.NewScanner(bytes.NewReader(expectedContent)) scanner.Split(bufio.ScanLines) + var expectedJsonLines []string for scanner.Scan() { - assert.Contains(t, res.Stdout(), scanner.Text()) + expectedJsonLines = append(expectedJsonLines, scanner.Text()) } assert.Nil(t, scanner.Err()) + + outputLines := strings.Split(res.Stdout(), "\n") + for i, expectedLine := range expectedJsonLines { + require.JSONEq(t, expectedLine, outputLines[i]) + } } func TestFalco_Legacy_ListAppendFalse(t *testing.T) {