ab35df454d
Removed pre-go1.17 build-tags with go fix; go mod init go fix -mod=readonly ./... rm go.mod Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
36 lines
762 B
Go
36 lines
762 B
Go
//go:build !darwin
|
|
|
|
package containerfs // import "github.com/docker/docker/pkg/containerfs"
|
|
|
|
import (
|
|
"os"
|
|
"testing"
|
|
)
|
|
|
|
func TestEnsureRemoveAllNotExist(t *testing.T) {
|
|
// should never return an error for a non-existent path
|
|
if err := EnsureRemoveAll("/non/existent/path"); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
}
|
|
|
|
func TestEnsureRemoveAllWithDir(t *testing.T) {
|
|
dir, err := os.MkdirTemp("", "test-ensure-removeall-with-dir")
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
if err := EnsureRemoveAll(dir); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
}
|
|
|
|
func TestEnsureRemoveAllWithFile(t *testing.T) {
|
|
tmp, err := os.CreateTemp("", "test-ensure-removeall-with-dir")
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
tmp.Close()
|
|
if err := EnsureRemoveAll(tmp.Name()); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
}
|