Skip to content

Commit

Permalink
test: Avoid use of install with NFS
Browse files Browse the repository at this point in the history
Running the Runtime tests in CI with NFS enabled currently fails because
'install' reports a permission error when trying to change permissions
of cilium.conf.ginkgo. This commit switches 'install' for 'chmod' which
works fine.

The reason for this error is that 'install' relies on the fsetxattr(2)
system call to change the permissions and, as pointed by Quentin, there
is no support for Extended File Attributes in NFS [1]. 'install'
therefore fails whereas 'chmod', which relies on fchmodat(2) works fine.

That bug wasn't found when running the Runtime test with NFS locally
because, for local tests, a different implementation of
RenderTemplateToFile() is used, one that does not rely on 'install'.

1 - https://tools.ietf.org/html/rfc8276
Signed-off-by: Paul Chaignon <paul@cilium.io>
  • Loading branch information
pchaigno authored and aanm committed Nov 30, 2020
1 parent 81dc19b commit a77842b
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion test/helpers/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -334,10 +334,16 @@ func (s *SSHMeta) RenderTemplateToFile(filename string, tmplt string, perm os.Fi
return err
}

cmd := fmt.Sprintf("install -m %o <(echo '%s') %s\n", perm, content, filepath.Join(s.basePath, filename))
dst := filepath.Join(s.basePath, filename)
cmd := fmt.Sprintf("echo '%s' > %s", content, dst)
res := s.Exec(cmd)
if !res.WasSuccessful() {
return fmt.Errorf("%s", res.CombineOutput())
}
cmd = fmt.Sprintf("chmod %o %s", perm, dst)
res = s.Exec(cmd)
if !res.WasSuccessful() {
return fmt.Errorf("%s", res.CombineOutput())
}
return nil
}

0 comments on commit a77842b

Please sign in to comment.