+ databaseConfigurationImpl->checkAndApplySentinelMasterNames("mymaster");
+ EXPECT_EQ("mymaster", databaseConfigurationImpl->getSentinelMasterName(boost::none));
+}
+
+TEST_F(DatabaseConfigurationImplTest, CanApplyAndReturnSentinelMasterNames)
+{
+ databaseConfigurationImpl->checkAndApplySentinelMasterNames("mymaster-0,mymaster-1,mymaster-2");
+ EXPECT_EQ("mymaster-0", databaseConfigurationImpl->getSentinelMasterName(0));
+ EXPECT_EQ("mymaster-1", databaseConfigurationImpl->getSentinelMasterName(1));
+ EXPECT_EQ("mymaster-2", databaseConfigurationImpl->getSentinelMasterName(2));
+}
+
+TEST_F(DatabaseConfigurationImplTest, CanApplyAndReturnDefaultSentinelMasterNamesWhenNotAllMasterNamesAreSet)
+{
+ databaseConfigurationImpl->checkAndApplySentinelMasterNames("mymaster-0");
+ EXPECT_EQ("mymaster-0", databaseConfigurationImpl->getSentinelMasterName(0));
+ EXPECT_EQ("dbaasmaster", databaseConfigurationImpl->getSentinelMasterName(1));
+ EXPECT_EQ("dbaasmaster", databaseConfigurationImpl->getSentinelMasterName(2));
+}
+
+TEST_F(DatabaseConfigurationImplTest, CanReturnSDLSentinelClusterAddresses)
+{
+ databaseConfigurationImpl->checkAndApplyDbType("sdl-sentinel-cluster");
+ databaseConfigurationImpl->checkAndApplyServerAddress("cluster-0.local");
+ databaseConfigurationImpl->checkAndApplyServerAddress("cluster-1.local");
+ databaseConfigurationImpl->checkAndApplyServerAddress("cluster-2.local");
+ databaseConfigurationImpl->checkAndApplySentinelPorts("54321,54322,54323");
+ 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()));
+ EXPECT_EQ(54322, ntohs(address1->getPort()));
+ EXPECT_EQ(54323, ntohs(address2->getPort()));
+}
+
+TEST_F(DatabaseConfigurationImplTest, CanReturnSDLSentinelPorts)
+{
+ databaseConfigurationImpl->checkAndApplyDbType("sdl-sentinel-cluster");
+ databaseConfigurationImpl->checkAndApplyServerAddress("cluster-0.local");
+ databaseConfigurationImpl->checkAndApplyServerAddress("cluster-1.local");
+ databaseConfigurationImpl->checkAndApplyServerAddress("cluster-2.local");
+ databaseConfigurationImpl->checkAndApplySentinelPorts("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()));
+ EXPECT_EQ(26379, ntohs(address1->getPort()));
+ EXPECT_EQ(26379, ntohs(address2->getPort()));
+}
+
+TEST_F(DatabaseConfigurationImplTest, CanReturnDefaultSentinelPortForSDLClusterAddress)
+{
+ databaseConfigurationImpl->checkAndApplyServerAddress("cluster-0.local");
+ auto address = databaseConfigurationImpl->getSentinelAddress(boost::none);
+ EXPECT_NE(boost::none, databaseConfigurationImpl->getSentinelAddress(boost::none));
+ EXPECT_EQ("cluster-0.local", address->getHost());
+ EXPECT_EQ(26379, ntohs(address->getPort()));