+
+TEST_F(DatabaseConfigurationImplTest, CanReturnSDLClusterAddress)
+{
+ databaseConfigurationImpl->checkAndApplyDbType("sdl-cluster");
+ databaseConfigurationImpl->checkAndApplyServerAddress("cluster-0.local");
+ databaseConfigurationImpl->checkAndApplyServerAddress("cluster-1.local");
+ databaseConfigurationImpl->checkAndApplyServerAddress("cluster-2.local");
+ databaseConfigurationImpl->checkAndApplySentinelAddress("cluster-0.local:54321");
+ auto address0 = databaseConfigurationImpl->getSentinelAddress(0);
+ auto address1 = databaseConfigurationImpl->getSentinelAddress(1);
+ auto address2 = databaseConfigurationImpl->getSentinelAddress(2);
+ EXPECT_NE(boost::none, databaseConfigurationImpl->getSentinelAddress(0));
+ EXPECT_NE(boost::none, databaseConfigurationImpl->getSentinelAddress(1));
+ EXPECT_NE(boost::none, databaseConfigurationImpl->getSentinelAddress(2));
+ EXPECT_EQ("cluster-0.local", address0->getHost());
+ EXPECT_EQ("cluster-1.local", address1->getHost());
+ EXPECT_EQ("cluster-2.local", address2->getHost());
+ EXPECT_EQ(54321, ntohs(address0->getPort()));
+}
+
+TEST_F(DatabaseConfigurationImplTest, CanReturnDefaultPortForSDLClusterAddress)
+{
+ databaseConfigurationImpl->checkAndApplyServerAddress("cluster-0.local");
+ databaseConfigurationImpl->checkAndApplySentinelAddress("cluster-0.local");
+ auto address0 = databaseConfigurationImpl->getSentinelAddress(0);
+ EXPECT_NE(boost::none, databaseConfigurationImpl->getSentinelAddress(0));
+ EXPECT_EQ("cluster-0.local", address0->getHost());
+ EXPECT_EQ(26379, ntohs(address0->getPort()));
+}