예제 #1
0
def test_nocloud(deployer, config):
    testdeployer = deployer.copy()
    testdeployer["cloud"] = "AWS"
    assert CoreDeployerTemplate.get(testdeployer, config) is not None
    with pytest.raises(NotImplementedError):
        testdeployer["cloud"] = "GCP"
        CoreDeployerTemplate.get(testdeployer, config)
    with pytest.raises(NotImplementedError):
        testdeployer["cloud"] = "sdfsdfsdfsdf"
        CoreDeployerTemplate.get(testdeployer, config)
예제 #2
0
def core(ctx, deployer, wait, dryrun):
    """Deploy core step function"""
    ctx.obj.require_cloud_access()
    config = ctx.obj.config
    deployer = load_deployer(config, deployer)
    if deployer is None:
        raise click.BadParameter(f"Deployer {deployer} does not exist")
    Compiler.cleanup(deployer,
                     CoreDeployerTemplate.get(deployer, config),
                     wait=wait,
                     dryrun=dryrun)
    del deployer["deployment-workflow"]
    save_deployer(deployer, config)
예제 #3
0
def test_aws(deployer, config, configfile):
    template = CoreDeployerTemplate.aws(deployer, config)
    ref_template = InitializeDeployerTemplate.aws(deployer, config)

    assert len(template) == 1
    assert template[0]["aws"]["account-id"] == configfile["aws"].get("account")
    assert template[0]["aws"]["region"] == configfile["aws"].get("region")
    assert template[0]["aws"]["deployment-role"] == configfile["aws"].get(
        "deployment-role", "")
    assert os.path.isfile(template[0]["location"])
    assert template[0]["template"]["name"] == CoreDeployerTemplate.name(
        deployer)
    assert (template[0]["template"]["parameters"]["registry-table"] ==
            ref_template[0]["template"]["parameters"]["registry-table"])
    assert (template[0]["template"]["parameters"]["artifact-bucket"] ==
            ref_template[0]["template"]["parameters"]["artifact-bucket"])
    assert (template[0]["template"]["parameters"]["deployment-workflow"] ==
            f"{deployer['name']}-deployer-core")
    assert (template[0]["template"]["lambda-code-key"] ==
            f"packages/{deployer['name']}-deployer-core-stack/")
    assert len(template[0]["functions"]) == 1
    assert os.path.isdir(template[0]["functions"][0]["location"])
예제 #4
0
def test_aws(deployer, config, configfile):
    template = DeployerRepositoryTemplate.aws(deployer, config)
    ref_template = InitializeDeployerTemplate.aws(deployer, config)
    core_template = CoreDeployerTemplate.aws(deployer, config)

    assert len(template) == 1
    assert template[0]["aws"]["account-id"] == configfile["aws"].get("account")
    assert template[0]["aws"]["region"] == configfile["aws"].get("region")
    assert template[0]["aws"]["deployment-role"] == configfile["aws"].get(
        "deployment-role", "")
    assert os.path.isfile(template[0]["location"])
    assert template[0]["template"]["name"] == DeployerRepositoryTemplate.name(
        deployer)
    assert (template[0]["template"]["parameters"]["artifact-bucket"] ==
            ref_template[0]["template"]["parameters"]["artifact-bucket"])
    assert (template[0]["template"]["parameters"]["deployment-workflow"] ==
            core_template[0]["template"]["parameters"]["deployment-workflow"])
예제 #5
0
def core(ctx, deployer, wait, dryrun, output_location):
    """Deploy core step function"""
    ctx.obj.require_cloud_access()
    config = ctx.obj.config
    deployer = load_deployer(config, deployer)
    if deployer is None:
        raise click.BadParameter(f"Deployer {deployer} does not exist")
    Compiler.build_template(
        deployer,
        CoreDeployerTemplate.get(deployer, config),
        wait=wait,
        dryrun=dryrun,
        output_folder=output_location,
    )
    deployer["deployment-workflow"] = f"{deployer['name']}-deployer-core"
    deployer["account"] = config.get("aws", "account", None)
    save_deployer(deployer, config)
예제 #6
0
def test_name(deployer):
    assert CoreDeployerTemplate.name(deployer) == "test-deployer-core-stack"