Skip to content

Commit

Permalink
chore: use click test helper
Browse files Browse the repository at this point in the history
  • Loading branch information
SteinRobert committed Jun 21, 2023
1 parent 954f54e commit ae1d897
Showing 1 changed file with 14 additions and 11 deletions.
25 changes: 14 additions & 11 deletions client/tests/e2e/base.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from copy import deepcopy
from unittest import mock
from click.testing import CliRunner

from gefyra.api.list import get_bridges_and_print, get_containers_and_print
from gefyra.cli.updown import cluster_up, cluster_down
Expand Down Expand Up @@ -52,10 +52,13 @@


def up():
ctx = mock.Mock()
ctx.obj = dict()
ctx.obj["kubeconfig"] = "~/.kube/config"
cluster_up(ctx)
runner = CliRunner()
runner.invoke(cluster_up)


def down():
runner = CliRunner()
runner.invoke(cluster_down)


class GefyraBaseTest:
Expand Down Expand Up @@ -403,7 +406,7 @@ def test_a_run_gefyra_up_in_another_docker_context(self):
self.assertTrue(res)
self.assert_operator_ready()
self.assert_stowaway_ready()
cluster_down()
down()
ContextAPI.set_current_context("default")
ContextAPI.remove_context("another-context")

Expand Down Expand Up @@ -673,7 +676,7 @@ def test_m_ownership_reference_check(self):
)

def test_n_run_gefyra_cluster_down(self):
res = cluster_down()
res = down()
self.assertTrue(res)
_status = status()
self.assertEqual(_status.summary, StatusSummary.DOWN)
Expand All @@ -686,7 +689,7 @@ def test_n_run_gefyra_cluster_down(self):
self.assert_namespace_not_found("gefyra")

def test_n_run_gefyra_down_again_without_errors(self):
self.test_n_run_gefyra_cluster_down()
self.down()

def test_o_reflect_occupied_port(self):
container_name = "busybox"
Expand Down Expand Up @@ -725,7 +728,7 @@ def test_p_reflect(self):
self._stop_container(
container="gefyra-reflect-default-deploy-bye-nginxdemo-8000"
)
res = cluster_down()
res = down()
self.assertTrue(res)

def test_p_reflect_port_overwrite(self):
Expand All @@ -747,7 +750,7 @@ def test_p_reflect_port_overwrite(self):
self._stop_container(
container="gefyra-reflect-default-deploy-bye-nginxdemo-8000"
)
res = cluster_down()
res = down()
self.assertTrue(res)

def test_p_reflect_image_overwrite(self):
Expand Down Expand Up @@ -775,7 +778,7 @@ def test_p_reflect_image_overwrite(self):
self._stop_container(
container="gefyra-reflect-default-deploy-bye-nginxdemo-8000"
)
res = cluster_down()
res = down()
self.assertTrue(res)

def test_util_for_pod_not_found(self):
Expand Down

0 comments on commit ae1d897

Please sign in to comment.