예제 #1
0
 def _create_mock_events():
     gen_list = mock_sync.simple_zone_generators(
         2, 4, snapshot_events=2, snap_vals={'sync_mode': 'init_snapshot'})
     gen_list += mock_sync.simple_host_generators(
         2, 4, 4, snap_vals={'sync_mode': 'init_snapshot'})
     gen_list += mock_sync.simple_instance_generators(
         4, 15, 15, snap_vals={'sync_mode': 'init_snapshot'})
     return mock_sync.generate_sequential_events_list(gen_list)
    def test_snapshot_transform(self):
        LOG.debug('Nova zone transformer test: transform entity event')

        # Test setup
        spec_list = mock_sync.simple_zone_generators(
            zone_num=2,
            host_num=3,
            snapshot_events=5
        )
        zone_events = mock_sync.generate_random_events_list(spec_list)

        for event in zone_events:
            # Test action
            wrapper = ZoneTransformer(self.transformers).transform(event)

            # Test assertions
            vertex = wrapper.vertex
            self._validate_vertex_props(vertex, event)

            neighbors = wrapper.neighbors
            self._validate_neighbors(neighbors, vertex.vertex_id, event)