From d056c72212d8b1a2a9af8f430a6eb3d880b84da5 Mon Sep 17 00:00:00 2001 From: Sergey Kuznetsov Date: Tue, 12 May 2026 13:49:39 +0100 Subject: [PATCH] test: Fix integration tests (#3072) Fix 2 issues in integration tests: - `127.0.0.2` is forwarded to localhost on macos - Keyspace is always dropped in test's destructor but it may not exist --- tests/integration/data/BackendFactoryTests.cpp | 4 ++-- tests/integration/data/cassandra/BaseTests.cpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/integration/data/BackendFactoryTests.cpp b/tests/integration/data/BackendFactoryTests.cpp index 709f95b7d..1471f8806 100644 --- a/tests/integration/data/BackendFactoryTests.cpp +++ b/tests/integration/data/BackendFactoryTests.cpp @@ -81,7 +81,7 @@ public: // drop the keyspace for next test data::cassandra::Handle const handle{TestGlobals::instance().backendHost}; EXPECT_TRUE(handle.connect()); - EXPECT_TRUE(handle.execute("DROP KEYSPACE " + std::string{kKEYSPACE})); + EXPECT_TRUE(handle.execute("DROP KEYSPACE IF EXISTS " + std::string{kKEYSPACE})); } }; @@ -98,7 +98,7 @@ TEST_F(BackendCassandraFactoryTest, CreateCassandraBackendDBDisconnect) {"database": { "type": "cassandra", "cassandra": { - "contact_points": "127.0.0.2" + "contact_points": "128.0.2.1" } }} )JSON"); diff --git a/tests/integration/data/cassandra/BaseTests.cpp b/tests/integration/data/cassandra/BaseTests.cpp index 80c5f7493..af0b6a419 100644 --- a/tests/integration/data/cassandra/BaseTests.cpp +++ b/tests/integration/data/cassandra/BaseTests.cpp @@ -111,7 +111,7 @@ TEST_F(BackendCassandraBaseTest, ConnectionFailTimeout) Settings settings; settings.connectionTimeout = std::chrono::milliseconds{30}; settings.connectionInfo = - Settings::ContactPoints{.contactPoints = "127.0.0.2", .port = std::nullopt}; + Settings::ContactPoints{.contactPoints = "128.0.2.1", .port = std::nullopt}; Handle const handle{settings}; auto const f = handle.asyncConnect();