Skip to content
This repository was archived by the owner on Apr 1, 2026. It is now read-only.

Commit 411d081

Browse files
committed
fix test
1 parent aa3622d commit 411d081

File tree

3 files changed

+10
-9
lines changed

3 files changed

+10
-9
lines changed

bigframes/streaming/dataframe.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -126,8 +126,7 @@ def to_bigtable(
126126
job_id_prefix parameter of
127127
https://cloud.google.com/python/docs/reference/bigquery/latest/google.cloud.bigquery.client.Client#google_cloud_bigquery_client_Client_query
128128
start_timestamp (int, float, str, datetime, date, default None):
129-
The start timestamp of the query. Possible values should be within the recent 7 days. If None, will start from the max value, 7 days ago. If pass in time zone naive values, use UTC time zone.
130-
129+
The starting timestamp for the query. Possible values are to 7 days in the past. If don't specify a timestamp (None), the query will default to the earliest possible time, 7 days ago. If provide a time-zone-naive timestamp, it will be treated as UTC.
131130
Returns:
132131
google.cloud.bigquery.QueryJob:
133132
See https://cloud.google.com/python/docs/reference/bigquery/latest/google.cloud.bigquery.job.QueryJob
@@ -193,7 +192,7 @@ def to_pubsub(
193192
job_id_prefix parameter of
194193
https://cloud.google.com/python/docs/reference/bigquery/latest/google.cloud.bigquery.client.Client#google_cloud_bigquery_client_Client_query
195194
start_timestamp (int, float, str, datetime, date, default None):
196-
The start timestamp of the query. Possible values should be within the recent 7 days. If None, will start from the max value, 7 days ago. If pass in time zone naive values, use UTC time zone.
195+
The starting timestamp for the query. Possible values are to 7 days in the past. If don't specify a timestamp (None), the query will default to the earliest possible time, 7 days ago. If provide a time-zone-naive timestamp, it will be treated as UTC.
197196
198197
Returns:
199198
google.cloud.bigquery.QueryJob:
@@ -318,7 +317,7 @@ def _appends_sql(
318317

319318
# TODO(b/405691193): set start time back to NULL. Now set it slightly after 7 days max interval to avoid the bug.
320319
start_ts_str = (
321-
str(pd.to_datetime(start_timestamp))
320+
str(f"TIMESTAMP('{pd.to_datetime(start_timestamp)}')")
322321
if start_timestamp
323322
else "CURRENT_TIMESTAMP() - (INTERVAL 7 DAY - INTERVAL 5 MINUTE)"
324323
)

tests/system/large/streaming/test_bigtable.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ def bigtable_table(
6868
bt_table.delete()
6969

7070

71-
# @pytest.mark.flaky(retries=3, delay=10)
71+
@pytest.mark.flaky(retries=3, delay=10)
7272
def test_streaming_df_to_bigtable(
7373
session_load: bigframes.Session, bigtable_table: table.Table
7474
):
@@ -95,9 +95,9 @@ def test_streaming_df_to_bigtable(
9595
start_timestamp=datetime.now() - timedelta(days=1),
9696
)
9797

98-
# wait 100 seconds in order to ensure the query doesn't stop
98+
# wait 200 seconds in order to ensure the query doesn't stop
9999
# (i.e. it is continuous)
100-
time.sleep(100)
100+
time.sleep(200)
101101
assert query_job.running()
102102
assert query_job.error_result is None
103103
assert str(query_job.job_id).startswith(job_id_prefix)

tests/system/large/streaming/test_pubsub.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
# limitations under the License.
1414

1515
from concurrent import futures
16+
from datetime import datetime, timedelta
1617
from typing import Generator
1718
import uuid
1819

@@ -99,11 +100,12 @@ def callback(message):
99100
service_account_email="streaming-testing@bigframes-load-testing.iam.gserviceaccount.com",
100101
job_id=None,
101102
job_id_prefix=job_id_prefix,
103+
start_timestamp=datetime.now() - timedelta(days=1),
102104
)
103105
try:
104-
# wait 100 seconds in order to ensure the query doesn't stop
106+
# wait 200 seconds in order to ensure the query doesn't stop
105107
# (i.e. it is continuous)
106-
future.result(timeout=100)
108+
future.result(timeout=200)
107109
except futures.TimeoutError:
108110
future.cancel()
109111
assert query_job.running()

0 commit comments

Comments
 (0)