1
0
Fork 0
mirror of https://github.com/portainer/portainer.git synced 2025-07-24 15:59:41 +02:00

go 1.13 compatibility

This commit is contained in:
Dmitry Salakhov 2021-04-07 12:12:19 +12:00
parent a3ec2f8e85
commit 6d8f5e7479
5 changed files with 20 additions and 17 deletions

View file

@ -7,6 +7,7 @@ import (
"path/filepath"
"testing"
"github.com/docker/docker/pkg/ioutils"
"github.com/stretchr/testify/assert"
)
@ -30,7 +31,7 @@ func contains(t *testing.T, list []string, path string) {
}
func Test_copyFile_returnsError_whenSourceDoesNotExist(t *testing.T) {
tmpdir, _ := os.MkdirTemp("", "backup")
tmpdir, _ := ioutils.TempDir("", "backup")
defer os.RemoveAll(tmpdir)
err := copyFile("does-not-exist", tmpdir)
@ -38,7 +39,7 @@ func Test_copyFile_returnsError_whenSourceDoesNotExist(t *testing.T) {
}
func Test_copyFile_shouldMakeAbackup(t *testing.T) {
tmpdir, _ := os.MkdirTemp("", "backup")
tmpdir, _ := ioutils.TempDir("", "backup")
defer os.RemoveAll(tmpdir)
content := []byte("content")
@ -52,7 +53,7 @@ func Test_copyFile_shouldMakeAbackup(t *testing.T) {
}
func Test_copyDir_shouldCopyAllFilesAndDirectories(t *testing.T) {
destination, _ := os.MkdirTemp("", "destination")
destination, _ := ioutils.TempDir("", "destination")
defer os.RemoveAll(destination)
err := copyDir("./test_assets/copy_test", destination)
assert.Nil(t, err)
@ -65,7 +66,7 @@ func Test_copyDir_shouldCopyAllFilesAndDirectories(t *testing.T) {
}
func Test_backupPath_shouldSkipWhenNotExist(t *testing.T) {
tmpdir, _ := os.MkdirTemp("", "backup")
tmpdir, _ := ioutils.TempDir("", "backup")
defer os.RemoveAll(tmpdir)
err := copyPath("does-not-exists", tmpdir)
@ -75,7 +76,7 @@ func Test_backupPath_shouldSkipWhenNotExist(t *testing.T) {
}
func Test_backupPath_shouldCopyFile(t *testing.T) {
tmpdir, _ := os.MkdirTemp("", "backup")
tmpdir, _ := ioutils.TempDir("", "backup")
defer os.RemoveAll(tmpdir)
content := []byte("content")
@ -91,7 +92,7 @@ func Test_backupPath_shouldCopyFile(t *testing.T) {
}
func Test_backupPath_shouldCopyDir(t *testing.T) {
destination, _ := os.MkdirTemp("", "destination")
destination, _ := ioutils.TempDir("", "destination")
defer os.RemoveAll(destination)
err := copyPath("./test_assets/copy_test", destination)
assert.Nil(t, err)