Skip to content

Commit d30406f

Browse files
authored
Test: Fix test framework permissions (#1271)
Enable running tests as non-root.
1 parent f8d29f8 commit d30406f

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

tests/validation/common/nicctl.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ def create_vfs(self, pci_id: str, num_of_vfs: int = 6) -> list:
4444
:return: returns list of created vfs
4545
"""
4646
resp = self.connection.execute_command(
47-
f"{self.nicctl} create_vf {pci_id} {num_of_vfs}", shell=True
47+
f"sudo {self.nicctl} create_vf {pci_id} {num_of_vfs}", shell=True
4848
)
4949
return self._parse_vf_list(resp.stdout)
5050

tests/validation/conftest.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ def media_file(media_ramdisk, request, hosts, test_config):
176176
ramdisk_mountpoint, media_file_info["filename"]
177177
)
178178
for host in hosts.values():
179-
cmd = f"cp {src_media_file_path} {ramdisk_media_file_path}"
179+
cmd = f"sudo cp {src_media_file_path} {ramdisk_media_file_path}"
180180
try:
181181
host.connection.execute_command(cmd)
182182
except ConnectionCalledProcessError as e:
@@ -185,7 +185,7 @@ def media_file(media_ramdisk, request, hosts, test_config):
185185
)
186186
yield media_file_info, ramdisk_media_file_path
187187
for host in hosts.values():
188-
cmd = f"rm {ramdisk_media_file_path}"
188+
cmd = f"sudo rm {ramdisk_media_file_path}"
189189
try:
190190
host.connection.execute_command(cmd)
191191
except ConnectionCalledProcessError as e:

tests/validation/mtl_engine/ramdisk.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,16 @@ def __init__(self, host, mount_point, size_gib):
1111

1212
def mount(self):
1313
try:
14-
self._host.connection.execute_command(f"mkdir -p {self._mount_point}")
14+
self._host.connection.execute_command(f"sudo mkdir -p {self._mount_point}")
1515
self._host.connection.execute_command(
16-
f"mount -t ramfs -o size={self._size_gib}G ramfs {self._mount_point}"
16+
f"sudo mount -t ramfs -o size={self._size_gib}G ramfs {self._mount_point}"
1717
)
1818
except ConnectionCalledProcessError as e:
1919
logging.log(level=logging.ERROR, msg=f"Failed to execute command: {e}")
2020

2121
def unmount(self):
2222
try:
23-
self._host.connection.execute_command(f"umount {self._mount_point}")
24-
self._host.connection.execute_command(f"rmdir {self._mount_point}")
23+
self._host.connection.execute_command(f"sudo umount {self._mount_point}")
24+
self._host.connection.execute_command(f"sudo rmdir {self._mount_point}")
2525
except ConnectionCalledProcessError as e:
2626
logging.log(level=logging.ERROR, msg=f"Failed to execute command: {e}")

0 commit comments

Comments
 (0)