diff options
| author | Ophestra <cat@gensokyo.uk> | 2026-02-08 19:35:20 +0900 |
|---|---|---|
| committer | Ophestra <cat@gensokyo.uk> | 2026-02-08 19:35:20 +0900 |
| commit | 90a38c070892b91e6a4db4a3196de4e547e869e8 (patch) | |
| tree | 3e51fe5907c80450278fe188d06929bafcdfb4ab | |
| parent | 39cc8caa93107ba7cfb612dc071332b31574b60d (diff) | |
container: strip host-dependent opts in test cases
This change also improves plumbing for stripping options.
Signed-off-by: Ophestra <cat@gensokyo.uk>
| -rw-r--r-- | container/container_test.go | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/container/container_test.go b/container/container_test.go index 98713cbd..59b8bc87 100644 --- a/container/container_test.go +++ b/container/container_test.go @@ -690,14 +690,22 @@ func init() { return fmt.Errorf("got more than %d entries", len(mnt)) } - // ugly hack but should be reliable and is less likely to false negative than comparing by parsed flags - cur.VfsOptstr = strings.TrimSuffix(cur.VfsOptstr, ",relatime") - cur.VfsOptstr = strings.TrimSuffix(cur.VfsOptstr, ",noatime") - mnt[i].VfsOptstr = strings.TrimSuffix(mnt[i].VfsOptstr, ",relatime") - mnt[i].VfsOptstr = strings.TrimSuffix(mnt[i].VfsOptstr, ",noatime") - - cur.FsOptstr = strings.Replace(cur.FsOptstr, ",seclabel", "", 1) - mnt[i].FsOptstr = strings.Replace(mnt[i].FsOptstr, ",seclabel", "", 1) + // ugly hack but should be reliable and is less likely to + //false negative than comparing by parsed flags + for _, s := range []string{ + "relatime", + "noatime", + } { + cur.VfsOptstr = strings.TrimSuffix(cur.VfsOptstr, ","+s) + mnt[i].VfsOptstr = strings.TrimSuffix(mnt[i].VfsOptstr, ","+s) + } + for _, s := range []string{ + "seclabel", + "inode64", + } { + cur.FsOptstr = strings.Replace(cur.FsOptstr, ","+s, "", 1) + mnt[i].FsOptstr = strings.Replace(mnt[i].FsOptstr, ","+s, "", 1) + } if !cur.EqualWithIgnore(mnt[i], "\x00") { fail = true |
