Ver Fonte

Use octal values for file mode in filenotify poller and sysinfo_linux tests

Closes #33484.

Signed-off-by: Tim Potter <tpot@hpe.com>
Tim Potter há 8 anos atrás
pai
commit
c35ea6b2cd
2 ficheiros alterados com 4 adições e 4 exclusões
  1. 1 1
      pkg/filenotify/poller_test.go
  2. 3 3
      pkg/sysinfo/sysinfo_linux_test.go

+ 1 - 1
pkg/filenotify/poller_test.go

@@ -61,7 +61,7 @@ func TestPollerEvent(t *testing.T) {
 	default:
 	default:
 	}
 	}
 
 
-	if err := ioutil.WriteFile(f.Name(), []byte("hello"), 644); err != nil {
+	if err := ioutil.WriteFile(f.Name(), []byte("hello"), 0644); err != nil {
 		t.Fatal(err)
 		t.Fatal(err)
 	}
 	}
 	if err := assertEvent(w, fsnotify.Write); err != nil {
 	if err := assertEvent(w, fsnotify.Write); err != nil {

+ 3 - 3
pkg/sysinfo/sysinfo_linux_test.go

@@ -16,7 +16,7 @@ func TestReadProcBool(t *testing.T) {
 	defer os.RemoveAll(tmpDir)
 	defer os.RemoveAll(tmpDir)
 
 
 	procFile := filepath.Join(tmpDir, "read-proc-bool")
 	procFile := filepath.Join(tmpDir, "read-proc-bool")
-	if err := ioutil.WriteFile(procFile, []byte("1"), 644); err != nil {
+	if err := ioutil.WriteFile(procFile, []byte("1"), 0644); err != nil {
 		t.Fatal(err)
 		t.Fatal(err)
 	}
 	}
 
 
@@ -24,7 +24,7 @@ func TestReadProcBool(t *testing.T) {
 		t.Fatal("expected proc bool to be true, got false")
 		t.Fatal("expected proc bool to be true, got false")
 	}
 	}
 
 
-	if err := ioutil.WriteFile(procFile, []byte("0"), 644); err != nil {
+	if err := ioutil.WriteFile(procFile, []byte("0"), 0644); err != nil {
 		t.Fatal(err)
 		t.Fatal(err)
 	}
 	}
 	if readProcBool(procFile) {
 	if readProcBool(procFile) {
@@ -48,7 +48,7 @@ func TestCgroupEnabled(t *testing.T) {
 		t.Fatal("cgroupEnabled should be false")
 		t.Fatal("cgroupEnabled should be false")
 	}
 	}
 
 
-	if err := ioutil.WriteFile(path.Join(cgroupDir, "test"), []byte{}, 644); err != nil {
+	if err := ioutil.WriteFile(path.Join(cgroupDir, "test"), []byte{}, 0644); err != nil {
 		t.Fatal(err)
 		t.Fatal(err)
 	}
 	}