示例#1
0
    def mark_5_pods_of_service_as_not_at_same_node(
            self, pod1: Pod, pod2: Pod, pod3: Pod, pod4: Pod, pod5: Pod,
            node_of_pod1: Node, node_of_pod2: Node, node_of_pod3: Node,
            node_of_pod4: Node, node_of_pod5: Node, service: Service,
            scheduler: Scheduler):

        assert node_of_pod1 == pod1.atNode
        assert node_of_pod2 == pod2.atNode
        assert node_of_pod3 == pod3.atNode
        assert node_of_pod4 == pod4.atNode
        assert node_of_pod5 == pod5.atNode
        assert node_of_pod1 in node_of_pod2.different_than
        assert node_of_pod1 in node_of_pod3.different_than
        assert node_of_pod1 in node_of_pod4.different_than
        assert node_of_pod1 in node_of_pod5.different_than
        assert node_of_pod2 in node_of_pod3.different_than
        assert node_of_pod2 in node_of_pod4.different_than
        assert node_of_pod2 in node_of_pod5.different_than
        assert node_of_pod3 in node_of_pod4.different_than
        assert node_of_pod3 in node_of_pod5.different_than
        assert node_of_pod4 in node_of_pod5.different_than

        assert pod1 in service.podList
        assert pod2 in service.podList
        assert pod3 in service.podList
        assert pod4 in service.podList
        assert pod5 in service.podList
        assert scheduler.status == STATUS_SCHED["Clean"]
        service.amountOfPodsOnDifferentNodes = 5
示例#2
0
 def mark_2_pods_of_service_as_not_at_same_node(self, pod1: Pod, pod2: Pod,
                                                node_of_pod1: Node,
                                                node_of_pod2: Node,
                                                service: Service,
                                                scheduler: Scheduler):
     assert node_of_pod2 == pod2.atNode
     assert pod1.atNode in node_of_pod2.different_than
     assert pod1 in service.podList
     assert pod2 in service.podList
     assert scheduler.status == STATUS_SCHED["Clean"]
     pod1.not_on_same_node.add(pod2)
     service.amountOfPodsOnDifferentNodes = 2