Exemple #1
0
def compose_op(context, op):
    assert 'table' in context, "table (of peers) not found in context"
    assert 'compose_yaml' in context, "compose_yaml not found in context"

    fileArgsToDockerCompose = bdd_compose_util.getDockerComposeFileArgsFromYamlFile(
        context.compose_yaml)
    services = context.table.headings
    # Loop through services and start/stop them, and modify the container data list if successful.
    for service in services:
        context.compose_output, context.compose_error, context.compose_returncode = \
            bdd_test_util.cli_call(["docker-compose"] + fileArgsToDockerCompose + [op, service], expect_success=True)
        assert context.compose_returncode == 0, "docker-compose failed to {0} {0}".format(
            op, service)
        if op == "stop" or op == "pause":
            context.compose_containers = [
                containerData for containerData in context.compose_containers
                if containerData.composeService != service
            ]
        else:
            bdd_compose_util.parseComposeOutput(context)
        bdd_log("After {0}ing, the container service list is = {1}".format(
            op, [
                containerData.composeService
                for containerData in context.compose_containers
            ]))

    context.containerAliasMap = bdd_compose_util.mapAliasesToContainers(
        context)
    context.containerNameMap = bdd_compose_util.mapContainerNamesToContainers(
        context)
def step_impl(context, composeYamlFile):
    context.compose_yaml = composeYamlFile
    fileArgsToDockerCompose = bdd_compose_util.getDockerComposeFileArgsFromYamlFile(context.compose_yaml)
    context.compose_output, context.compose_error, context.compose_returncode = \
        bdd_test_util.cli_call(["docker-compose"] + fileArgsToDockerCompose + ["up","--force-recreate", "-d"], expect_success=True)
    assert context.compose_returncode == 0, "docker-compose failed to bring up {0}".format(composeYamlFile)

    bdd_compose_util.parseComposeOutput(context)

    timeoutSeconds = 15
    assert bdd_compose_util.allContainersAreReadyWithinTimeout(context, timeoutSeconds), \
        "Containers did not come up within {} seconds, aborting".format(timeoutSeconds)
Exemple #3
0
def step_impl(context, composeYamlFile):
    context.compose_yaml = composeYamlFile
    fileArgsToDockerCompose = bdd_compose_util.getDockerComposeFileArgsFromYamlFile(context.compose_yaml)
    context.compose_output, context.compose_error, context.compose_returncode = \
        bdd_test_util.cli_call(["docker-compose"] + fileArgsToDockerCompose + ["up","--force-recreate", "-d"], expect_success=True)
    assert context.compose_returncode == 0, "docker-compose failed to bring up {0}".format(composeYamlFile)

    bdd_compose_util.parseComposeOutput(context)

    timeoutSeconds = 15
    assert bdd_compose_util.allContainersAreReadyWithinTimeout(context, timeoutSeconds), \
        "Containers did not come up within {} seconds, aborting".format(timeoutSeconds)
def compose_op(context, op):
    assert 'table' in context, "table (of peers) not found in context"
    assert 'compose_yaml' in context, "compose_yaml not found in context"

    fileArgsToDockerCompose = bdd_compose_util.getDockerComposeFileArgsFromYamlFile(context.compose_yaml)
    services =  context.table.headings
    # Loop through services and start/stop them, and modify the container data list if successful.
    for service in services:
       context.compose_output, context.compose_error, context.compose_returncode = \
           bdd_test_util.cli_call(["docker-compose"] + fileArgsToDockerCompose + [op, service], expect_success=True)
       assert context.compose_returncode == 0, "docker-compose failed to {0} {0}".format(op, service)
       if op == "stop" or op == "pause":
           context.compose_containers = [containerData for containerData in context.compose_containers if containerData.composeService != service]
       else:
           bdd_compose_util.parseComposeOutput(context)
       print("After {0}ing, the container service list is = {1}".format(op, [containerData.composeService for  containerData in context.compose_containers]))