outposts: fix defaults and tests for outposts

This commit is contained in:
Jens Langhammer
2020-11-04 10:54:44 +01:00
parent 706448dc14
commit 3b76af4eaa
14 changed files with 136 additions and 61 deletions

View File

@ -6,7 +6,7 @@ import yaml
from django.test import TestCase
from passbook.flows.models import Flow
from passbook.outposts.models import Outpost, OutpostDeploymentType, OutpostType
from passbook.outposts.models import KubernetesServiceConnection, Outpost, OutpostType
from passbook.providers.proxy.controllers.kubernetes import ProxyKubernetesController
from passbook.providers.proxy.models import ProxyProvider
@ -23,15 +23,16 @@ class TestControllers(TestCase):
external_host="http://localhost",
authorization_flow=Flow.objects.first(),
)
service_connection = KubernetesServiceConnection.objects.get(local=True)
outpost: Outpost = Outpost.objects.create(
name="test",
type=OutpostType.PROXY,
deployment_type=OutpostDeploymentType.KUBERNETES,
service_connection=service_connection,
)
outpost.providers.add(provider)
outpost.save()
controller = ProxyKubernetesController(outpost)
controller = ProxyKubernetesController(outpost, service_connection)
manifest = controller.get_static_deployment()
self.assertEqual(len(list(yaml.load_all(manifest, Loader=yaml.SafeLoader))), 4)
@ -43,14 +44,15 @@ class TestControllers(TestCase):
external_host="http://localhost",
authorization_flow=Flow.objects.first(),
)
service_connection = KubernetesServiceConnection.objects.get(local=True)
outpost: Outpost = Outpost.objects.create(
name="test",
type=OutpostType.PROXY,
deployment_type=OutpostDeploymentType.KUBERNETES,
service_connection=service_connection,
)
outpost.providers.add(provider)
outpost.save()
controller = ProxyKubernetesController(outpost)
controller = ProxyKubernetesController(outpost, service_connection)
controller.up()
controller.down()