Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid Test: checkMaskedRelPaths in linux_masked_path.t #780

Open
nayuta-ai opened this issue Nov 3, 2024 · 0 comments
Open

Invalid Test: checkMaskedRelPaths in linux_masked_path.t #780

nayuta-ai opened this issue Nov 3, 2024 · 0 comments

Comments

@nayuta-ai
Copy link

In this test, the following steps are taken:

  • Declare a relative path named masked-relpath and set it in masked_path.
  • Before creating the container, check whether masked-relpath exists.
func checkMaskedRelPaths(t *tap.T) error {
	g, err := util.GetDefaultGenerator()
	if err != nil {
		return err
	}

	// Deliberately set a relative path to be masked, and expect an error
	maskedRelPath := "masked-relpath"

	g.AddLinuxMaskedPaths(maskedRelPath)
	g.AddAnnotation("TestName", "check masked relative paths")
	err = util.RuntimeInsideValidate(g, t, func(path string) error {
		testFile := filepath.Join(path, maskedRelPath)
		if _, err := os.Stat(testFile); err != nil && os.IsNotExist(err) {
			return err
		}

		return nil
	})
	if err != nil {
		return nil
	}
	return fmt.Errorf("expected: err != nil, actual: err == nil")
}

https://github.com/opencontainers/runtime-tools/blob/master/validation/linux_masked_paths/linux_masked_paths.go#L67-L90

Since masked-relpath does not exist, this check will fail at this point. This test seems unnecessary, as it would succeed with any container runtime. What is the intended purpose of this test, and what exactly is it trying to verify?

@nayuta-ai nayuta-ai changed the title An invalid test named checkMaskedRelPaths exists in validation/linux_masked_path/linux_masked_path.t. Invalid Test: checkMaskedRelPaths in linux_masked_path.t Nov 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant