Esempio n. 1
0
def environment():
    """The test environment: this fixtures creates it and takes care of
    removing it after tests have run."""
    env = Environment("tests/integration/secrets-vault.yaml")
    env.create()
    yield env
    env.delete()
Esempio n. 2
0
def environment(settings):
    """The test environment: this fixtures creates it and takes care of
    removing it after tests have run."""
    env = Environment(settings.environment_path, stage=settings.stage)
    env.create(update=True)
    yield env
    if os.environ.get("DESTROY", "yes").lower() == "yes":
        env.delete()
Esempio n. 3
0
def test_plugin(envfile):
    """Create and destroy the test environment of a humilis plugin."""
    envfile_path = os.path.join(EXAMPLES_DIR, envfile)
    env = Environment(envfile_path, stage="TEST")
    try:
        env.create(update=True)
    finally:
        env.delete()
Esempio n. 4
0
File: cli.py Progetto: waldt/humilis
def delete(environment, stage, pretend, parameters):
    """Deletes an environment that has been deployed to CF."""
    if parameters:
        with open(parameters, "r") as f:
            parameters = yaml.load(f.read())

    env = Environment(environment, stage=stage, parameters=parameters)
    if not pretend:
        env.delete()
Esempio n. 5
0
def delete(environment, stage, pretend, parameters):
    """Deletes an environment that has been deployed to CF."""
    if parameters:
        with open(parameters, "r") as f:
            parameters = yaml.load(f.read())

    env = Environment(environment, stage=stage, parameters=parameters)
    if not pretend:
        env.delete()
Esempio n. 6
0
def environment(settings):
    """The test environment: this fixtures creates it and takes care of
    removing it after tests have run."""
    env = Environment(settings.environment_path, stage=settings.stage)
    if os.environ.get("UPDATE", "yes") == "yes":
        env.create(update=True, output_file=settings.output_path)
    else:
        env.create(output_file=settings.output_path)
    yield env
    if os.environ.get("DESTROY", "yes") == "yes":
        env.delete()
Esempio n. 7
0
def environment(settings):
    """The test environment: this fixtures creates it and takes care of
    removing it after tests have run."""
    env = Environment(settings.environment_path, stage=settings.stage)
    if settings.update == "yes":
        env.create(update=True)
    else:
        env.create()
    yield env
    if settings.destroy == "yes":
        env.delete()
Esempio n. 8
0
def environment(settings):
    """The test environment: this fixture creates it and takes care of
    removing it after tests have run."""
    env = Environment(settings.environment_path, stage=settings.stage)
    if settings.update == "yes":
        env.create(update=True)
    else:
        env.create()
    yield env
    if settings.destroy == "yes":
        env.delete()
Esempio n. 9
0
def environment(settings):
    """The test environment: this fixtures creates it and takes care of
    removing it after tests have run."""
    env = Environment(settings.environment_path, stage=settings.stage)
    if os.environ.get("UPDATE", "yes") == "yes":
        env.create(update=True, output_file=settings.output_path)
    else:
        env.create(output_file=settings.output_path)
    yield env
    if os.environ.get("DESTROY", "yes") == "yes":
        # Empty the S3 bucket
        bucket = env.outputs["storage"]["BucketName"]
        os.system("aws s3 rm s3://{} --recursive".format(bucket))
        env.delete()
def environment(settings):
    """The test environment: this fixtures creates it and takes care of
    removing it after tests have run."""
    env = Environment(settings.environment_path, stage=settings.stage)
    if os.environ.get("UPDATE", "yes") == "yes":
        env.create(update=True, output_file=settings.output_path)
    else:
        env.create(output_file=settings.output_path)

    val = keyring.get_password(
        "humilis-kinesis-processor/{}".format(settings.stage), "sentry/dsn")
    env.set_secret("sentry.dsn", val)
    yield env
    if os.environ.get("DESTROY", "yes") == "yes":
        # Empty the S3 bucket
        bucket = env.outputs["storage"]["BucketName"]
        os.system("aws s3 rm s3://{} --recursive".format(bucket))
        env.delete()
Esempio n. 11
0
def environment(settings):
    """The test environment: this fixtures creates it and takes care of
    removing it after tests have run."""
    env = Environment(settings.environment_path, stage=settings.stage)
    if os.environ.get("UPDATE", "yes") == "yes":
        env.create(update=True, output_file=settings.output_path)
    else:
        env.create(output_file=settings.output_path)

    val = keyring.get_password(
        "humilis-kinesis-processor/{}".format(settings.stage), "sentry/dsn")
    env.set_secret("sentry.dsn", val)
    yield env
    if os.environ.get("DESTROY", "yes") == "yes":
        # Empty the S3 bucket
        bucket = env.outputs["storage"]["BucketName"]
        os.system("aws s3 rm s3://{} --recursive".format(bucket))
        env.delete()
Esempio n. 12
0
def environment(settings):
    """The test environment: this fixtures creates it and takes care of
    removing it after tests have run."""
    env = Environment(settings.environment_path, stage=settings.stage)

    if os.environ.get("UPDATE", "yes") == "yes":
        env.create(update=True, output_file=settings.output_path)
    else:
        env.create(output_file=settings.output_path)
    yield env
    if os.environ.get("DESTROY", "no").lower() == "yes":
        bucket = env.outputs["asg"]["BucketName"]
        empty_bucket(bucket)
        try:
            env.delete()
        except AwsError as err:
            # Some files may have arrived to the bucket after the bucket was
            # emptied for the first time.
            empty_bucket(bucket)
            env.delete()
Esempio n. 13
0
def delete(environment, stage, pretend, parameters):
    """Deletes an environment that has been deployed to CF."""
    env = Environment(environment, stage=stage, parameters=parameters)
    if not pretend:
        env.delete()