From 91cdb6c97a4800b6fde27163f32c0728d544dd59 Mon Sep 17 00:00:00 2001 From: Karsten Jeschkies Date: Tue, 14 Nov 2023 10:54:07 +0100 Subject: [PATCH] Ensure parsing a serialized LogQL AST results in the same AST. --- pkg/logql/syntax/parser_test.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pkg/logql/syntax/parser_test.go b/pkg/logql/syntax/parser_test.go index c0c39a7d8f137..b009162bdf6cf 100644 --- a/pkg/logql/syntax/parser_test.go +++ b/pkg/logql/syntax/parser_test.go @@ -3144,6 +3144,12 @@ func TestParse(t *testing.T) { ast, err := ParseExpr(tc.in) require.Equal(t, tc.err, err) require.Equal(t, tc.exp, ast) + + if err == nil { + roundtrip, err := ParseExpr(ast.String()) + require.NoError(t, err) + require.Equal(t, ast, roundtrip) + } }) } }