def test_init(project, domain, cloud_provider, ci_provider, oauth_provider): render_config( project_name=project, qhub_domain=domain, cloud_provider=cloud_provider, ci_provider=ci_provider, repository='github.com/test/test', repository_auto_provision=False, oauth_provider=oauth_provider, oauth_auto_provision=False, disable_prompt=True, )
def test_init(project, namespace, domain, cloud_provider, ci_provider, auth_provider): render_config( project_name=project, namespace=namespace, qhub_domain=domain, cloud_provider=cloud_provider, ci_provider=ci_provider, repository="github.com/test/test", auth_provider=auth_provider, repository_auto_provision=False, auth_auto_provision=False, terraform_state="remote", kubernetes_version="1.18.0", disable_prompt=True, )
def handle_init(args): config = render_config( project_name=args.project, namespace=args.namespace, qhub_domain=args.domain, cloud_provider=args.platform, ci_provider=args.ci_provider, repository=args.repository, repository_auto_provision=args.repository_auto_provision, auth_provider=args.auth_provider, auth_auto_provision=args.auth_auto_provision, terraform_state=args.terraform_state, kubernetes_version=args.kubernetes_version, disable_prompt=args.disable_prompt, ssl_cert_email=args.ssl_cert_email, ) try: with open("qhub-config.yaml", "x") as f: yaml.dump(config, f) except FileExistsError: raise ValueError( "A qhub-config.yaml file already exists. Please move or delete it and try again." )
def test_schema(project, domain, cloud_provider, ci_provider, oauth_provider): config = render_config( project_name=project, qhub_domain=domain, cloud_provider=cloud_provider, ci_provider=ci_provider, repository='github.com/test/test', repository_auto_provision=False, oauth_provider=oauth_provider, oauth_auto_provision=False, disable_prompt=True, ) assert qhub.schema.verify(config) is None
def handle_init(args): config = render_config( project_name=args.project, qhub_domain=args.domain, cloud_provider=args.platform, ci_provider=args.ci_provider, repository=args.repository, repository_auto_provision=args.repository_auto_provision, oauth_provider=args.oauth_provider, oauth_auto_provision=args.oauth_auto_provision, disable_prompt=args.disable_prompt, ) with open("qhub-config.yaml", "x") as f: yaml.dump(config, f, default_flow_style=False, sort_keys=False)
def test_schema(project, terraform_version, domain, cloud_provider, ci_provider, oauth_provider): config = render_config( project_name=project, terraform_version=terraform_version, qhub_domain=domain, cloud_provider=cloud_provider, ci_provider=ci_provider, repository="github.com/test/test", oauth_provider=oauth_provider, repository_auto_provision=False, oauth_auto_provision=False, kubernetes_version='1.18.0', disable_prompt=True, ) assert qhub.schema.verify(config) is None
def test_render(project, domain, cloud_provider, ci_provider, oauth_provider, tmp_path): config = render_config( project_name=project, qhub_domain=domain, cloud_provider=cloud_provider, ci_provider=ci_provider, repository='github.com/test/test', oauth_provider=oauth_provider, repository_auto_provision=False, oauth_auto_provision=False, kubernetes_version='1.18.0', disable_prompt=True, ) config_filename = tmp_path / (project + '.yaml') with open(config_filename, 'w') as f: yaml.dump(config, f) output_directory = tmp_path / "test" render_default_template(str(output_directory), config_filename)
def init_render(request, tmp_path): ( project, namespace, domain, cloud_provider, ci_provider, auth_provider, ) = request.param output_directory = tmp_path / f"{cloud_provider}_output_dir" output_directory.mkdir() qhub_config = output_directory / QHUB_CONFIG_FN # data that should NOT be deleted when `qhub render` is called preserved_directory = output_directory / PRESERVED_DIR preserved_directory.mkdir() preserved_filename = preserved_directory / "file.txt" preserved_filename.write_text("This is a test...") config = render_config( project_name=project, namespace=namespace, qhub_domain=domain, cloud_provider=cloud_provider, ci_provider=ci_provider, repository="github.com/test/test", auth_provider=auth_provider, repository_auto_provision=False, auth_auto_provision=False, terraform_state="remote", kubernetes_version="1.18.0", disable_prompt=True, ) yaml = YAML(typ="unsafe", pure=True) yaml.dump(config, qhub_config) render_template(str(output_directory), qhub_config, force=True) yield (output_directory, request)