mirror of
https://github.com/project-zot/zot.git
synced 2026-06-15 11:37:56 +08:00
da426850e7
* chore: Update golangci-lint Signed-off-by: Lars Francke <git@lars-francke.de> * chore: fix all golangci-lint issues - Remove deprecated `// +build` tags - Fix godoclint, modernize, wsl_v5, govet, lll, gci, noctx issues - Update linter configuration - Modernize code to use Go 1.22+ features (for range N, slices.Contains, etc.) - Update make check lint the privileged tests Signed-off-by: Andrei Aaron <andreifdaaron@gmail.com> --------- Signed-off-by: Lars Francke <git@lars-francke.de> Signed-off-by: Andrei Aaron <andreifdaaron@gmail.com> Co-authored-by: Lars Francke <git@lars-francke.de>
32 lines
679 B
Go
32 lines
679 B
Go
//go:build needprivileges
|
|
|
|
package config_test
|
|
|
|
import (
|
|
"syscall"
|
|
"testing"
|
|
|
|
. "github.com/smartystreets/goconvey/convey"
|
|
|
|
"zotregistry.dev/zot/v2/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)
|
|
})
|
|
}
|