Ejemplo n.º 1
0
 def setUpClass( cls ):
     super( CgcloudTestCase, cls ).setUpClass( )
     if running_on_ec2( ):
         os.environ.setdefault( 'CGCLOUD_ZONE',
                                get_instance_metadata( )[ 'placement' ][ 'availability-zone' ] )
     suffix = hex( int( time.time( ) ) )[ 2: ]
     assert len( suffix ) == test_namespace_suffix_length
     cls.namespace = '/test/%s/' % suffix
     os.environ.setdefault( 'CGCLOUD_NAMESPACE', cls.namespace )
Ejemplo n.º 2
0
 def setUpClass( cls ):
     super( CgcloudTestCase, cls ).setUpClass( )
     if running_on_ec2( ):
         os.environ.setdefault( 'CGCLOUD_ZONE',
                                get_instance_metadata( )[ 'placement' ][ 'availability-zone' ] )
     # Using the d64 of a binary string that starts with a 4-byte, big-endian time stamp
     # yields compact names whose lexicographical sorting is consistent with the historical
     # order. We add the process ID so we can run tests concurrently in child processes using
     # the pytest-xdist plugin.
     suffix = aws_d64.encode( pack( '>II', int( time.time( ) ), os.getpid( ) ) )
     assert len( suffix ) == test_namespace_suffix_length
     cls.__namespace = '/test/%s/' % suffix
     os.environ.setdefault( 'CGCLOUD_NAMESPACE', cls.__namespace )
     cls.ctx = Context( availability_zone=os.environ[ 'CGCLOUD_ZONE' ],
                        namespace=os.environ[ 'CGCLOUD_NAMESPACE' ] )
Ejemplo n.º 3
0
 def setUpClass(cls):
     super(CgcloudTestCase, cls).setUpClass()
     if running_on_ec2():
         os.environ.setdefault(
             'CGCLOUD_ZONE',
             get_instance_metadata()['placement']['availability-zone'])
     # Using the d32 of a binary string that starts with a 4-byte, big-endian time stamp
     # yields compact names whose lexicographical sorting is consistent with the historical
     # order. We add the process ID so we can run tests concurrently in child processes using
     # the pytest-xdist plugin.
     suffix = aws_d32.encode(pack('>II', int(time.time()), os.getpid()))
     assert len(suffix) == test_namespace_suffix_length
     cls.__namespace = '/test/%s/' % suffix
     os.environ.setdefault('CGCLOUD_NAMESPACE', cls.__namespace)
     cls.ctx = Context(availability_zone=os.environ['CGCLOUD_ZONE'],
                       namespace=os.environ['CGCLOUD_NAMESPACE'])