zotregistry.io/zot@v1.4.4-0.20231124084042-02a8ed785457/pkg/api/config/config_elevated_test.go (about) 1 //go:build needprivileges 2 // +build needprivileges 3 4 package config_test 5 6 import ( 7 "syscall" 8 "testing" 9 10 . "github.com/smartystreets/goconvey/convey" 11 12 "zotregistry.io/zot/pkg/api/config" 13 ) 14 15 func TestMountConfig(t *testing.T) { 16 Convey("Test config utils mounting same directory", t, func() { 17 // If two dirs are mounting to same location SameFile should be same 18 dir1 := t.TempDir() 19 dir2 := t.TempDir() 20 dir3 := t.TempDir() 21 22 err := syscall.Mount(dir3, dir1, "", syscall.MS_BIND, "") 23 So(err, ShouldBeNil) 24 25 err = syscall.Mount(dir3, dir2, "", syscall.MS_BIND, "") 26 So(err, ShouldBeNil) 27 28 isSame, err := config.SameFile(dir1, dir2) 29 So(err, ShouldBeNil) 30 So(isSame, ShouldBeTrue) 31 }) 32 }