Пример #1
0
 def test_volume_list(self):
     grant = self.useFixture(fixtures.UserProjectGrant(self.sentinel))
     federated = base.FederatedUserClient(grant.user.entity,
                                          grant.project.entity)
     volume1 = self.useFixture(fixtures.Volume(federated))
     volume2 = self.useFixture(fixtures.Volume(federated))
     openstack = base.OpenStackClient()
     volume3 = self.useFixture(fixtures.Volume(openstack))
     # Test filtering
     sentinel = base.SentinelClient()
     volumes = sentinel.volume.volumes.list(
         search_opts={'all_tenants': 'True'})
     self.assertEqual(len(volumes), 2)
     self.assertThat(volume1.entity, matchers.IsInCollection(volumes))
     self.assertThat(volume2.entity, matchers.IsInCollection(volumes))
     self.assertThat(volume3.entity, matchers.IsNotInCollection(volumes))
     # Test limits
     volumes = sentinel.volume.volumes.list(
         search_opts={'all_tenants': 'True'}, limit=1)
     self.assertEqual(len(volumes), 1)
     volumes = sentinel.volume.volumes.list(
         search_opts={'all_tenants': 'True'}, marker=volumes[0].id, limit=1)
     self.assertEqual(len(volumes), 1)
     volumes = sentinel.volume.volumes.list(
         search_opts={'all_tenants': 'True'}, marker=volumes[0].id, limit=1)
     self.assertEqual(len(volumes), 0)
Пример #2
0
 def test_server_list(self):
     grant = self.useFixture(fixtures.UserProjectGrant(self.sentinel))
     federated = base.FederatedUserClient(grant.user.entity, grant.project.entity)
     server1 = self.useFixture(fixtures.Server(federated))
     server2 = self.useFixture(fixtures.Server(federated))
     openstack = base.OpenStackClient()
     server3 = self.useFixture(fixtures.Server(openstack))
     # Test filtering
     sentinel = base.SentinelClient()
     servers = sentinel.compute.servers.list(search_opts={'all_tenants': 'True'})
     self.assertEqual(len(servers), 2)
     self.assertThat(server1.entity, matchers.IsInCollection(servers))
     self.assertThat(server2.entity, matchers.IsInCollection(servers))
     self.assertThat(server3.entity, matchers.IsNotInCollection(servers))
     # Test limits
     servers = sentinel.compute.servers.list(
         search_opts={'all_tenants': 'True'},
         limit=1)
     self.assertEqual(len(servers), 1)
     servers = sentinel.compute.servers.list(
         search_opts={'all_tenants': 'True'},
         marker=servers[0].id,
         limit=1)
     self.assertEqual(len(servers), 1)
     servers = sentinel.compute.servers.list(
         search_opts={'all_tenants': 'True'},
         marker=servers[0].id,
         limit=1)
     self.assertEqual(len(servers), 0)
Пример #3
0
 def test_meters_by_type(self):
     grant = self.useFixture(fixtures.UserProjectGrant(self.sentinel))
     client = base.FederatedUserClient(grant.user.entity,
                                       grant.project.entity)
     server = self.useFixture(fixtures.Server(client))
     samples = self.sentinel.metering.samples.list(meter_name='vcpus')
     resources = [s.resource_id for s in samples]
     self.assertIn(server.entity.id, resources)
Пример #4
0
 def test_floatingip_list(self):
     grant = self.useFixture(fixtures.UserProjectGrant(self.sentinel))
     federated = base.FederatedUserClient(grant.user.entity,
                                          grant.project.entity)
     floatingip1 = self.useFixture(fixtures.FloatingIP(federated))
     openstack = base.OpenStackClient()
     floatingip2 = self.useFixture(fixtures.FloatingIP(openstack))
     # Test filtering
     sentinel = base.SentinelClient()
     floatingips = list(sentinel.network.list_floatingips())
     self.assertEqual(len(floatingips), 1)
     self.assertThat(floatingip1.entity,
                     matchers.IsInCollection(floatingips))
     self.assertThat(floatingip2.entity,
                     matchers.IsNotInCollection(floatingips))
Пример #5
0
 def test_project_list(self):
     grant = self.useFixture(fixtures.UserProjectGrant(self.sentinel))
     projects = self.sentinel.identity.projects.list(user=grant.user.entity)
     self.assertThat(grant.project.entity,
                     matchers.IsInCollection(projects))