Skip to content

Commit

Permalink
fix(tests): replace SSH calls
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidePrincipi committed Feb 21, 2025
1 parent e3d327a commit 2664d07
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 20 deletions.
10 changes: 5 additions & 5 deletions tests/30__api_groups_management.robot
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ Remove test users
Add group group1
Run task module/${MID1}/add-group {"group":"group1","description":"First group","users":["u1"]}

${out} ${err} ${rc} = Execute Command ssh -o "StrictHostKeyChecking=no" ${MID1}@localhost podman exec samba-dc samba-tool group show group1
${out} ${err} ${rc} = Execute Command runagent -m ${MID1} podman exec samba-dc samba-tool group show group1
... return_stderr=${TRUE} return_rc=${TRUE}
Should Be Equal As Integers ${rc} 0
Should Contain ${out} group1
Should Contain ${out} First group

${out} ${err} ${rc} = Execute Command ssh -o "StrictHostKeyChecking=no" ${MID1}@localhost podman exec samba-dc samba-tool group listmembers group1
${out} ${err} ${rc} = Execute Command runagent -m ${MID1} podman exec samba-dc samba-tool group listmembers group1
... return_stderr=${TRUE} return_rc=${TRUE}
Should Be Equal As Integers ${rc} 0
Should Contain ${out} u1
Expand All @@ -36,14 +36,14 @@ Group already exists
Alter group group1
Run task module/${MID1}/alter-group {"group":"group1","description":"chdesc","users":["u2"]}

${out} ${err} ${rc} = Execute Command ssh -o "StrictHostKeyChecking=no" ${MID1}@localhost podman exec samba-dc samba-tool group show group1
${out} ${err} ${rc} = Execute Command runagent -m ${MID1} podman exec samba-dc samba-tool group show group1
... return_stderr=${TRUE} return_rc=${TRUE}
Should Be Equal As Integers ${rc} 0
Should Contain ${out} group1
Should Not Contain ${out} First group
Should Contain ${out} Y2hkZXNjCg\=\= # Base64 encoding of "chdesc"

${out} ${err} ${rc} = Execute Command ssh -o "StrictHostKeyChecking=no" ${MID1}@localhost podman exec samba-dc samba-tool group listmembers group1
${out} ${err} ${rc} = Execute Command runagent -m ${MID1} podman exec samba-dc samba-tool group listmembers group1
... return_stderr=${TRUE} return_rc=${TRUE}
Should Be Equal As Integers ${rc} 0
Should Not Contain ${out} u1
Expand All @@ -56,6 +56,6 @@ Alter non-existing group
Remove group group1
Run task module/${MID1}/remove-group {"group":"group1"}

${out} ${err} ${rc} = Execute Command ssh -o "StrictHostKeyChecking=no" ${MID1}@localhost podman exec samba-dc samba-tool group show group1
${out} ${err} ${rc} = Execute Command runagent -m ${MID1} podman exec samba-dc samba-tool group show group1
... return_stderr=${TRUE} return_rc=${TRUE}
Should Not Be Equal As Integers ${rc} 0
12 changes: 6 additions & 6 deletions tests/30__api_users_management.robot
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@ Remove test groups
Add user first.user
Run task module/${MID1}/add-user {"user":"first.user","display_name":"First User","locked":false,"groups":["g1"]}

