From 508a9b1dc5a06bbb43b1fefcc2c44607d9b0f125 Mon Sep 17 00:00:00 2001 From: Linchin Date: Wed, 10 Jan 2024 19:40:53 +0000 Subject: [PATCH 01/13] test: change compliance test rerun condition regex string --- README.rst | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.rst b/README.rst index 17534886..860f1289 100644 --- a/README.rst +++ b/README.rst @@ -362,3 +362,6 @@ In multiprocessing scenarios, the best practice is to create client instances *after* the invocation of `os.fork` by `multiprocessing.pool.Pool` or `multiprocessing.Process`. + + +this PR is created to investigate flaky bot failure. \ No newline at end of file From f681cc846869f49b5c108833278b45949c4aa6a1 Mon Sep 17 00:00:00 2001 From: Linchin Date: Wed, 10 Jan 2024 23:42:41 +0000 Subject: [PATCH 02/13] try sys test --- tests/system/test_alembic.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/system/test_alembic.py b/tests/system/test_alembic.py index 30308c68..55c82383 100644 --- a/tests/system/test_alembic.py +++ b/tests/system/test_alembic.py @@ -127,6 +127,8 @@ def test_alembic_scenario(alembic_table): op.drop_table("account_w_comment") assert alembic_table("account_w_comment") is None + #time.sleep(10) + op.rename_table("account", "accounts") assert alembic_table("account") is None assert alembic_table("accounts", "schema") == [ From eb69f56456125956962d0d630537810bdf107f99 Mon Sep 17 00:00:00 2001 From: Linchin Date: Thu, 11 Jan 2024 00:05:26 +0000 Subject: [PATCH 03/13] add sleep to time --- tests/system/test_alembic.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/system/test_alembic.py b/tests/system/test_alembic.py index 55c82383..97ad23bc 100644 --- a/tests/system/test_alembic.py +++ b/tests/system/test_alembic.py @@ -21,6 +21,7 @@ import pytest from sqlalchemy import Column, DateTime, Integer, String, Numeric +import time import google.api_core.exceptions from google.cloud.bigquery import SchemaField, TimePartitioning @@ -127,7 +128,7 @@ def test_alembic_scenario(alembic_table): op.drop_table("account_w_comment") assert alembic_table("account_w_comment") is None - #time.sleep(10) + time.sleep(10) op.rename_table("account", "accounts") assert alembic_table("account") is None From cbca4671b1332aeb7e94f7fb0f73a5df2740b838 Mon Sep 17 00:00:00 2001 From: Linchin Date: Thu, 11 Jan 2024 19:38:54 +0000 Subject: [PATCH 04/13] change exceed rate limit code to 400 --- noxfile.py | 1 + 1 file changed, 1 insertion(+) diff --git a/noxfile.py b/noxfile.py index e31f32c5..8d74a800 100644 --- a/noxfile.py +++ b/noxfile.py @@ -398,6 +398,7 @@ def compliance(session): "--only-rerun=409 Already Exists", "--only-rerun=404 Not found", "--only-rerun=400 Cannot execute DML over a non-existent table", + "--only-rerun=400 Exceeded rate limits", system_test_folder_path, *session.posargs, # To suppress the "Deprecated API features detected!" warning when From b661144af1c1cc4fbc6dc82a0ea79bcfe8708521 Mon Sep 17 00:00:00 2001 From: Linchin Date: Thu, 11 Jan 2024 20:31:36 +0000 Subject: [PATCH 05/13] change rerun condition format --- noxfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/noxfile.py b/noxfile.py index 8d74a800..dfb6e4da 100644 --- a/noxfile.py +++ b/noxfile.py @@ -398,7 +398,7 @@ def compliance(session): "--only-rerun=409 Already Exists", "--only-rerun=404 Not found", "--only-rerun=400 Cannot execute DML over a non-existent table", - "--only-rerun=400 Exceeded rate limits", + "--only-rerun=Job exceeded rate limits", system_test_folder_path, *session.posargs, # To suppress the "Deprecated API features detected!" warning when From 4d8ec6a6c2e97d80ae35a3e52a93d132e5c76385 Mon Sep 17 00:00:00 2001 From: Linchin Date: Thu, 11 Jan 2024 20:45:57 +0000 Subject: [PATCH 06/13] delete compliance tests to make it faster --- noxfile.py | 2 +- .../test_dialect_compliance.py | 56 ++++++++++++------- 2 files changed, 36 insertions(+), 22 deletions(-) diff --git a/noxfile.py b/noxfile.py index dfb6e4da..6aaf04f0 100644 --- a/noxfile.py +++ b/noxfile.py @@ -398,7 +398,7 @@ def compliance(session): "--only-rerun=409 Already Exists", "--only-rerun=404 Not found", "--only-rerun=400 Cannot execute DML over a non-existent table", - "--only-rerun=Job exceeded rate limits", + # "--only-rerun=Job exceeded rate limits", system_test_folder_path, *session.posargs, # To suppress the "Deprecated API features detected!" warning when diff --git a/tests/sqlalchemy_dialect_compliance/test_dialect_compliance.py b/tests/sqlalchemy_dialect_compliance/test_dialect_compliance.py index a79f2818..ce4f3885 100644 --- a/tests/sqlalchemy_dialect_compliance/test_dialect_compliance.py +++ b/tests/sqlalchemy_dialect_compliance/test_dialect_compliance.py @@ -53,35 +53,36 @@ def test_simple_offset(self): test_bound_offset = test_simple_offset - class TimestampMicrosecondsTest(_TimestampMicrosecondsTest): - data = datetime.datetime(2012, 10, 15, 12, 57, 18, 396, tzinfo=pytz.UTC) + """ + class TimestampMicrosecondsTest(_TimestampMicrosecondsTest): + data = datetime.datetime(2012, 10, 15, 12, 57, 18, 396, tzinfo=pytz.UTC) - def test_literal(self): - # The base tests doesn't set up the literal properly, because - # it doesn't pass its datatype to `literal`. + def test_literal(self): + # The base tests doesn't set up the literal properly, because + # it doesn't pass its datatype to `literal`. - def literal(value): - assert value == self.data - return sqlalchemy.sql.elements.literal(value, self.datatype) + def literal(value): + assert value == self.data + return sqlalchemy.sql.elements.literal(value, self.datatype) - with mock.patch("sqlalchemy.testing.suite.test_types.literal", literal): - super(TimestampMicrosecondsTest, self).test_literal() + with mock.patch("sqlalchemy.testing.suite.test_types.literal", literal): + super(TimestampMicrosecondsTest, self).test_literal() - def test_select_direct(self, connection): - # This func added because this test was failing when passed the - # UTC timezone. + def test_select_direct(self, connection): + # This func added because this test was failing when passed the + # UTC timezone. - def literal(value, type_=None): - assert value == self.data + def literal(value, type_=None): + assert value == self.data - if type_ is not None: - assert type_ is self.datatype + if type_ is not None: + assert type_ is self.datatype - return sqlalchemy.sql.elements.literal(value, self.datatype) - - with mock.patch("sqlalchemy.testing.suite.test_types.literal", literal): - super(TimestampMicrosecondsTest, self).test_select_direct(connection) + return sqlalchemy.sql.elements.literal(value, self.datatype) + with mock.patch("sqlalchemy.testing.suite.test_types.literal", literal): + super(TimestampMicrosecondsTest, self).test_select_direct(connection) + """ else: from sqlalchemy.testing.suite import ( FetchLimitOffsetTest as _FetchLimitOffsetTest, @@ -117,10 +118,21 @@ def test_limit_render_multiple_times(self, connection): del HasIndexTest # BQ doesn't do the indexes that SQLA is loooking for. del IdentityAutoincrementTest # BQ doesn't do autoincrement + # detele to make test faster + del JSONTest + del LikeFunctionsTest + del FutureTableDDLTest + del NumericTest + del StringTest + del TableDDLTest + del TextTest + del UnicodeVarcharTest + # This test makes makes assertions about generated sql and trips # over the backquotes that we add everywhere. XXX Why do we do that? del PostCompileParamsTest + """ class TimestampMicrosecondsTest(_TimestampMicrosecondsTest): data = datetime.datetime(2012, 10, 15, 12, 57, 18, 396, tzinfo=pytz.UTC) @@ -155,6 +167,8 @@ def literal(value, type_=None): with mock.patch("sqlalchemy.testing.suite.test_types.literal", literal): super(TimestampMicrosecondsTest, self).test_select_direct(connection) +""" + def test_round_trip_executemany(self, connection): unicode_table = self.tables.unicode_table connection.execute( From bf470703d8f2b5abf1927b92ad129316f9dbfabc Mon Sep 17 00:00:00 2001 From: Linchin Date: Thu, 11 Jan 2024 21:02:50 +0000 Subject: [PATCH 07/13] stop on first fail --- noxfile.py | 1 + 1 file changed, 1 insertion(+) diff --git a/noxfile.py b/noxfile.py index 6aaf04f0..07490f89 100644 --- a/noxfile.py +++ b/noxfile.py @@ -390,6 +390,7 @@ def compliance(session): session.run( "py.test", + "-x", "-vv", f"--junitxml=compliance_{session.python}_sponge_log.xml", "--reruns=3", From f8a291bdf371bc636439c4e49450cde6fa5f602e Mon Sep 17 00:00:00 2001 From: Linchin Date: Thu, 11 Jan 2024 21:11:48 +0000 Subject: [PATCH 08/13] add rerun condition --- noxfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/noxfile.py b/noxfile.py index 07490f89..c5a69578 100644 --- a/noxfile.py +++ b/noxfile.py @@ -399,7 +399,7 @@ def compliance(session): "--only-rerun=409 Already Exists", "--only-rerun=404 Not found", "--only-rerun=400 Cannot execute DML over a non-existent table", - # "--only-rerun=Job exceeded rate limits", + "--only-rerun=Job exceeded rate limits", system_test_folder_path, *session.posargs, # To suppress the "Deprecated API features detected!" warning when From a22b08151fe8032d2e37cb39cd8b0198fe3f64a0 Mon Sep 17 00:00:00 2001 From: Linchin Date: Thu, 11 Jan 2024 21:25:52 +0000 Subject: [PATCH 09/13] change rerun condition format --- noxfile.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/noxfile.py b/noxfile.py index c5a69578..853ab203 100644 --- a/noxfile.py +++ b/noxfile.py @@ -395,10 +395,10 @@ def compliance(session): f"--junitxml=compliance_{session.python}_sponge_log.xml", "--reruns=3", "--reruns-delay=60", - "--only-rerun=403 Exceeded rate limits", - "--only-rerun=409 Already Exists", - "--only-rerun=404 Not found", - "--only-rerun=400 Cannot execute DML over a non-existent table", + "--only-rerun=Exceeded rate limits", + "--only-rerun=Already Exists", + "--only-rerun=Not found", + "--only-rerun=Cannot execute DML over a non-existent table", "--only-rerun=Job exceeded rate limits", system_test_folder_path, *session.posargs, From 355006e0486b3ab3f20d03d43242cfbf1b9e1f33 Mon Sep 17 00:00:00 2001 From: Linchin Date: Thu, 11 Jan 2024 23:25:18 +0000 Subject: [PATCH 10/13] add back the deleted tests --- .../test_dialect_compliance.py | 48 +++++++++---------- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/tests/sqlalchemy_dialect_compliance/test_dialect_compliance.py b/tests/sqlalchemy_dialect_compliance/test_dialect_compliance.py index ce4f3885..5e31cb56 100644 --- a/tests/sqlalchemy_dialect_compliance/test_dialect_compliance.py +++ b/tests/sqlalchemy_dialect_compliance/test_dialect_compliance.py @@ -53,36 +53,36 @@ def test_simple_offset(self): test_bound_offset = test_simple_offset - """ - class TimestampMicrosecondsTest(_TimestampMicrosecondsTest): - data = datetime.datetime(2012, 10, 15, 12, 57, 18, 396, tzinfo=pytz.UTC) - def test_literal(self): - # The base tests doesn't set up the literal properly, because - # it doesn't pass its datatype to `literal`. + class TimestampMicrosecondsTest(_TimestampMicrosecondsTest): + data = datetime.datetime(2012, 10, 15, 12, 57, 18, 396, tzinfo=pytz.UTC) + + def test_literal(self): + # The base tests doesn't set up the literal properly, because + # it doesn't pass its datatype to `literal`. + + def literal(value): + assert value == self.data + return sqlalchemy.sql.elements.literal(value, self.datatype) - def literal(value): - assert value == self.data - return sqlalchemy.sql.elements.literal(value, self.datatype) + with mock.patch("sqlalchemy.testing.suite.test_types.literal", literal): + super(TimestampMicrosecondsTest, self).test_literal() - with mock.patch("sqlalchemy.testing.suite.test_types.literal", literal): - super(TimestampMicrosecondsTest, self).test_literal() + def test_select_direct(self, connection): + # This func added because this test was failing when passed the + # UTC timezone. - def test_select_direct(self, connection): - # This func added because this test was failing when passed the - # UTC timezone. + def literal(value, type_=None): + assert value == self.data - def literal(value, type_=None): - assert value == self.data + if type_ is not None: + assert type_ is self.datatype - if type_ is not None: - assert type_ is self.datatype + return sqlalchemy.sql.elements.literal(value, self.datatype) - return sqlalchemy.sql.elements.literal(value, self.datatype) + with mock.patch("sqlalchemy.testing.suite.test_types.literal", literal): + super(TimestampMicrosecondsTest, self).test_select_direct(connection) - with mock.patch("sqlalchemy.testing.suite.test_types.literal", literal): - super(TimestampMicrosecondsTest, self).test_select_direct(connection) - """ else: from sqlalchemy.testing.suite import ( FetchLimitOffsetTest as _FetchLimitOffsetTest, @@ -118,6 +118,7 @@ def test_limit_render_multiple_times(self, connection): del HasIndexTest # BQ doesn't do the indexes that SQLA is loooking for. del IdentityAutoincrementTest # BQ doesn't do autoincrement + """ # detele to make test faster del JSONTest del LikeFunctionsTest @@ -127,12 +128,12 @@ def test_limit_render_multiple_times(self, connection): del TableDDLTest del TextTest del UnicodeVarcharTest + """ # This test makes makes assertions about generated sql and trips # over the backquotes that we add everywhere. XXX Why do we do that? del PostCompileParamsTest - """ class TimestampMicrosecondsTest(_TimestampMicrosecondsTest): data = datetime.datetime(2012, 10, 15, 12, 57, 18, 396, tzinfo=pytz.UTC) @@ -167,7 +168,6 @@ def literal(value, type_=None): with mock.patch("sqlalchemy.testing.suite.test_types.literal", literal): super(TimestampMicrosecondsTest, self).test_select_direct(connection) -""" def test_round_trip_executemany(self, connection): unicode_table = self.tables.unicode_table From 8953e3bfcde0c42e988937b4a454af9a7d5a8779 Mon Sep 17 00:00:00 2001 From: Linchin Date: Fri, 12 Jan 2024 01:09:28 +0000 Subject: [PATCH 11/13] remove investigation changes and add owlbot change --- README.rst | 5 +---- noxfile.py | 1 - owlbot.py | 9 +++++---- .../test_dialect_compliance.py | 13 ------------- tests/system/test_alembic.py | 3 --- 5 files changed, 6 insertions(+), 25 deletions(-) diff --git a/README.rst b/README.rst index 860f1289..4e120d29 100644 --- a/README.rst +++ b/README.rst @@ -361,7 +361,4 @@ share instances across threads. In multiprocessing scenarios, the best practice is to create client instances *after* the invocation of `os.fork` by `multiprocessing.pool.Pool` or -`multiprocessing.Process`. - - -this PR is created to investigate flaky bot failure. \ No newline at end of file +`multiprocessing.Process`. \ No newline at end of file diff --git a/noxfile.py b/noxfile.py index 853ab203..82fa27d5 100644 --- a/noxfile.py +++ b/noxfile.py @@ -390,7 +390,6 @@ def compliance(session): session.run( "py.test", - "-x", "-vv", f"--junitxml=compliance_{session.python}_sponge_log.xml", "--reruns=3", diff --git a/owlbot.py b/owlbot.py index 22678c8b..8c3ce732 100644 --- a/owlbot.py +++ b/owlbot.py @@ -188,10 +188,11 @@ def compliance(session): f"--junitxml=compliance_{session.python}_sponge_log.xml", "--reruns=3", "--reruns-delay=60", - "--only-rerun=403 Exceeded rate limits", - "--only-rerun=409 Already Exists", - "--only-rerun=404 Not found", - "--only-rerun=400 Cannot execute DML over a non-existent table", + "--only-rerun=Exceeded rate limits", + "--only-rerun=Already Exists", + "--only-rerun=Not found", + "--only-rerun=Cannot execute DML over a non-existent table", + "--only-rerun=Job exceeded rate limits", system_test_folder_path, *session.posargs, # To suppress the "Deprecated API features detected!" warning when diff --git a/tests/sqlalchemy_dialect_compliance/test_dialect_compliance.py b/tests/sqlalchemy_dialect_compliance/test_dialect_compliance.py index 5e31cb56..9662dd08 100644 --- a/tests/sqlalchemy_dialect_compliance/test_dialect_compliance.py +++ b/tests/sqlalchemy_dialect_compliance/test_dialect_compliance.py @@ -118,18 +118,6 @@ def test_limit_render_multiple_times(self, connection): del HasIndexTest # BQ doesn't do the indexes that SQLA is loooking for. del IdentityAutoincrementTest # BQ doesn't do autoincrement - """ - # detele to make test faster - del JSONTest - del LikeFunctionsTest - del FutureTableDDLTest - del NumericTest - del StringTest - del TableDDLTest - del TextTest - del UnicodeVarcharTest - """ - # This test makes makes assertions about generated sql and trips # over the backquotes that we add everywhere. XXX Why do we do that? del PostCompileParamsTest @@ -168,7 +156,6 @@ def literal(value, type_=None): with mock.patch("sqlalchemy.testing.suite.test_types.literal", literal): super(TimestampMicrosecondsTest, self).test_select_direct(connection) - def test_round_trip_executemany(self, connection): unicode_table = self.tables.unicode_table connection.execute( diff --git a/tests/system/test_alembic.py b/tests/system/test_alembic.py index 97ad23bc..30308c68 100644 --- a/tests/system/test_alembic.py +++ b/tests/system/test_alembic.py @@ -21,7 +21,6 @@ import pytest from sqlalchemy import Column, DateTime, Integer, String, Numeric -import time import google.api_core.exceptions from google.cloud.bigquery import SchemaField, TimePartitioning @@ -128,8 +127,6 @@ def test_alembic_scenario(alembic_table): op.drop_table("account_w_comment") assert alembic_table("account_w_comment") is None - time.sleep(10) - op.rename_table("account", "accounts") assert alembic_table("account") is None assert alembic_table("accounts", "schema") == [ From 49f1ae076ef0c0798c3deaa3ff1d07e33e00ad5d Mon Sep 17 00:00:00 2001 From: Linchin Date: Fri, 12 Jan 2024 01:09:56 +0000 Subject: [PATCH 12/13] black --- tests/sqlalchemy_dialect_compliance/test_dialect_compliance.py | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/sqlalchemy_dialect_compliance/test_dialect_compliance.py b/tests/sqlalchemy_dialect_compliance/test_dialect_compliance.py index 9662dd08..a79f2818 100644 --- a/tests/sqlalchemy_dialect_compliance/test_dialect_compliance.py +++ b/tests/sqlalchemy_dialect_compliance/test_dialect_compliance.py @@ -53,7 +53,6 @@ def test_simple_offset(self): test_bound_offset = test_simple_offset - class TimestampMicrosecondsTest(_TimestampMicrosecondsTest): data = datetime.datetime(2012, 10, 15, 12, 57, 18, 396, tzinfo=pytz.UTC) From ffc876be70a5a08e990da2001c395929a71b7858 Mon Sep 17 00:00:00 2001 From: Linchin Date: Fri, 12 Jan 2024 02:44:07 +0000 Subject: [PATCH 13/13] revert README --- README.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.rst b/README.rst index 4e120d29..17534886 100644 --- a/README.rst +++ b/README.rst @@ -361,4 +361,4 @@ share instances across threads. In multiprocessing scenarios, the best practice is to create client instances *after* the invocation of `os.fork` by `multiprocessing.pool.Pool` or -`multiprocessing.Process`. \ No newline at end of file +`multiprocessing.Process`.