mirror of
https://github.com/portainer/portainer.git
synced 2025-08-03 04:45:21 +02:00
go 1.13 compatibility
This commit is contained in:
parent
a3ec2f8e85
commit
6d8f5e7479
5 changed files with 20 additions and 17 deletions
|
@ -9,6 +9,7 @@ import (
|
|||
"path/filepath"
|
||||
"testing"
|
||||
|
||||
"github.com/docker/docker/pkg/ioutils"
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
|
@ -26,7 +27,7 @@ func listFiles(dir string) []string {
|
|||
}
|
||||
|
||||
func Test_shouldCreateArhive(t *testing.T) {
|
||||
tmpdir, _ := os.MkdirTemp("", "backup")
|
||||
tmpdir, _ := ioutils.TempDir("", "backup")
|
||||
defer os.RemoveAll(tmpdir)
|
||||
|
||||
content := []byte("content")
|
||||
|
@ -39,7 +40,7 @@ func Test_shouldCreateArhive(t *testing.T) {
|
|||
assert.Nil(t, err)
|
||||
assert.Equal(t, filepath.Join(tmpdir, fmt.Sprintf("%s.tar.gz", filepath.Base(tmpdir))), gzPath)
|
||||
|
||||
extractionDir, _ := os.MkdirTemp("", "extract")
|
||||
extractionDir, _ := ioutils.TempDir("", "extract")
|
||||
defer os.RemoveAll(extractionDir)
|
||||
|
||||
cmd := exec.Command("tar", "-xzf", gzPath, "-C", extractionDir)
|
||||
|
@ -62,7 +63,7 @@ func Test_shouldCreateArhive(t *testing.T) {
|
|||
}
|
||||
|
||||
func Test_shouldCreateArhiveXXXXX(t *testing.T) {
|
||||
tmpdir, _ := os.MkdirTemp("", "backup")
|
||||
tmpdir, _ := ioutils.TempDir("", "backup")
|
||||
defer os.RemoveAll(tmpdir)
|
||||
|
||||
content := []byte("content")
|
||||
|
@ -75,7 +76,7 @@ func Test_shouldCreateArhiveXXXXX(t *testing.T) {
|
|||
assert.Nil(t, err)
|
||||
assert.Equal(t, filepath.Join(tmpdir, fmt.Sprintf("%s.tar.gz", filepath.Base(tmpdir))), gzPath)
|
||||
|
||||
extractionDir, _ := os.MkdirTemp("", "extract")
|
||||
extractionDir, _ := ioutils.TempDir("", "extract")
|
||||
defer os.RemoveAll(extractionDir)
|
||||
|
||||
r, _ := os.Open(gzPath)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue