Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to latest gocommon which changes contactql conversion to ES #1275

Merged
merged 1 commit into from
Jul 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 18 additions & 2 deletions contactql/es/query_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ func TestElasticQuery(t *testing.T) {

ny, _ := time.LoadLocation("America/New_York")

for _, tc := range tcs {
for i, tc := range tcs {
testName := fmt.Sprintf("test '%s' for query '%s'", tc.Description, tc.Query)

redactionPolicy := envs.RedactionPolicyNone
Expand All @@ -99,6 +99,22 @@ func TestElasticQuery(t *testing.T) {
asJSON, err := jsonx.Marshal(query)
require.NoError(t, err)

test.AssertEqualJSON(t, tc.Elastic, asJSON, "elastic mismatch in %s", testName)
// clone test case and populate with actual values
actual := tc
actual.Elastic = asJSON

if !test.UpdateSnapshots {
test.AssertEqualJSON(t, tc.Elastic, actual.Elastic, "elastic mismatch in %s", testName)
} else {
tcs[i] = actual
}
}

if test.UpdateSnapshots {
actualJSON, err := jsonx.MarshalPretty(tcs)
require.NoError(t, err)

err = os.WriteFile("testdata/to_query.json", actualJSON, 0666)
require.NoError(t, err)
}
}
Loading
Loading