示例#1
0
def before_all(context):
    mongo_uri = 'mongodb://{0}:27017/deployer'.format(os.getenv("MONGO_HOST", 'localhost'))
    Context(context).set_mongo_uri(mongo_uri)
    __build_apps(context)
    os.environ['TARGET_ENV'] = TARGET_ENV
    os.environ['REST_API_ID'] = 'y404vvoq21'
    if __is_aws_mode(context):
        context.aws_uri = "911479539546.dkr.ecr.us-east-1.amazonaws.com/"
        context.minikube = None
        __push_apps_aws(Context(context).all_apps())
        context.domain = "heed-dev.io"
    else:
        K8sDriver.add_node_label('type', 'node')
        context.minikube = subprocess.check_output('minikube ip', shell=True)[:-1]
        context.aws_uri = ''
        context.domain = "minikube"
示例#2
0
def __create_namespace(context):
    namespace = __create_namespace_name().lower()
    print ("namespace:%s" % namespace)
    k8s = K8sDriver(namespace, context.minikube)
    k8s.create_namespace()
    Context(context).set_default_namespace(namespace)
    k8s.upload_config_folder('global-configs')
    k8s.upload_config('log4j.xml', 'log4j', 'log4j2.xml')
    k8s.create_secret('features/config/secret.yml', namespace)
    k8s.deploy('features/support/deployer-shell.yml')
示例#3
0
def service_updated(context, name, version):
    K8sDriver(Context(context).default_namespace()).verify_get(
        '%s/version' % url_for(Context(context).get_app_for(name, version)),
        lambda response: json.loads(response)['version'] == version)
示例#4
0
def should_have_ingress(context):
    service_name = context.config.userdata['lastDeployed']._service_name
    K8sDriver(Context(context).default_namespace()).has_ingress(service_name)
示例#5
0
def should_exist_autoscaler(context):
    service_name = context.config.userdata['lastDeployed']._service_name
    K8sDriver(
        Context(context).default_namespace()).has_autoscaler(service_name)
示例#6
0
def service_is_serving(context, service_name):
    K8sDriver(Context(context).default_namespace()).wait_to_serve(
        context.config.userdata['apps'][service_name])
示例#7
0
def after_scenario(context, scenario):
    for ns in Context(context).pop_namespaces_to_delete():
        K8sDriver(ns).delete_namespace()
示例#8
0
def jobs_were_invoked_on_service(context, service, version):
    K8sDriver(Context(context).default_namespace()).verify_get(
        '%s/state' % url_for(Context(context).get_app_for(service, version)),
        lambda output: json.loads(output)['state']
    )
示例#9
0
def validate_config_uploaded(context, config_name, namespace=None):
    ns = Context(context).default_namespace() if namespace is None else namespace
    K8sDriver(ns, context.minikube).verify_config_is(LocalConfig(config_name).content())
示例#10
0
def validate_config_uploaded(context, config_folder, namespace=None):
    ns = Context(context).default_namespace() if namespace is None else namespace
    K8sDriver(ns, context.minikube).verify_all_configs_in_folder(LocalConfig(config_folder).get_path())
示例#11
0
def clear_namespace(context, namespace):
    K8sDriver(namespace, context.minikube).delete_namespace()
    Context(context).add_namespace_to_delete(namespace)
示例#12
0
def verify_port_available(context):
    K8sDriver(Context(context).default_namespace()).verify_get(
        '%s/greet' % url_for(Context(context).last_deployed_app(), 5000),
        lambda output: output == "Hello Ported")
示例#13
0
def pod_running(context):
    K8sDriver(Context(context).default_namespace(), context.minikube).verify_app_is_running(
        Context(context).last_deployed_app())
def verify_config_was_overriden(context):
    K8sDriver(Context(context).default_namespace()).verify_get(
        '%s/greeting' % url_for(Context(context).last_deployed_app()),
        lambda output: output == 'Hello overridden world')
def upload_config(context, config_name):
    K8sDriver(Context(context).default_namespace(),
              context.minikube).upload_config_folder(config_name)