From 50cbf2dfe36823ccb19b36ca392d6b30de7cc68c Mon Sep 17 00:00:00 2001
From: Dmitry Rodionov <d.rodionov@picodata.io>
Date: Sat, 14 Dec 2024 01:04:26 +0300
Subject: [PATCH 1/5] test: increase timeout in test_restart_both

Close: https://git.picodata.io/core/picodata/-/issues/1032
---
 test/int/test_couple.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/test/int/test_couple.py b/test/int/test_couple.py
index 56928be131..9b0c38e09a 100644
--- a/test/int/test_couple.py
+++ b/test/int/test_couple.py
@@ -91,10 +91,10 @@ def test_restart_both(cluster2: Cluster):
     # This synchronization is necessary for proper test case reproducing.
     # i1 has already initialized raft node but can't win election yet
     # i2 starts discovery and should be able to advance further
-    Retriable(timeout=2, rps=10).call(check_alive, i1)
+    Retriable(timeout=10, rps=10).call(check_alive, i1)
 
     i2.start()
-    Retriable(timeout=2, rps=10).call(check_alive, i2)
+    Retriable(timeout=10, rps=10).call(check_alive, i2)
 
     # Speed up elections
     i2.promote_or_fail()
-- 
GitLab


From c7615a91748bff93152d065abd53d802af730e33 Mon Sep 17 00:00:00 2001
From: Dmitry Rodionov <d.rodionov@picodata.io>
Date: Sat, 14 Dec 2024 01:34:50 +0300
Subject: [PATCH 2/5] test: enlarge port range

---
 test/conftest.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/test/conftest.py b/test/conftest.py
index f4f4c25552..a443738cfd 100644
--- a/test/conftest.py
+++ b/test/conftest.py
@@ -49,7 +49,7 @@ from pathlib import Path
 # pub const INVALID_ID: u64 = 0;
 INVALID_RAFT_ID = 0
 BASE_HOST = "127.0.0.1"
-PORT_RANGE = 200
+PORT_RANGE = 400
 METRICS_PORT = 7500
 
 MAX_LOGIN_ATTEMPTS = 4
-- 
GitLab


From 84384b38878d4d7f33e30a6e423ed4986efdeddc Mon Sep 17 00:00:00 2001
From: Dmitry Rodionov <d.rodionov@picodata.io>
Date: Sat, 14 Dec 2024 01:38:52 +0300
Subject: [PATCH 3/5] test: back to large (default) timeout in
 test_gitlab_763_no_missing_buckets_after_proc_sharding_failure

---
 test/int/test_sharding.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/test/int/test_sharding.py b/test/int/test_sharding.py
index fb13ccd118..014874db58 100644
--- a/test/int/test_sharding.py
+++ b/test/int/test_sharding.py
@@ -293,7 +293,7 @@ def test_gitlab_763_no_missing_buckets_after_proc_sharding_failure(cluster: Clus
 
     # Instance cannot become online until vshard is reconfigured
     with pytest.raises(AssertionError):
-        i3.wait_online(timeout=2)
+        i3.wait_online()
 
     # Disable the synthetic failure so that instance can come online
     i1.call("pico._inject_error", "PROC_SHARDING_SPURIOUS_FAILURE", False)
-- 
GitLab


From 46b27d1e491ce602d8d1fd9969cd91b3c535656e Mon Sep 17 00:00:00 2001
From: Dmitry Rodionov <d.rodionov@picodata.io>
Date: Sat, 14 Dec 2024 01:50:10 +0300
Subject: [PATCH 4/5] test: retry query in test_user_can_read_from_query_cache
 to account for untimely rebalancing

---
 .../user_can_read_from_query_cache_test.py      | 17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)

diff --git a/test/pgproto/user_can_read_from_query_cache_test.py b/test/pgproto/user_can_read_from_query_cache_test.py
index bfb5a9b675..478a65653d 100644
--- a/test/pgproto/user_can_read_from_query_cache_test.py
+++ b/test/pgproto/user_can_read_from_query_cache_test.py
@@ -1,4 +1,4 @@
-from conftest import Postgres
+from conftest import Postgres, Retriable
 import psycopg
 
 
@@ -32,13 +32,18 @@ def test_user_can_read_from_query_cache(postgres: Postgres):
         """,
     )
 
-    # put this query in the query cache
-    cur = conn.execute(
-        """
+    def select_returns_inserted():
+        cur = conn.execute(
+            """
         SELECT * FROM "t";
         """,
-    )
-    assert sorted(cur.fetchall()) == [(1,), (2,)]
+        )
+        assert sorted(cur.fetchall()) == [(1,), (2,)]
+
+    # put this query in the query cache
+    # we have to retry because of vshard rebalancing problems
+    # see https://git.picodata.io/core/sbroad/-/issues/848
+    Retriable().call(select_returns_inserted)
 
     # get this query from the cache
     cur = conn.execute(
-- 
GitLab


From 43b6a935a9876de7c3bfd8eb24ea7b9d11bc40a2 Mon Sep 17 00:00:00 2001
From: Dmitry Rodionov <d.rodionov@picodata.io>
Date: Mon, 16 Dec 2024 12:19:50 +0300
Subject: [PATCH 5/5] test: mark test_large_snapshot xfail

It fails a lot in CI lately. There are several open tickets:

https://git.picodata.io/core/picodata/-/issues/779
https://git.picodata.io/core/picodata/-/issues/1204
---
 test/int/test_snapshot.py | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/test/int/test_snapshot.py b/test/int/test_snapshot.py
index b9ad807e7e..f73baca03a 100644
--- a/test/int/test_snapshot.py
+++ b/test/int/test_snapshot.py
@@ -1,5 +1,7 @@
 import time
 
+import pytest
+
 from conftest import Cluster, Retriable
 
 
@@ -66,6 +68,9 @@ def assert_eq(lhs, rhs):
     assert lhs == rhs
 
 
+@pytest.mark.xfail(
+    reason="flaky, see: https://git.picodata.io/core/picodata/-/issues/779"
+)
 def test_large_snapshot(cluster: Cluster):
     i1, i2, i3, i4 = cluster.deploy(instance_count=4)
 
-- 
GitLab