Skip to content

Commit

Permalink
Merge pull request #152 from axiomhq/arne/test-messages
Browse files Browse the repository at this point in the history
test: Add test with query status messages
  • Loading branch information
darach authored Nov 11, 2024
2 parents c9ec206 + b702c4a commit 9c53168
Showing 1 changed file with 23 additions and 0 deletions.
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",
)
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

0 comments on commit 9c53168

Please sign in to comment.