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

test: Add test with query status messages #152

Merged
merged 2 commits into from
Nov 11, 2024
Merged
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
23 changes: 23 additions & 0 deletions tests/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,29 @@ def test_step005_apl_query(self):

self.assertEqual(len(qr.matches), len(self.events))

def test_step005_apl_query_messages(self):
"""Test an APL query with messages"""
startTime = datetime.utcnow() - timedelta(minutes=2)
endTime = datetime.utcnow()

apl = "['%s'] | where true" % self.dataset_name
opts = AplOptions(
start_time=startTime,
end_time=endTime,
format=AplResultFormat.Legacy,
)
qr = self.client.query(apl, opts)
# "where clause always evaluates to TRUE, which will include all data"
self.assertEqual(len(qr.status.messages), 1)
self.assertEqual(
qr.status.messages[0].msg,
"line: 1, col: 24: where clause always evaluates to TRUE, which will include all data",
)
Copy link

@martijnthe martijnthe Nov 11, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm unfamiliar with your test set up / fixtures.
Does this query a "real" Axiom server?

Are you seeing the apl_whereclausealwaysevaluatestoTRUEwhichwillincludealldata_5 string in the response as the "code"? If not, maybe something changed in the backend/server? (see screenshot in my issue).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, this calls the real Axiom API. I've added an assert for the code as well.

self.assertEqual(
qr.status.messages[0].code,
"apl_whereclausealwaysevaluatestoTRUEwhichwillincludealldata_1",
)

def test_step005_apl_query_tabular(self):
"""Test apl query (tabular)"""
# query the events we ingested in step2
Expand Down