예제 #1
0
def test_create_mysql_database(kubernetes: Kubernetes, test_namespace: str,
                               helm: Helm) -> None:
    helm_test_repo_url = os.environ.get("TEST_HELM_REGISTRY",
                                        "http://localhost:8080")
    helm.add_repo("testing", helm_test_repo_url)

    track = DEFAULT_TRACK

    mysql_service = MysqlService(track=track, chart="testing/mysql")

    kubernetes.deploy_service(service=mysql_service,
                              namespace=test_namespace,
                              track=track)
예제 #2
0
def test_lifecycle_hooks_deployment(_: mock.MagicMock) -> None:
    ns = track = "testing"
    project = Project(track=track, url="example.com")
    service = mock.MagicMock()

    k = Kubernetes(track=track)
    k.helm = mock.MagicMock(**{"upgrade_chart.return_value.return_code": 0})
    mock.patch("kolga.libs.kubernetes.KubeLoggerThread")

    Plugin, hook_calls = call_tracking_plugin_factory()
    with load_plugin(Plugin):
        k.deploy_service(namespace=ns, service=service, track=track)
        k.create_application_deployment(namespace=ns,
                                        project=project,
                                        track=track)

    assert [*hook_calls.keys()] == [
        "service_deployment_begin",
        "service_deployment_complete",
        "project_deployment_begin",
        "project_deployment_complete",
    ]