Merge pull request #46317 from thaJeztah/gofumpt_all_the_things
Format code with gofumpt
This commit is contained in:
commit
f10e182ca7
26 changed files with 49 additions and 54 deletions
|
@ -541,7 +541,6 @@ func (s *containerRouter) postContainersCreate(ctx context.Context, w http.Respo
|
|||
bo.CreateMountpoint = false
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if hostConfig != nil && versions.LessThan(version, "1.44") {
|
||||
|
|
|
@ -162,7 +162,7 @@ func openHistoryDB(root string, cfg *config.BuilderHistoryConfig) (*bolt.DB, *bk
|
|||
}
|
||||
|
||||
func newGraphDriverController(ctx context.Context, rt http.RoundTripper, opt Opt) (*control.Controller, error) {
|
||||
if err := os.MkdirAll(opt.Root, 0711); err != nil {
|
||||
if err := os.MkdirAll(opt.Root, 0o711); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
|
|
|
@ -175,7 +175,7 @@ func (container *Container) toDisk() (*Container, error) {
|
|||
}
|
||||
|
||||
// Save container settings
|
||||
f, err := ioutils.NewAtomicFileWriter(pth, 0600)
|
||||
f, err := ioutils.NewAtomicFileWriter(pth, 0o600)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -250,7 +250,7 @@ func (container *Container) WriteHostConfig() (*containertypes.HostConfig, error
|
|||
return nil, err
|
||||
}
|
||||
|
||||
f, err := ioutils.NewAtomicFileWriter(pth, 0600)
|
||||
f, err := ioutils.NewAtomicFileWriter(pth, 0o600)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -279,7 +279,7 @@ func (container *Container) SetupWorkingDirectory(rootIdentity idtools.Identity)
|
|||
return err
|
||||
}
|
||||
|
||||
if err := idtools.MkdirAllAndChownNew(pth, 0755, rootIdentity); err != nil {
|
||||
if err := idtools.MkdirAllAndChownNew(pth, 0o755, rootIdentity); err != nil {
|
||||
pthInfo, err2 := os.Stat(pth)
|
||||
if err2 == nil && pthInfo != nil && !pthInfo.IsDir() {
|
||||
return errors.Errorf("Cannot mkdir: %s is not a directory", container.Config.WorkingDir)
|
||||
|
@ -402,7 +402,7 @@ func (container *Container) StartLogger() (logger.Logger, error) {
|
|||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if err := os.MkdirAll(logDir, 0700); err != nil {
|
||||
if err := os.MkdirAll(logDir, 0o700); err != nil {
|
||||
return nil, errdefs.System(errors.Wrap(err, "error creating local logs dir"))
|
||||
}
|
||||
info.LogPath = filepath.Join(logDir, "container.log")
|
||||
|
|
|
@ -60,7 +60,7 @@ func (container *Container) BuildHostnameFile() error {
|
|||
return err
|
||||
}
|
||||
container.HostnamePath = hostnamePath
|
||||
return os.WriteFile(container.HostnamePath, []byte(container.Config.Hostname+"\n"), 0644)
|
||||
return os.WriteFile(container.HostnamePath, []byte(container.Config.Hostname+"\n"), 0o644)
|
||||
}
|
||||
|
||||
// NetworkMounts returns the list of network mounts.
|
||||
|
|
|
@ -32,7 +32,7 @@ func newContainer(t *testing.T) *Container {
|
|||
id = uuid.New().String()
|
||||
cRoot = filepath.Join(root, id)
|
||||
)
|
||||
if err := os.MkdirAll(cRoot, 0755); err != nil {
|
||||
if err := os.MkdirAll(cRoot, 0o755); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
c := NewBaseContainer(id, cRoot)
|
||||
|
|
|
@ -25,11 +25,11 @@ func main() {
|
|||
}
|
||||
|
||||
// make sure /etc/apparmor.d exists
|
||||
if err := os.MkdirAll(path.Dir(apparmorProfilePath), 0755); err != nil {
|
||||
if err := os.MkdirAll(path.Dir(apparmorProfilePath), 0o755); err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
f, err := os.OpenFile(apparmorProfilePath, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0644)
|
||||
f, err := os.OpenFile(apparmorProfilePath, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0o644)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@ import (
|
|||
func makeConfigFile(t *testing.T, content string) string {
|
||||
t.Helper()
|
||||
name := filepath.Join(t.TempDir(), "daemon.json")
|
||||
err := os.WriteFile(name, []byte(content), 0666)
|
||||
err := os.WriteFile(name, []byte(content), 0o666)
|
||||
assert.NilError(t, err)
|
||||
return name
|
||||
}
|
||||
|
|
|
@ -95,7 +95,7 @@ func initRuntimesDir(cfg *config.Config) error {
|
|||
if err := os.RemoveAll(runtimeDir); err != nil {
|
||||
return err
|
||||
}
|
||||
return system.MkdirAll(runtimeDir, 0700)
|
||||
return system.MkdirAll(runtimeDir, 0o700)
|
||||
}
|
||||
|
||||
func setupRuntimes(cfg *config.Config) (runtimes, error) {
|
||||
|
@ -193,7 +193,7 @@ func wrapRuntime(dir, name, binary string, args []string) (string, error) {
|
|||
// containers.
|
||||
suffix := base32Disemvoweled.EncodeToString(sum.Sum(nil))
|
||||
scriptPath := filepath.Join(dir, name+"."+suffix)
|
||||
if err := ioutils.AtomicWriteFile(scriptPath, wrapper.Bytes(), 0700); err != nil {
|
||||
if err := ioutils.AtomicWriteFile(scriptPath, wrapper.Bytes(), 0o700); err != nil {
|
||||
return "", err
|
||||
}
|
||||
return scriptPath, nil
|
||||
|
|
|
@ -93,7 +93,7 @@ func (m *refCountMounter) Mount(mounts []mount.Mount, containerID string) (targe
|
|||
}()
|
||||
|
||||
root := m.idMap.RootPair()
|
||||
if err := idtools.MkdirAllAndChown(target, 0700, root); err != nil {
|
||||
if err := idtools.MkdirAllAndChown(target, 0o700, root); err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
|
@ -129,7 +129,7 @@ func (m mounter) Mount(mounts []mount.Mount, containerID string) (string, error)
|
|||
target := filepath.Join(m.home, mountsDir, m.snapshotter, containerID)
|
||||
|
||||
root := m.idMap.RootPair()
|
||||
if err := idtools.MkdirAndChown(target, 0700, root); err != nil {
|
||||
if err := idtools.MkdirAndChown(target, 0o700, root); err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
|
|
10
image/fs.go
10
image/fs.go
|
@ -47,10 +47,10 @@ func newFSStore(root string) (*fs, error) {
|
|||
s := &fs{
|
||||
root: root,
|
||||
}
|
||||
if err := os.MkdirAll(filepath.Join(root, contentDirName, string(digest.Canonical)), 0700); err != nil {
|
||||
if err := os.MkdirAll(filepath.Join(root, contentDirName, string(digest.Canonical)), 0o700); err != nil {
|
||||
return nil, errors.Wrap(err, "failed to create storage backend")
|
||||
}
|
||||
if err := os.MkdirAll(filepath.Join(root, metadataDirName, string(digest.Canonical)), 0700); err != nil {
|
||||
if err := os.MkdirAll(filepath.Join(root, metadataDirName, string(digest.Canonical)), 0o700); err != nil {
|
||||
return nil, errors.Wrap(err, "failed to create storage backend")
|
||||
}
|
||||
return s, nil
|
||||
|
@ -118,7 +118,7 @@ func (s *fs) Set(data []byte) (digest.Digest, error) {
|
|||
}
|
||||
|
||||
dgst := digest.FromBytes(data)
|
||||
if err := ioutils.AtomicWriteFile(s.contentFile(dgst), data, 0600); err != nil {
|
||||
if err := ioutils.AtomicWriteFile(s.contentFile(dgst), data, 0o600); err != nil {
|
||||
return "", errors.Wrap(err, "failed to write digest data")
|
||||
}
|
||||
|
||||
|
@ -145,10 +145,10 @@ func (s *fs) SetMetadata(dgst digest.Digest, key string, data []byte) error {
|
|||
}
|
||||
|
||||
baseDir := filepath.Join(s.metadataDir(dgst))
|
||||
if err := os.MkdirAll(baseDir, 0700); err != nil {
|
||||
if err := os.MkdirAll(baseDir, 0o700); err != nil {
|
||||
return err
|
||||
}
|
||||
return ioutils.AtomicWriteFile(filepath.Join(s.metadataDir(dgst), key), data, 0600)
|
||||
return ioutils.AtomicWriteFile(filepath.Join(s.metadataDir(dgst), key), data, 0o600)
|
||||
}
|
||||
|
||||
// GetMetadata returns metadata for a given digest.
|
||||
|
|
|
@ -66,7 +66,7 @@ func TestFSInvalidRoot(t *testing.T) {
|
|||
for _, tc := range tcases {
|
||||
root := filepath.Join(tmpdir, tc.root)
|
||||
filePath := filepath.Join(tmpdir, tc.invalidFile)
|
||||
err := os.MkdirAll(filepath.Dir(filePath), 0700)
|
||||
err := os.MkdirAll(filepath.Dir(filePath), 0o700)
|
||||
assert.Check(t, err)
|
||||
|
||||
f, err := os.Create(filePath)
|
||||
|
@ -128,7 +128,7 @@ func TestFSInvalidWalker(t *testing.T) {
|
|||
fooID, err := store.Set([]byte("foo"))
|
||||
assert.Check(t, err)
|
||||
|
||||
err = os.WriteFile(filepath.Join(store.(*fs).root, contentDirName, "sha256/foobar"), []byte("foobar"), 0600)
|
||||
err = os.WriteFile(filepath.Join(store.(*fs).root, contentDirName, "sha256/foobar"), []byte("foobar"), 0o600)
|
||||
assert.Check(t, err)
|
||||
|
||||
n := 0
|
||||
|
|
|
@ -301,7 +301,7 @@ func (s *saveSession) save(outStream io.Writer) error {
|
|||
|
||||
if len(reposLegacy) > 0 {
|
||||
reposFile := filepath.Join(tempDir, legacyRepositoriesFileName)
|
||||
rf, err := os.OpenFile(reposFile, os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0644)
|
||||
rf, err := os.OpenFile(reposFile, os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0o644)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
@ -319,7 +319,7 @@ func (s *saveSession) save(outStream io.Writer) error {
|
|||
}
|
||||
|
||||
manifestPath := filepath.Join(tempDir, manifestFileName)
|
||||
f, err := os.OpenFile(manifestPath, os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0644)
|
||||
f, err := os.OpenFile(manifestPath, os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0o644)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
@ -460,11 +460,11 @@ func (s *saveSession) saveLayer(id layer.ChainID, legacyImg image.V1Image, creat
|
|||
|
||||
cfgDgst := digest.FromBytes(imageConfig)
|
||||
configPath := filepath.Join(outDir, cfgDgst.Algorithm().String(), cfgDgst.Encoded())
|
||||
if err := os.MkdirAll(filepath.Dir(configPath), 0755); err != nil {
|
||||
if err := os.MkdirAll(filepath.Dir(configPath), 0o755); err != nil {
|
||||
return distribution.Descriptor{}, errors.Wrap(err, "could not create layer dir parent")
|
||||
}
|
||||
|
||||
if err := os.WriteFile(configPath, imageConfig, 0644); err != nil {
|
||||
if err := os.WriteFile(configPath, imageConfig, 0o644); err != nil {
|
||||
return distribution.Descriptor{}, err
|
||||
}
|
||||
|
||||
|
@ -485,7 +485,7 @@ func (s *saveSession) saveLayer(id layer.ChainID, legacyImg image.V1Image, creat
|
|||
|
||||
// We use sequential file access to avoid depleting the standby list on
|
||||
// Windows. On Linux, this equates to a regular os.Create.
|
||||
if err := os.MkdirAll(filepath.Dir(layerPath), 0755); err != nil {
|
||||
if err := os.MkdirAll(filepath.Dir(layerPath), 0o755); err != nil {
|
||||
return distribution.Descriptor{}, errors.Wrap(err, "could not create layer dir parent")
|
||||
}
|
||||
tarFile, err := sequential.Create(layerPath)
|
||||
|
|
|
@ -700,7 +700,7 @@ func TestBuildPlatformInvalid(t *testing.T) {
|
|||
func writeTarRecord(t *testing.T, w *tar.Writer, fn, contents string) {
|
||||
err := w.WriteHeader(&tar.Header{
|
||||
Name: fn,
|
||||
Mode: 0600,
|
||||
Mode: 0o600,
|
||||
Size: int64(len(contents)),
|
||||
Typeflag: '0',
|
||||
})
|
||||
|
|
|
@ -100,9 +100,7 @@ func TestNoNewPrivileges(t *testing.T) {
|
|||
}
|
||||
if stdErr != tc.stdErr {
|
||||
t.Fatalf("test produced invalid error: %q, expected %q. Stdout:%q", stdErr, tc.stdErr, stdOut)
|
||||
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -268,7 +268,7 @@ func TestTemplatedConfig(t *testing.T) {
|
|||
Name: "templated_config",
|
||||
UID: "0",
|
||||
GID: "0",
|
||||
Mode: 0600,
|
||||
Mode: 0o600,
|
||||
},
|
||||
ConfigID: templatedConfig.ID,
|
||||
ConfigName: templatedConfigName,
|
||||
|
@ -280,7 +280,7 @@ func TestTemplatedConfig(t *testing.T) {
|
|||
Name: "referencedconfigtarget",
|
||||
UID: "0",
|
||||
GID: "0",
|
||||
Mode: 0600,
|
||||
Mode: 0o600,
|
||||
},
|
||||
ConfigID: referencedConfig.ID,
|
||||
ConfigName: referencedConfigName,
|
||||
|
@ -292,7 +292,7 @@ func TestTemplatedConfig(t *testing.T) {
|
|||
Name: "referencedsecrettarget",
|
||||
UID: "0",
|
||||
GID: "0",
|
||||
Mode: 0600,
|
||||
Mode: 0o600,
|
||||
},
|
||||
SecretID: referencedSecret.ID,
|
||||
SecretName: referencedSecretName,
|
||||
|
|
|
@ -155,7 +155,7 @@ func TestConfigDaemonSeccompProfiles(t *testing.T) {
|
|||
d.Stop(t)
|
||||
|
||||
cfg := filepath.Join(d.RootDir(), "daemon.json")
|
||||
err := os.WriteFile(cfg, []byte(`{"seccomp-profile": "`+tc.profile+`"}`), 0644)
|
||||
err := os.WriteFile(cfg, []byte(`{"seccomp-profile": "`+tc.profile+`"}`), 0o644)
|
||||
assert.NilError(t, err)
|
||||
|
||||
d.Start(t, "--config-file", cfg)
|
||||
|
@ -285,7 +285,7 @@ func TestDaemonProxy(t *testing.T) {
|
|||
|
||||
configFile := filepath.Join(d.RootDir(), "daemon.json")
|
||||
configJSON := fmt.Sprintf(`{"proxies":{"http-proxy":%[1]q, "https-proxy": %[1]q, "no-proxy": "example.com"}}`, proxyServer.URL)
|
||||
assert.NilError(t, os.WriteFile(configFile, []byte(configJSON), 0644))
|
||||
assert.NilError(t, os.WriteFile(configFile, []byte(configJSON), 0o644))
|
||||
|
||||
d.Start(t, "--iptables=false", "--config-file", configFile)
|
||||
defer d.Stop(t)
|
||||
|
@ -327,7 +327,7 @@ func TestDaemonProxy(t *testing.T) {
|
|||
|
||||
configFile := filepath.Join(d.RootDir(), "daemon.json")
|
||||
configJSON := fmt.Sprintf(`{"proxies":{"http-proxy":%[1]q, "https-proxy": %[1]q, "no-proxy": "example.com"}}`, proxyRawURL)
|
||||
assert.NilError(t, os.WriteFile(configFile, []byte(configJSON), 0644))
|
||||
assert.NilError(t, os.WriteFile(configFile, []byte(configJSON), 0o644))
|
||||
|
||||
err := d.StartWithError("--http-proxy", proxyRawURL, "--https-proxy", proxyRawURL, "--no-proxy", "example.com", "--config-file", configFile, "--validate")
|
||||
assert.ErrorContains(t, err, "daemon exited during startup")
|
||||
|
|
|
@ -277,7 +277,7 @@ func TestTemplatedSecret(t *testing.T) {
|
|||
Name: "templated_secret",
|
||||
UID: "0",
|
||||
GID: "0",
|
||||
Mode: 0600,
|
||||
Mode: 0o600,
|
||||
},
|
||||
SecretID: templatedSecret.ID,
|
||||
SecretName: templatedSecretName,
|
||||
|
@ -289,7 +289,7 @@ func TestTemplatedSecret(t *testing.T) {
|
|||
Name: "referencedconfigtarget",
|
||||
UID: "0",
|
||||
GID: "0",
|
||||
Mode: 0600,
|
||||
Mode: 0o600,
|
||||
},
|
||||
ConfigID: referencedConfig.ID,
|
||||
ConfigName: referencedConfigName,
|
||||
|
@ -301,7 +301,7 @@ func TestTemplatedSecret(t *testing.T) {
|
|||
Name: "referencedsecrettarget",
|
||||
UID: "0",
|
||||
GID: "0",
|
||||
Mode: 0600,
|
||||
Mode: 0o600,
|
||||
},
|
||||
SecretID: referencedSecret.ID,
|
||||
SecretName: referencedSecretName,
|
||||
|
|
|
@ -68,7 +68,7 @@ func untarHandler(tarArchive io.Reader, dest string, options *archive.TarOptions
|
|||
|
||||
dest = filepath.Clean(dest)
|
||||
if _, err := os.Stat(dest); os.IsNotExist(err) {
|
||||
if err := idtools.MkdirAllAndChownNew(dest, 0755, rootIDs); err != nil {
|
||||
if err := idtools.MkdirAllAndChownNew(dest, 0o755, rootIDs); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
|
|
@ -185,7 +185,6 @@ func packInChroot(options archive.TarOptions, args ...string) error {
|
|||
relSrc := args[0]
|
||||
|
||||
tb, err := archive.NewTarballer(relSrc, &options)
|
||||
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
|
@ -43,7 +43,6 @@ func doUnpackLayer(root string, layer io.Reader, options *archive.TarOptions) (i
|
|||
size, err := archive.UnpackLayer("/", layer, options)
|
||||
done <- result{layerSize: size, err: err}
|
||||
})
|
||||
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
|
|
|
@ -27,7 +27,7 @@ func TestEnsureRemoveAllWithMount(t *testing.T) {
|
|||
defer os.RemoveAll(dir2)
|
||||
|
||||
bindDir := filepath.Join(dir1, "bind")
|
||||
if err := os.MkdirAll(bindDir, 0755); err != nil {
|
||||
if err := os.MkdirAll(bindDir, 0o755); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
|
|
|
@ -56,12 +56,12 @@ func CreateIfNotExists(path string, isDir bool) error {
|
|||
if _, err := os.Stat(path); err != nil {
|
||||
if os.IsNotExist(err) {
|
||||
if isDir {
|
||||
return os.MkdirAll(path, 0755)
|
||||
return os.MkdirAll(path, 0o755)
|
||||
}
|
||||
if err := os.MkdirAll(filepath.Dir(path), 0755); err != nil {
|
||||
if err := os.MkdirAll(filepath.Dir(path), 0o755); err != nil {
|
||||
return err
|
||||
}
|
||||
f, err := os.OpenFile(path, os.O_CREATE, 0755)
|
||||
f, err := os.OpenFile(path, os.O_CREATE, 0o755)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
|
@ -27,7 +27,7 @@ func stringToLoopName(src string) [unix.LO_NAME_SIZE]uint8 {
|
|||
}
|
||||
|
||||
func getNextFreeLoopbackIndex() (int, error) {
|
||||
f, err := os.OpenFile("/dev/loop-control", os.O_RDONLY, 0644)
|
||||
f, err := os.OpenFile("/dev/loop-control", os.O_RDONLY, 0o644)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
|
@ -55,7 +55,7 @@ func openNextAvailableLoopback(index int, sparseFile *os.File) (loopFile *os.Fil
|
|||
}
|
||||
|
||||
// OpenFile adds O_CLOEXEC
|
||||
loopFile, err = os.OpenFile(target, os.O_RDWR, 0644)
|
||||
loopFile, err = os.OpenFile(target, os.O_RDWR, 0o644)
|
||||
if err != nil {
|
||||
log.G(context.TODO()).Errorf("Error opening loopback device: %s", err)
|
||||
return nil, ErrAttachLoopbackDevice
|
||||
|
@ -99,7 +99,7 @@ func AttachLoopDevice(sparseName string) (loop *os.File, err error) {
|
|||
}
|
||||
|
||||
// OpenFile adds O_CLOEXEC
|
||||
sparseFile, err := os.OpenFile(sparseName, os.O_RDWR, 0644)
|
||||
sparseFile, err := os.OpenFile(sparseName, os.O_RDWR, 0o644)
|
||||
if err != nil {
|
||||
log.G(context.TODO()).Errorf("Error opening sparse file %s: %s", sparseName, err)
|
||||
return nil, ErrAttachLoopbackDevice
|
||||
|
|
|
@ -26,7 +26,7 @@ func DumpToFile(dir string) (string, error) {
|
|||
if dir != "" {
|
||||
path := filepath.Join(dir, fmt.Sprintf(stacksLogNameTemplate, strings.ReplaceAll(time.Now().Format(time.RFC3339), ":", "")))
|
||||
var err error
|
||||
f, err = os.OpenFile(path, os.O_CREATE|os.O_WRONLY, 0666)
|
||||
f, err = os.OpenFile(path, os.O_CREATE|os.O_WRONLY, 0o666)
|
||||
if err != nil {
|
||||
return "", errors.Wrap(err, "failed to open file to write the goroutine stacks")
|
||||
}
|
||||
|
|
|
@ -16,14 +16,14 @@ func TestReadProcBool(t *testing.T) {
|
|||
defer os.RemoveAll(tmpDir)
|
||||
|
||||
procFile := filepath.Join(tmpDir, "read-proc-bool")
|
||||
err = os.WriteFile(procFile, []byte("1"), 0644)
|
||||
err = os.WriteFile(procFile, []byte("1"), 0o644)
|
||||
assert.NilError(t, err)
|
||||
|
||||
if !readProcBool(procFile) {
|
||||
t.Fatal("expected proc bool to be true, got false")
|
||||
}
|
||||
|
||||
if err := os.WriteFile(procFile, []byte("0"), 0644); err != nil {
|
||||
if err := os.WriteFile(procFile, []byte("0"), 0o644); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if readProcBool(procFile) {
|
||||
|
@ -44,7 +44,7 @@ func TestCgroupEnabled(t *testing.T) {
|
|||
t.Fatal("cgroupEnabled should be false")
|
||||
}
|
||||
|
||||
err = os.WriteFile(path.Join(cgroupDir, "test"), []byte{}, 0644)
|
||||
err = os.WriteFile(path.Join(cgroupDir, "test"), []byte{}, 0o644)
|
||||
assert.NilError(t, err)
|
||||
|
||||
if !cgroupEnabled(cgroupDir, "test") {
|
||||
|
|
|
@ -940,7 +940,7 @@ func (d *Daemon) TamperWithContainerConfig(t testing.TB, containerID string, tam
|
|||
tamper(&c)
|
||||
configBytes, err = json.Marshal(&c)
|
||||
assert.NilError(t, err)
|
||||
assert.NilError(t, os.WriteFile(configPath, configBytes, 0600))
|
||||
assert.NilError(t, os.WriteFile(configPath, configBytes, 0o600))
|
||||
}
|
||||
|
||||
// cleanupRaftDir removes swarmkit wal files if present
|
||||
|
|
Loading…
Add table
Reference in a new issue