예제 #1
0
파일: test_kpmcli.py 프로젝트: ryanj/kpm
def test_deploy(project_dir, subcall_all, user, parser, pkgname, api_stg,
                capsys):
    os.chdir(project_dir)
    cmd = "deploy %s --namespace=testns" % pkgname
    args = parser.parse_args(cmd.split(" ") + api_stg)
    args.func(args)
    out, err = capsys.readouterr()
    response = """create {pkgname} \n
 01 - {pkgname}:
 --> testns (namespace): {ok}
 --> kube-ui (replicationcontroller): {updated}
 --> kube-ui (service): {updated}


package                    version    type                   name     namespace    status
-------------------------  ---------  ---------------------  -------  -----------  --------
{pkgname}  1.0.1      namespace              testns   testns       {ok}
{pkgname}  1.0.1      replicationcontroller  kube-ui  testns       {updated}
{pkgname}  1.0.1      service                kube-ui  testns       {updated}\n""".format(
        pkgname=pkgname, ok=colorize('ok'), updated=colorize('updated'))

    with open("/tmp/r", "w") as f:
        f.write(out)
    with open("/tmp/r2", "w") as f:
        f.write(response)

    assert out == response
예제 #2
0
def print_deploy_result(table):
    header = ["package", "release", "type", "name", "namespace", "status"]
    print "\n"
    for r in table:
        status = r.pop()
        r.append(colorize(status))

    print tabulate(table, header)
예제 #3
0
파일: display.py 프로젝트: coreos/kpm
def print_deploy_result(table):
    header = ["package", "release", "type", "name", "namespace", "status"]
    print "\n"
    for r in table:
        status = r.pop()
        r.append(colorize(status))

    print tabulate(table, header)
예제 #4
0
파일: test_kpmcli.py 프로젝트: ryanj/kpm
def test_remove(project_dir, subcall_all, user, parser, pkgname, api_stg,
                capsys):
    os.chdir(project_dir)
    cmd = "remove %s --namespace=testns" % pkgname
    args = parser.parse_args(cmd.split(" ") + api_stg)
    args.func(args)
    out, err = capsys.readouterr()
    response = """delete {pkgname} \n
 01 - {pkgname}:
 --> testns (namespace): {protected}
 --> kube-ui (replicationcontroller): {deleted}
 --> kube-ui (service): {deleted}


package                    version    type                   name     namespace    status
-------------------------  ---------  ---------------------  -------  -----------  ---------
{pkgname}  1.0.1      namespace              testns   testns       {protected}
{pkgname}  1.0.1      replicationcontroller  kube-ui  testns       {deleted}
{pkgname}  1.0.1      service                kube-ui  testns       {deleted}\n""".format(
        pkgname=pkgname,
        protected=colorize('protected'),
        deleted=colorize('deleted'))
    assert out == response
예제 #5
0
파일: deploy.py 프로젝트: jonboulle/kpm
def output_progress(kubsource, status, fmt="stdout"):
    if fmt == 'stdout':
        print " --> %s (%s): %s" % (kubsource.name, kubsource.kind, colorize(status))
예제 #6
0
def test_remove(project_dir, subcall_all, user, parser, pkgname, api_stg, capsys):
    os.chdir(project_dir)
    cmd = "remove %s --namespace=testns" % pkgname
    args = parser.parse_args(cmd.split(" ") + api_stg)
    args.func(args)
    out, err = capsys.readouterr()
    response = """delete {pkgname} \n
 01 - {pkgname}:
 --> testns (namespace): {protected}
 --> kube-ui (replicationcontroller): {deleted}
 --> kube-ui (service): {deleted}


package                    version    type                   name     namespace    status
-------------------------  ---------  ---------------------  -------  -----------  ---------
{pkgname}  1.0.1      namespace              testns   testns       {protected}
{pkgname}  1.0.1      replicationcontroller  kube-ui  testns       {deleted}
{pkgname}  1.0.1      service                kube-ui  testns       {deleted}\n""".format(pkgname=pkgname,
                                                                                         protected=colorize('protected'),
                                                                                         deleted=colorize('deleted'))
    assert out == response
예제 #7
0
def test_deploy(project_dir, subcall_all, user, parser, pkgname, api_stg, capsys):
    os.chdir(project_dir)
    cmd = "deploy %s --namespace=testns" % pkgname
    args = parser.parse_args(cmd.split(" ") + api_stg)
    args.func(args)
    out, err = capsys.readouterr()
    response = """create {pkgname} \n
 01 - {pkgname}:
 --> testns (namespace): {ok}
 --> kube-ui (replicationcontroller): {ok}
 --> kube-ui (service): {updated}


package                    version    type                   name     namespace    status
-------------------------  ---------  ---------------------  -------  -----------  --------
{pkgname}  1.0.1      namespace              testns   testns       {ok}
{pkgname}  1.0.1      replicationcontroller  kube-ui  testns       {ok}
{pkgname}  1.0.1      service                kube-ui  testns       {updated}\n""".format(pkgname=pkgname,
                                                                                         ok=colorize('ok'),
                                                                                         updated=colorize('updated'))

    # with open("/tmp/r", "w") as f:
    #     f.write(out)
    # with open("/tmp/r2", "w") as f:
    #     f.write(response)

    assert out == response
예제 #8
0
def output_progress(kubsource, status, fmt="text"):
    if fmt == 'text':
        print " --> %s (%s): %s" % (kubsource.name, kubsource.kind,
                                    colorize(status))