Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
Signed-off-by: hamistao <[email protected]>
  • Loading branch information
hamistao committed Jan 11, 2025
1 parent 261a809 commit c56241b
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 11 deletions.
23 changes: 12 additions & 11 deletions integration/test_containers.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,19 +158,20 @@ def test_execute(self):

def test_execute_no_buffer(self):
"""A command is executed on the container without buffering the output."""
self.container.start(wait=True)
self.addCleanup(self.container.stop, wait=True)
time.sleep(
1
) # Wait a little to make sure the container is ready to exec since it has just been started.
buffer = []
while True:
self.container.start(wait=True)
self.addCleanup(self.container.stop, wait=True)
buffer = []

result = self.container.execute(["echo", "test"], stdout_handler=buffer.append)
result = self.container.execute(["echo", "test"], stdout_handler=buffer.append)

self.assertEqual(0, result.exit_code)
self.assertEqual("", result.stdout)
self.assertEqual("", result.stderr)
self.assertEqual("test\n", "".join(buffer))
self.assertEqual(0, result.exit_code)
self.assertEqual("", result.stdout)
self.assertEqual("", result.stderr)
self.assertEqual("test\n", "".join(buffer))

self.container.stop(wait=True)
time.sleep(1)

def test_execute_no_decode(self):
"""A command is executed on the container that isn't utf-8 decodable"""
Expand Down
4 changes: 4 additions & 0 deletions pylxd/models/instance.py
Original file line number Diff line number Diff line change
Expand Up @@ -519,6 +519,10 @@ def execute(
manager.stop()
manager.join()

print(operation.metadata)
print(stdout.data)
print(stderr.data)

return _InstanceExecuteResult(
operation.metadata["return"], stdout.data, stderr.data
)
Expand Down

0 comments on commit c56241b

Please sign in to comment.