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

Commit

Permalink
Improve testing
Browse files Browse the repository at this point in the history
  • Loading branch information
Akm0d committed Sep 3, 2024
1 parent eec4bba commit ae55978
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
10 changes: 7 additions & 3 deletions tests/helpers/cmd.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
async def run(hub, subcommand: str, target: str = "*", *args):
with hub.test.container.roster() as rf:
command = f"{hub.lib.sys.executable} -m soluble --no-host-keys -i --log-level=debug --salt-config-dir {hub.test.SALT_CONFIG_DIR} -R {rf} {subcommand} '{target}' {' '.join(args)}"
command = f"{hub.lib.sys.executable} -m soluble -i --no-host-keys --hard-crash --log-level=debug --salt-config-dir {hub.test.SALT_CONFIG_DIR} -R {rf} {subcommand} '{target}' {' '.join(args)}"
print(f"Running command: {command}")

# Run the command asynchronously
Expand All @@ -9,10 +9,14 @@ async def run(hub, subcommand: str, target: str = "*", *args):
stdout=hub.lib.asyncio.subprocess.PIPE,
)

await hub.lib.asyncio.sleep(2)
await hub.lib.asyncio.sleep(0)

# Capture the stdout and stderr
stdout, _ = await process.communicate()
try:
stdout, _ = await process.communicate()
except KeyboardInterrupt:
process.terminate()
raise hub.lib.pytest.fail("Received interrupt")

# Decode the output
stdout = stdout.decode()
Expand Down
2 changes: 1 addition & 1 deletion tests/helpers/container.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ async def create(hub, username: str = "root", password: str = "pass"):
target_name = f"soluble_agent_{hub.lib.uuid.uuid4()}"

container = client.containers.run(
"python:3.10-slim",
"python:3.10",
command=[
"/bin/sh",
"-c",
Expand Down

0 comments on commit ae55978

Please sign in to comment.