test/system: CopyDirectory() do not chown files

If the source dir is owned by another user then the test the chown will
fail assuming we run the tests rootless. This function is only used by
the quadlet tests and for the purpose all we need is to read the files
so the simple fix is remove the chown as this should make the tests pass
on the special debian gating env.

Fixes #24802

Signed-off-by: Paul Holzinger <git@holzinger.dev>
This commit is contained in:
Paul Holzinger
2024-12-17 17:05:47 +01:00
parent 8729725684
commit 23d4908c8b

View File

@ -20,7 +20,6 @@ import (
"strconv"
"strings"
"sync"
"syscall"
"testing"
"time"
@ -1469,11 +1468,6 @@ func CopyDirectory(srcDir, dest string) error {
return err
}
stat, ok := fileInfo.Sys().(*syscall.Stat_t)
if !ok {
return fmt.Errorf("failed to get raw syscall.Stat_t data for %q", sourcePath)
}
switch fileInfo.Mode() & os.ModeType {
case os.ModeDir:
if err := os.MkdirAll(destPath, 0755); err != nil {
@ -1492,10 +1486,6 @@ func CopyDirectory(srcDir, dest string) error {
}
}
if err := os.Lchown(destPath, int(stat.Uid), int(stat.Gid)); err != nil {
return err
}
fInfo, err := entry.Info()
if err != nil {
return err