Exemple #1
0
    def test_get_all_members(self):
        self.assertEqual(list(get_all_members(get_cluster_initialized_without_leader(), role='master')), [])

        r = list(get_all_members(get_cluster_initialized_with_leader(), role='master'))
        self.assertEqual(len(r), 1)
        self.assertEqual(r[0].name, 'leader')

        r = list(get_all_members(get_cluster_initialized_with_leader(), role='replica'))
        self.assertEqual(len(r), 1)
        self.assertEqual(r[0].name, 'other')

        self.assertEqual(len(list(get_all_members(get_cluster_initialized_without_leader(), role='replica'))), 2)
    def test_get_all_members(self):
        self.assertEquals(list(get_all_members(get_cluster_initialized_without_leader(), role='master')), [])

        r = list(get_all_members(get_cluster_initialized_with_leader(), role='master'))
        self.assertEquals(len(r), 1)
        self.assertEquals(r[0].name, 'leader')

        r = list(get_all_members(get_cluster_initialized_with_leader(), role='replica'))
        self.assertEquals(len(r), 1)
        self.assertEquals(r[0].name, 'other')

        self.assertEquals(len(list(get_all_members(get_cluster_initialized_without_leader(), role='replica'))), 2)
    def test_get_all_members(self):
        r = list(get_all_members(get_cluster_initialized_without_leader(), role="master"))
        assert len(r) == 0

        r = list(get_all_members(get_cluster_initialized_with_leader(), role="master"))
        assert len(r) == 1
        assert r[0].name == "leader"

        r = list(get_all_members(get_cluster_initialized_with_leader(), role="replica"))
        assert len(r) == 1
        assert r[0].name == "other"

        r = list(get_all_members(get_cluster_initialized_without_leader(), role="replica"))
        assert len(r) == 2
    def test_get_all_members(self):
        r = list(
            get_all_members(get_cluster_initialized_without_leader(),
                            role='master'))
        assert len(r) == 0

        r = list(
            get_all_members(get_cluster_initialized_with_leader(),
                            role='master'))
        assert len(r) == 1
        assert r[0].name == 'leader'

        r = list(
            get_all_members(get_cluster_initialized_with_leader(),
                            role='replica'))
        assert len(r) == 1
        assert r[0].name == 'other'

        r = list(
            get_all_members(get_cluster_initialized_without_leader(),
                            role='replica'))
        assert len(r) == 2