Skip to content

Commit

Permalink
Merge pull request #2 from SmithChart/cfi/ptx-nfs-mounts
Browse files Browse the repository at this point in the history
ptx-flavor: New NFS mounts
  • Loading branch information
SmithChart authored Oct 10, 2024
2 parents 54aba7d + ec4814f commit 64019e2
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 23 deletions.
2 changes: 1 addition & 1 deletion .codespellrc
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
[codespell]
skip = ./.git,./env,./venv,./envs
skip = ./.git,./env,./venv,./envs,console_main
9 changes: 7 additions & 2 deletions lxatac-ptx.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,17 +41,22 @@ targets:
ethmux: "ethmux"
options:
ptx-works-available:
- /ptx/work/WORK_ALPHO
- /ptx/work/WORK_BOOME
- /ptx/work/WORK_CHIEF
- /ptx/work/WORK_DAETU
- /ptx/work/WORK_EFOHW
- /ptx/work/WORK_EIHEI
- /ptx/work/WORK_GIEME
- /ptx/work/WORK_IEQUE
- /ptx/work/WORK_JALLU
- /ptx/work/WORK_KOOYE
- /ptx/work/WORK_MOHCH
- /ptx/work/WORK_NOOTH
- /ptx/work/WORK_SANAH
- /ptx/work/WORK_THEIP
- /ptx/work/WORK_UOTHA
- /ptx/work/WORK_XUNGI
- /ptx/work/WORK_JALLU
- /ptx/work/WORK_MOHCH
usb_storage: /dev/disk/by-path/platform-5800d000.usb-usbv2-0:1.1:1.0-scsi-0:0:0:0
features:
- ptx-flavor
Expand Down
48 changes: 28 additions & 20 deletions tests/test_network.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,30 +129,38 @@ def test_network_interfaces(shell):


@pytest.mark.lg_feature("ptx-flavor")
def test_network_nfs_io(shell):
def test_network_nfs_io(env, target, shell):
"""Test nfs share io"""
ptx_works = shell.target.env.config.get_target_option(shell.target.name, "ptx-works-available")
assert len(ptx_works) > 0

mount = shell.run_check("mount")
mount = "\n".join(mount)
ptx_works = set(env.config.get_target_option(target.name, "ptx-works-available"))

readable = set()
writeable = set()
missing = set()
# Iterate over all available shares and check whether io operation is possible
for ptx_work in ptx_works:
assert ptx_work in mount

dir_contents = shell.run_check(f"ls -1 {ptx_work}")
# make sure the directories contain something
assert len(dir_contents) > 0

shell.run_check(f"cd {ptx_work}")

# Create a file on the share
file, _, returncode = shell.run("mktemp -p .")
assert returncode == 0
assert len(file) > 0

shell.run_check(f"rm {file[0]}")
# Check if an automount unit has been created
_, _, rc = shell.run(f"findmnt --json {ptx_work} -t autofs")
if rc != 0:
missing.add(ptx_work)

# Make sure the directories contain something
dir_contents, _, rc = shell.run(f"ls -1 {ptx_work}", timeout=60)
# Timeout of the automount-units are a generous 30s.
# Let's use a much longer timeout for our commands to catch all problems on the DUT.
if len(dir_contents) > 0 and rc == 0:
readable.add(ptx_work)

# Check if the share is mounted readonly
stdout, _, rc = shell.run(f"findmnt --json {ptx_work} -t nfs4")
# Ignore if we do not find the mountpoint here, since one of the other tests very likely found the problem.
if rc == 0:
[fs_info] = json.loads("\n".join(stdout))["filesystems"]
if "rw" in fs_info["options"].split(","):
writeable.add(ptx_work)

assert missing == set(), "These ptx-works do not have corresponding automount-units"
assert ptx_works == readable, "Mounts are not readable"
assert writeable == set(), "Mounts are writeable but should not be"


def test_network_http_io(strategy, shell):
Expand Down

0 comments on commit 64019e2

Please sign in to comment.