def test_create_entries_no_ifaddrs(self, mock_ifaddrs):
     pair0 = self.gparray.getSegmentList()[0]
     primary_hostname = pair0.primaryDB.getSegmentHostName()
     mirror_hostname = pair0.mirrorDB.getSegmentHostName()
     entries = create_entries(primary_hostname, mirror_hostname, False)
     entries_str = "\n".join(entries)
     entries_expected = "host replication gpadmin samehost trust"
     self.assertEqual(entries_str.strip(), entries_expected.strip())
 def test_create_entries_hba_hostnames_true(self, gethost):
     pair0 = self.gparray.getSegmentList()[0]
     primary_hostname = pair0.primaryDB.getSegmentHostName()
     mirror_hostname = pair0.mirrorDB.getSegmentHostName()
     entries = create_entries(primary_hostname, mirror_hostname, True)
     entries_str = "\n".join(entries)
     entries_expected = "\nhost replication gpadmin samehost trust\nhost all gpadmin sdw1 trust\nhost replication gpadmin sdw1 trust"
     self.assertEqual(entries_str, entries_expected)
 def test_create_entries(self, mock_ifaddrs):
     pair0 = self.gparray.getSegmentList()[0]
     primary_hostname = pair0.primaryDB.getSegmentHostName()
     mirror_hostname = pair0.mirrorDB.getSegmentHostName()
     entries = create_entries(primary_hostname, mirror_hostname, False)
     entries_str = "\n".join(entries)
     entries_expected = self.entries_block.format(ip_primary1='192.168.1.1',
                                                  ip_primary2='192.168.2.1',
                                                  ip_mirror1='192.168.1.1',
                                                  ip_mirror2='192.168.2.1')
     self.assertEqual(entries_str, entries_expected)