Ejemplo n.º 1
0
    def test_read_request_load_start_stop_start_succeeds(self, _logger):
        """
        ``read_request_load_scenario`` starts, stops and starts
        without collapsing.
        """
        c = Clock()

        node1 = Node(uuid=uuid4(), public_address=IPAddress('10.0.0.1'))
        node2 = Node(uuid=uuid4(), public_address=IPAddress('10.0.0.2'))
        cluster = BenchmarkCluster(
            node1.public_address,
            lambda reactor: FakeFlockerClient([node1, node2]),
            {node1.public_address, node2.public_address},
            default_volume_size=DEFAULT_VOLUME_SIZE)

        sample_size = 5
        s = read_request_load_scenario(c, cluster, sample_size=sample_size)
        # Start and stop
        s.start()
        c.pump(repeat(1, sample_size))
        s.stop()

        # Start again and verify the scenario succeeds
        d = s.start()
        c.pump(repeat(1, sample_size))
        s.maintained().addBoth(lambda x: self.fail())
        d.addCallback(lambda ignored: s.stop())
        c.pump(repeat(1, sample_size))
        self.successResultOf(d)
Ejemplo n.º 2
0
    def test_read_request_load_succeeds(self, _logger):
        """
        ``read_request_load_scenario`` starts and stops without collapsing.
        """
        c = Clock()

        node1 = Node(uuid=uuid4(), public_address=IPAddress('10.0.0.1'))
        node2 = Node(uuid=uuid4(), public_address=IPAddress('10.0.0.2'))
        cluster = BenchmarkCluster(
            node1.public_address,
            lambda reactor: FakeFlockerClient([node1, node2]),
            {node1.public_address, node2.public_address},
            default_volume_size=DEFAULT_VOLUME_SIZE)

        sample_size = 5
        s = read_request_load_scenario(c, cluster, sample_size=sample_size)

        d = s.start()

        # Request rate samples are recorded every second and we need to
        # collect enough samples to establish the rate which is defined
        # by `sample_size`. Therefore, advance the clock by
        # `sample_size` seconds to obtain enough samples.
        c.pump(repeat(1, sample_size))
        s.maintained().addBoth(lambda x: self.fail())
        d.addCallback(lambda ignored: s.stop())
        c.pump(repeat(1, sample_size))
        self.successResultOf(d)
Ejemplo n.º 3
0
 def make_cluster(self, make_flocker_client):
     """
     Create a cluster that can be used by the scenario tests.
     """
     node1 = Node(uuid=uuid4(), public_address=IPAddress('10.0.0.1'))
     node2 = Node(uuid=uuid4(), public_address=IPAddress('10.0.0.2'))
     return BenchmarkCluster(
         node1.public_address,
         lambda reactor: make_flocker_client(
             FakeFlockerClient([node1, node2]), reactor),
         {node1.public_address, node2.public_address},
         default_volume_size=DEFAULT_VOLUME_SIZE,
     )
Ejemplo n.º 4
0
    def test_scenario_throws_exception_when_already_started(self, _logger):
        """
        start method in the ``RequestLoadScenario`` throws a
        ``RequestScenarioAlreadyStarted`` if the scenario is already started.
        """
        c = Clock()

        node1 = Node(uuid=uuid4(), public_address=IPAddress('10.0.0.1'))
        node2 = Node(uuid=uuid4(), public_address=IPAddress('10.0.0.2'))
        cluster = BenchmarkCluster(
            node1.public_address,
            lambda reactor: FakeFlockerClient([node1, node2]),
            {node1.public_address, node2.public_address},
            default_volume_size=DEFAULT_VOLUME_SIZE)

        sample_size = 5
        s = read_request_load_scenario(c, cluster, sample_size=sample_size)

        s.start()

        self.assertRaises(RequestScenarioAlreadyStarted, s.start)
Ejemplo n.º 5
0
 def setUp(self):
     super(WriteRequestLoadScenarioTest, self).setUp()
     self.node1 = Node(uuid=uuid4(), public_address=IPAddress('10.0.0.1'))
     self.node2 = Node(uuid=uuid4(), public_address=IPAddress('10.0.0.2'))
Ejemplo n.º 6
0
 def setUp(self):
     super(write_request_load_scenarioTest, self).setUp()
     self.node1 = Node(uuid=uuid4(), public_address=IPAddress('10.0.0.1'))
     self.node2 = Node(uuid=uuid4(), public_address=IPAddress('10.0.0.2'))