def setUp(): for name in ('boto', 'boto3', 'botocore'): logging.getLogger(name).setLevel(logging.CRITICAL) global ddb_process cmd = " ".join([ "java", "-Djava.library.path=%s" % ddb_lib_dir, "-jar", ddb_jar, "-sharedDb", "-inMemory" ]) conf = botocore.config.Config( region_name=os.getenv('AWS_REGION_NAME', 'us-east-1')) ddb_process = subprocess.Popen(cmd, shell=True, env=os.environ) autopush.db.g_dynamodb = boto3.resource( 'dynamodb', config=conf, endpoint_url=os.getenv("AWS_LOCAL_DYNAMODB", "http://127.0.0.1:8000"), aws_access_key_id="BogusKey", aws_secret_access_key="BogusKey", ) autopush.db.g_client = autopush.db.g_dynamodb.meta.client # Setup the necessary message tables message_table = os.environ.get("MESSAGE_TABLE", "message_int_test") create_rotating_message_table(prefix=message_table, delta=-1) create_rotating_message_table(prefix=message_table)
def setUp(): logging.getLogger("boto").setLevel(logging.CRITICAL) boto_path = os.path.join(root_dir, "automock", "boto.cfg") boto.config.load_from_path(boto_path) if "SKIP_INTEGRATION" in os.environ: # pragma: nocover raise SkipTest("Skipping integration tests") global ddb_process cmd = " ".join(["java", "-Djava.library.path=%s" % ddb_lib_dir, "-jar", ddb_jar, "-sharedDb", "-inMemory"]) ddb_process = subprocess.Popen(cmd, shell=True, env=os.environ) # Setup the necessary message tables message_table = os.environ.get("MESSAGE_TABLE", "message_int_test") create_rotating_message_table(prefix=message_table, delta=-1) create_rotating_message_table(prefix=message_table)
def test_create_rotating_cache(self): mock_table = Mock() mock_table.table_status = 'ACTIVE' mock_resource = Mock() mock_resource.Table = Mock(return_value=mock_table) table = create_rotating_message_table(boto_resource=mock_resource) assert table == mock_table
def setUp(): logging.getLogger('boto').setLevel(logging.CRITICAL) boto_path = os.path.join(root_dir, "automock", "boto.cfg") boto.config.load_from_path(boto_path) if "SKIP_INTEGRATION" in os.environ: # pragma: nocover raise SkipTest("Skipping integration tests") global ddb_process cmd = " ".join([ "java", "-Djava.library.path=%s" % ddb_lib_dir, "-jar", ddb_jar, "-sharedDb", "-inMemory" ]) ddb_process = subprocess.Popen(cmd, shell=True, env=os.environ) # Setup the necessary message tables message_table = os.environ.get("MESSAGE_TABLE", "message_int_test") create_rotating_message_table(prefix=message_table, delta=-1) create_rotating_message_table(prefix=message_table)
def create_initial_message_tables(self): """Initializes a dict of the initial rotating messages tables. An entry for last months table, and an entry for this months table. """ last_month = get_rotating_message_table(self._message_prefix, -1) this_month = get_rotating_message_table(self._message_prefix) # Verify the table exists try: this_month.describe() except Exception: # Create the message table create_rotating_message_table(prefix=self._message_prefix) this_month = get_rotating_message_table(self._message_prefix) self.message_tables = { last_month.table_name: Message(last_month, self.metrics), this_month.table_name: Message(this_month, self.metrics), }
def setUp(): for name in ('boto3', 'botocore'): logging.getLogger(name).setLevel(logging.CRITICAL) global ddb_process, boto_resource cmd = " ".join([ "java", "-Djava.library.path=%s" % ddb_lib_dir, "-jar", ddb_jar, "-sharedDb", "-inMemory" ]) ddb_process = subprocess.Popen(cmd, shell=True, env=os.environ) if os.getenv("AWS_LOCAL_DYNAMODB") is None: os.environ["AWS_LOCAL_DYNAMODB"] = "http://127.0.0.1:8000" boto_resource = DynamoDBResource() # Setup the necessary message tables message_table = os.environ.get("MESSAGE_TABLE", "message_int_test") create_rotating_message_table(prefix=message_table, delta=-1, boto_resource=boto_resource) create_rotating_message_table(prefix=message_table, boto_resource=boto_resource) pool = reactor.getThreadPool() pool.adjustPoolsize(minthreads=pool.max)
def setUp(): mock_s3().start() mock_dynamodb2.start() create_rotating_message_table()
def setUp(): mock_dynamodb2.start() create_rotating_message_table()
def setUp(): from .test_integration import setUp setUp() create_rotating_message_table()