${out} ${err} ${rc} = Execute Command ssh -o "StrictHostKeyChecking=no" ${MID1}@localhost podman exec samba-dc pdbedit -Lv first.user
${out} ${err} ${rc} = Execute Command runagent -m ${MID1} podman exec samba-dc pdbedit -Lv first.user
... return_stderr=${TRUE} return_rc=${TRUE}
Should Be Equal As Integers ${rc} 0
Should Contain ${out} first.user
Should Contain ${out} First User
Should Not Contain ${out} [DU

${out} ${err} ${rc} = Execute Command ssh -o "StrictHostKeyChecking=no" ${MID1}@localhost podman exec samba-dc samba-tool group listmembers g1
${out} ${err} ${rc} = Execute Command runagent -m ${MID1} podman exec samba-dc samba-tool group listmembers g1
... return_stderr=${TRUE} return_rc=${TRUE}
Should Be Equal As Integers ${rc} 0
Should Contain ${out} first.user
Expand All @@ -36,7 +36,7 @@ User already exists failure
Alter user first.user
Run task module/${MID1}/alter-user {"user":"first.user","display_name":"Changed display name","locked":true,"groups":["g2"]}

${out} ${err} ${rc} = Execute Command ssh -o "StrictHostKeyChecking=no" ${MID1}@localhost podman exec samba-dc pdbedit -Lv first.user
${out} ${err} ${rc} = Execute Command runagent -m ${MID1} podman exec samba-dc pdbedit -Lv first.user
... return_stderr=${TRUE} return_rc=${TRUE}
Should Be Equal As Integers ${rc} 0
Should Contain ${out} first.user
Expand All @@ -45,12 +45,12 @@ Alter user first.user
Should Contain ${out} [DU
Should Not Contain ${out} [U

${out} ${err} ${rc} = Execute Command ssh -o "StrictHostKeyChecking=no" ${MID1}@localhost podman exec samba-dc samba-tool group listmembers g1
${out} ${err} ${rc} = Execute Command runagent -m ${MID1} podman exec samba-dc samba-tool group listmembers g1
... return_stderr=${TRUE} return_rc=${TRUE}
Should Be Equal As Integers ${rc} 0
Should Not Contain ${out} first.user

${out} ${err} ${rc} = Execute Command ssh -o "StrictHostKeyChecking=no" ${MID1}@localhost podman exec samba-dc samba-tool group listmembers g2
${out} ${err} ${rc} = Execute Command runagent -m ${MID1} podman exec samba-dc samba-tool group listmembers g2
... return_stderr=${TRUE} return_rc=${TRUE}
Should Be Equal As Integers ${rc} 0
Should Contain ${out} first.user
Expand All @@ -62,6 +62,6 @@ Alter non-existing user
Remove user first.user
Run task module/${MID1}/remove-user {"user":"first.user"}

${out} ${err} ${rc} = Execute Command ssh -o "StrictHostKeyChecking=no" ${MID1}@localhost podman exec samba-dc pdbedit -Lv first.user
${out} ${err} ${rc} = Execute Command runagent -m ${MID1} podman exec samba-dc pdbedit -Lv first.user
... return_stderr=${TRUE} return_rc=${TRUE}
Should Not Be Equal As Integers ${rc} 0
4 changes: 2 additions & 2 deletions tests/40__api_shares.robot
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@ Remove test accounts
User can write to share
[Arguments] ${user} ${share}
# Run "put" command two times, to check the file is created with proper permissions and can be overwritten too
${stdout} ${stderr} ${rc} = Execute Command ssh -o "StrictHostKeyChecking=no" ${MID1}@localhost "podman exec samba-dc smbclient -c 'put README.md ; put README.md' -U ${user} //127.0.0.1/${share} ${PASSWORD}"
${stdout} ${stderr} ${rc} = Execute Command runagent -m ${MID1} "podman exec samba-dc smbclient -c 'put README.md ; put README.md' -U ${user} //127.0.0.1/${share} ${PASSWORD}"
... return_rc=${TRUE} return_stdout=${TRUE} return_stderr=${TRUE}
Should Be Equal As Integers ${rc} ${0} msg=smbclient_failed

User can read from share
[Arguments] ${user} ${share}
${stdout} ${stderr} ${rc} = Execute Command ssh -o "StrictHostKeyChecking=no" ${MID1}@localhost "podman exec samba-dc smbclient -c 'get README.md' -U ${user} //127.0.0.1/${share} ${PASSWORD}"
${stdout} ${stderr} ${rc} = Execute Command runagent -m ${MID1} "podman exec samba-dc smbclient -c 'get README.md' -U ${user} //127.0.0.1/${share} ${PASSWORD}"
... return_rc=${TRUE} return_stdout=${TRUE} return_stderr=${TRUE}
Should Be Equal As Integers ${rc} ${0} msg=smbclient_failed

Expand Down
7 changes: 0 additions & 7 deletions tests/pythonreq.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,2 @@
robotframework
robotframework-sshlibrary
bcrypt
cffi
cryptography
paramiko
pycparser
pynacl
scp

0 comments on commit 2664d07

Please sign in to comment.