Skip to content

Commit ce43d84

Browse files
committed
network: set broad permissions
Some of the tests in this package are expected to run as root in order to perform privileged operations. These tests may also create files, but if they do so without setting the w bit for the other group, the files will not be deletable after the test by a normal user. This commit sets the writable bit on the file permissions only so that the files can be deleted by non-root users after the tests complete. Signed-off-by: Samuel Karp <[email protected]>
1 parent 6afccc1 commit ce43d84

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

network_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -252,12 +252,12 @@ func TestNetworkMachineCNI(t *testing.T) {
252252

253253
cniCacheDir := filepath.Join(testCNIDir, "cni.cache")
254254
require.NoError(t,
255-
os.MkdirAll(cniCacheDir, 0755),
255+
os.MkdirAll(cniCacheDir, 0777), // broad permissions for tests
256256
"failed to create cni cache dir")
257257

258258
cniConfDir := filepath.Join(testCNIDir, "cni.conf")
259259
require.NoError(t,
260-
os.MkdirAll(cniConfDir, 0755),
260+
os.MkdirAll(cniConfDir, 0777), // broad permissions for tests
261261
"failed to create cni conf dir")
262262

263263
const ifName = "veth0"
@@ -283,7 +283,7 @@ func TestNetworkMachineCNI(t *testing.T) {
283283

284284
cniConfPath := filepath.Join(cniConfDir, fmt.Sprintf("%s.conflist", networkName))
285285
require.NoError(t,
286-
ioutil.WriteFile(cniConfPath, []byte(cniConf), 0644),
286+
ioutil.WriteFile(cniConfPath, []byte(cniConf), 0666), // broad permissions for tests
287287
"failed to write cni conf file")
288288

289289
numVMs := 10

0 commit comments

Comments
 (0)