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
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)
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
def output_progress(kubsource, status, fmt="stdout"): if fmt == 'stdout': print " --> %s (%s): %s" % (kubsource.name, kubsource.kind, colorize(status))
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
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
def output_progress(kubsource, status, fmt="text"): if fmt == 'text': print " --> %s (%s): %s" % (kubsource.name, kubsource.kind, colorize(status))