ktmud commented on code in PR #20799:
URL: https://github.com/apache/superset/pull/20799#discussion_r930445557
##########
tests/integration_tests/sqllab_tests.py:
##########
@@ -406,22 +407,19 @@ def test_search_query_on_text(self):
self.assertEqual(2, len(data))
self.assertIn("birth", data[0]["sql"])
- def test_search_query_on_time(self):
+ def test_search_query_filter_by_time(self):
self.run_some_queries()
self.login("admin")
first_query_time = (
db.session.query(Query).filter_by(sql=QUERY_1).one()
).start_time
second_query_time = (
- db.session.query(Query).filter_by(sql=QUERY_3).one()
+ db.session.query(Query).filter_by(sql=QUERY_2).one()
).start_time
- # Test search queries on time filter
- from_time = "from={}".format(int(first_query_time))
- to_time = "to={}".format(int(second_query_time))
Review Comment:
Bycatch: this test is flaky. `[QUERY_1, QUERY_2, QUERY_3]` are executed
consequently, with supposedly increasing `start_time`.
Since the original code `int(...)` basically rounded down the float epoch,
the actual query results returned `[QUERY_1, QUERY_2]`---even though we
filtered `second_query_time` by `QUERY_3`. But this still sometimes fail
because the rounded down time can be anywhere between QUERY_1 start time and
QUERY_3 start time, so if the start time for the queries are `[1.1, 1.5,
2]`---we'd filtered to between `[1, 1]` and return only `[QUERY_1]`.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]