All checks were successful
Golang test / go-test (push) Successful in 39s
Signed-off-by: Matheus Sampaio Queiroga <srherobrine20@gmail.com>
46 lines
1.1 KiB
Go
46 lines
1.1 KiB
Go
//go:build windows || (cgo && (darwin || freebsd || netbsd || openbsd))
|
|
|
|
package overlayfs
|
|
|
|
import (
|
|
"context"
|
|
"os"
|
|
"path/filepath"
|
|
"testing"
|
|
)
|
|
|
|
func TestFusefs(t *testing.T) {
|
|
rootTemp := t.TempDir()
|
|
overlayMount := &Overlayfs{
|
|
Target: filepath.Join(rootTemp, "root"),
|
|
Upper: filepath.Join(rootTemp, "up"),
|
|
Workdir: filepath.Join(rootTemp, "work"),
|
|
Lower: []string{
|
|
filepath.Join(rootTemp, "low1"),
|
|
filepath.Join(rootTemp, "low2"),
|
|
filepath.Join(rootTemp, "low3"),
|
|
filepath.Join(rootTemp, "low4"),
|
|
},
|
|
}
|
|
|
|
for _, folderPath := range append(overlayMount.Lower, overlayMount.Target, overlayMount.Upper, overlayMount.Workdir) {
|
|
if err := os.Mkdir(folderPath, 0777); err != nil {
|
|
t.Skipf("skiping, cannot make folders: %q", err.Error())
|
|
return
|
|
}
|
|
}
|
|
|
|
ctx, done := context.WithCancel(t.Context())
|
|
defer done()
|
|
|
|
t.Logf("mount cgofuse+overlayfs in %q\n", overlayMount.Target)
|
|
err := overlayMount.Mount(ctx)
|
|
if err != nil {
|
|
t.Errorf("cannot mount cgofuse+overlayfs: %s", err)
|
|
return // Stop test
|
|
}
|
|
|
|
done()
|
|
overlayMount.Storage.Done()
|
|
}
|