0
Fork 0
mirror of https://github.com/project-zot/zot.git synced 2024-12-16 21:56:37 -05:00
zot/pkg/api/config/config_elevated_test.go
Nicol 33a431ef43
Update go version to 1.19 (#829)
* ci: Update go version to 1.19

Signed-off-by: Nicol Draghici <idraghic@cisco.com>

* ci: Fix lint issues

Signed-off-by: Nicol Draghici <idraghic@cisco.com>

* ci: Added needprivileges to lint, made needprivileges pass lint

Signed-off-by: Catalin Hofnar <catalin.hofnar@gmail.com>
Signed-off-by: Nicol Draghici <idraghic@cisco.com>

Signed-off-by: Nicol Draghici <idraghic@cisco.com>
Signed-off-by: Catalin Hofnar <catalin.hofnar@gmail.com>
Co-authored-by: Catalin Hofnar <catalin.hofnar@gmail.com>
2022-10-05 13:21:14 +03:00

31 lines
699 B
Go

//go:build needprivileges
// +build needprivileges
package config_test
import (
"syscall"
"testing"
. "github.com/smartystreets/goconvey/convey"
"zotregistry.io/zot/pkg/api/config"
)
func TestMountConfig(t *testing.T) {
Convey("Test config utils mounting same directory", t, func() {
// If two dirs are mounting to same location SameFile should be same
dir1 := t.TempDir()
dir2 := t.TempDir()
dir3 := t.TempDir()
err := syscall.Mount(dir3, dir1, "", syscall.MS_BIND, "")
So(err, ShouldBeNil)
err = syscall.Mount(dir3, dir2, "", syscall.MS_BIND, "")
So(err, ShouldBeNil)
isSame, err := config.SameFile(dir1, dir2)
So(err, ShouldBeNil)
So(isSame, ShouldBeTrue)
})
}