def app_spec(**kwargs): default_app_spec = AppSpec( uid="c1f34517-6f54-11ea-8eaf-0ad3d9992c8c", name="testapp", namespace="default", image="finntech/testimage:version", autoscaler=AutoscalerSpec(enabled=False, min_replicas=2, max_replicas=3, cpu_threshold_percentage=50), resources=ResourcesSpec(requests=ResourceRequirementSpec(cpu=None, memory=None), limits=ResourceRequirementSpec(cpu=None, memory=None)), admin_access=False, secrets_in_environment=False, prometheus=PrometheusSpec(enabled=True, port='http', path='/internal-backstage/prometheus'), datadog=DatadogSpec(enabled=False, tags={}), ports=[ PortSpec(protocol="http", name="http", port=80, target_port=8080), ], health_checks=HealthCheckSpec( liveness=CheckSpec(tcp=TcpCheckSpec(port=8080), http=None, execute=None, initial_delay_seconds=10, period_seconds=10, success_threshold=1, failure_threshold=3, timeout_seconds=1), readiness=CheckSpec(http=HttpCheckSpec(path="/", port=8080, http_headers={}), tcp=None, execute=None, initial_delay_seconds=10, period_seconds=10, success_threshold=1, failure_threshold=3, timeout_seconds=1)), teams=[u'foo'], tags=[u'bar'], deployment_id="test_app_deployment_id", labels=LabelAndAnnotationSpec({}, {}, {}, {}, {}, {}), annotations=LabelAndAnnotationSpec({}, {}, ANNOTATIONS.copy(), {}, {}, {}), ingresses=[IngressItemSpec(host=None, pathmappings=[IngressPathMappingSpec(path="/", port=80)], annotations={})], strongbox=StrongboxSpec(enabled=False, iam_role=None, aws_region="eu-west-1", groups=None), singleton=False, ingress_tls=IngressTlsSpec(enabled=False, certificate_issuer=None), secrets=[] ) return default_app_spec._replace(**kwargs)
# -*- coding: utf-8 import mock import pytest from k8s import config from k8s.client import NotFound from fiaas_deploy_daemon.specs.models import AppSpec, \ ResourceRequirementSpec, ResourcesSpec, PrometheusSpec, DatadogSpec, \ PortSpec, CheckSpec, HttpCheckSpec, TcpCheckSpec, HealthCheckSpec, \ AutoscalerSpec, ExecCheckSpec, LabelAndAnnotationSpec, \ IngressItemSpec, IngressPathMappingSpec, StrongboxSpec, IngressTlsSpec from minikube import MinikubeInstaller, MinikubeError from minikube.drivers import MinikubeDriverError PROMETHEUS_SPEC = PrometheusSpec(enabled=True, port='http', path='/internal-backstage/prometheus') DATADOG_SPEC = DatadogSpec(enabled=False, tags={}) AUTOSCALER_SPEC = AutoscalerSpec(enabled=False, min_replicas=2, cpu_threshold_percentage=50) EMPTY_RESOURCE_SPEC = ResourcesSpec(requests=ResourceRequirementSpec(cpu=None, memory=None), limits=ResourceRequirementSpec(cpu=None, memory=None)) # App specs @pytest.fixture def app_spec(): return AppSpec( name="testapp", namespace="default", image="finntech/testimage:version", replicas=3,