Skip to content

Commit

Permalink
update exec command
Browse files Browse the repository at this point in the history
  • Loading branch information
Thanhphan1147 committed May 15, 2024
1 parent e983e29 commit e5c90c4
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions tests/integration/test_agent_k8s.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,15 @@ async def test_agent_run_sudo(
assert: the _daemon_ user has the correct sudo privileges.
"""
unit = application.units[0]
action = await unit.run("su -c 'sudo -l' -s /bin/bash _daemon_")
pebble_exec = (
"PEBBLE_SOCKET=/charm/containers/jenkins-agent-k8s/pebble.socket "
"pebble exec --user=_daemon_"
)
full_command = f"{pebble_exec} -- sudo -l"
logger.info("Enable plugins command: %s", full_command)

action = await unit.run(full_command)
await action.wait()
assert action.results["return-code"] == 0

assert action.results["return-code"] == 0, action.results["stderr"]
assert "NOPASSWD" in action.results["stdout"]

0 comments on commit e5c90c4

Please sign in to comment.