Skip to content

Commit 0640445

Browse files
committed
fix: read file directly
1 parent bdc95f3 commit 0640445

File tree

1 file changed

+2
-17
lines changed

1 file changed

+2
-17
lines changed

environment/deploy/integration/main_test.go

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
package integration
22

33
import (
4-
"crypto/rand"
5-
"encoding/hex"
64
"fmt"
7-
"log"
85
"os"
96
"path/filepath"
107
"testing"
@@ -41,17 +38,11 @@ func kubeconfig() string {
4138
return ""
4239
}
4340

44-
// If raw kubeconfig, export it directly
45-
_, err := os.Stat(kubeconfig)
41+
// If raw kubeconfig, export it directly, else export content
42+
kb, err := os.ReadFile(kubeconfig)
4643
if err == nil {
4744
return export([]byte(kubeconfig))
4845
}
49-
50-
// Else cp
51-
kb, err := os.ReadFile(kubeconfig)
52-
if err != nil {
53-
log.Fatal(err)
54-
}
5546
return export(kb)
5647
}
5748

@@ -61,9 +52,3 @@ func export(content []byte) string {
6152
_ = os.WriteFile(o, content, 0644)
6253
return o
6354
}
64-
65-
func randName() string {
66-
buf := make([]byte, 8)
67-
rand.Read(buf)
68-
return hex.EncodeToString(buf)
69-
}

0 commit comments

Comments
 (0)