Skip to content

Commit

Permalink
test: modify test
Browse files Browse the repository at this point in the history
  • Loading branch information
T-TRz879 committed Aug 21, 2023
1 parent 551f26b commit 78999d9
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 9 deletions.
1 change: 0 additions & 1 deletion scp_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,6 @@ func TestPutAll(t *testing.T) {

func TestGetFile(t *testing.T) {
local, remote := RandName("/tmp"), RandName(baseRemoteDir)
assert.Nil(t, mkdir(local))
assert.Nil(t, writeFile(remote))
ssh, err := NewSSH(testNode)
assert.Nil(t, err)
Expand Down
10 changes: 2 additions & 8 deletions utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,13 @@ import (
"errors"
"fmt"
"github.com/go-cmd/cmd"
"github.com/google/uuid"
"github.com/mattn/go-isatty"
"golang.org/x/crypto/ssh"
"math/rand"
"os"
"path/filepath"
"runtime"
"strconv"
"time"
)

var (
Expand Down Expand Up @@ -133,10 +132,5 @@ func ParseInt64(str string) (int64, error) {
}

func RandName(root string) string {
rand.Seed(time.Now().Unix())
res := make([]byte, 10)
for i := 0; i < len(res); i++ {
res[i] = letters[rand.Intn(len(letters))]
}
return filepath.Join(root, string(res))
return filepath.Join(root, uuid.NewString())
}

0 comments on commit 78999d9

Please sign in to comment.