Exemple #1
0
def test_distribute():
    from ruskit import cluster
    from ruskit.cmds.create import Manager

    instance = [
        'host1:1',
        'host2:2',
        'host3:3',
        'host4:4',
        'host5:5',
        'host6:6',
    ]

    manager = Manager(1, instance)
    manager.init_slots()

    master_map = {m.name: m for m in manager.masters}

    for s in manager.slaves:
        assert master_map[s.unassigned_master].host != s.host
Exemple #2
0
def test_distribute(monkeypatch):
    from ruskit import cluster
    from ruskit.cmds.create import Manager

    instance = [
        'host1:1',
        'host2:2',
        'host3:3',
        'host4:4',
        'host5:5',
        'host6:6',
    ]

    manager = Manager(1, instance)
    manager.init_slots()

    master_map = {m.name: m for m in manager.masters}

    for s in manager.slaves:
        assert master_map[s.unassigned_master].host != s.host
Exemple #3
0
def test_distribute(monkeypatch):
    from ruskit import cluster
    monkeypatch.setattr(cluster, 'ClusterNode', MockNode)

    from ruskit.cmds.create import Manager

    instance = [
        '10.0.15.59:7101',
        '10.0.15.60:7101',
        '10.0.50.139:7101',
        '10.0.15.59:7102',
        '10.0.15.60:7102',
        '10.0.50.139:7102',
    ]

    manager = Manager(1, instance)
    manager.init_slots()

    master_map = {m.name: m for m in manager.masters}

    for s in manager.slaves:
        assert master_map[s.unassigned_master].host != s.host