Skip to content
This repository has been archived by the owner on Jan 14, 2024. It is now read-only.

Commit

Permalink
tests: Add test test_exec_inside_application_pod_finds_mounted_file
Browse files Browse the repository at this point in the history
  • Loading branch information
blackandred committed Jan 29, 2022
1 parent f910acf commit f7976e3
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions test/test_transports_kubernetes_transports.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,27 @@ def test_backup_side_pod_operates_on_same_volumes_as_original_application(self,
self.assertTrue(run_transport(definition, transport))
self.assertIn("I have never read Marx Capital, but I have the marks of capital all over me.", io.get_value())

@patch('bahub.transports.kubernetes_podexec.create_backup_maker_command')
def test_exec_inside_application_pod_finds_mounted_file(self, create_backup_maker_command):
"""
We do a `kubectl exec` into a running POD and execute a command, grab result
"""

io = BufferedSystemIO()
io.set_log_level('debug')
transport = PodExecTransport(
spec={
'selector': "app=nginx", # see: test/env/kubernetes/nginx
'namespace': 'default',
},
io=io
)
definition = create_example_fs_definition(transport)

create_backup_maker_command.return_value = ["cat", "/var/www/msg.html"]
self.assertTrue(run_transport(definition, transport))
self.assertIn("I have never read Marx Capital, but I have the marks of capital all over me.", io.get_value())

@classmethod
def setUpClass(cls) -> None:
super(TestKubernetesTransport, cls).setUpClass()
Expand Down

0 comments on commit f7976e3

Please sign in to comment.