Skip to content

Commit cd480c8

Browse files
pepovsiliconbrain
andcommitted
Apply suggestions from code review
Co-authored-by: Dudás Ádám <[email protected]> Signed-off-by: Peter Wilcsinszky <[email protected]>
1 parent c1bfbd2 commit cd480c8

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

e2e/common/cluster.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,10 +120,11 @@ func (c kindCluster) PrintLogs(config PrintLogConfig) error {
120120
if err != nil {
121121
return err
122122
}
123+
defer f.Close()
124+
123125
cmd.Stdout = f
124126
cmd.Stderr = os.Stderr
125127

126-
defer f.Close()
127128
return cmd.Run()
128129
}
129130

e2e/volumedrain/volumedrain_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import (
1919
"fmt"
2020
"os"
2121
"os/exec"
22-
"path"
22+
"path/filepath"
2323
"strings"
2424
"testing"
2525
"time"
@@ -54,7 +54,7 @@ func init() {
5454
if !ok {
5555
TestTempDir = "../.."
5656
}
57-
TestTempDir = path.Join(TestTempDir, "build/_test")
57+
TestTempDir = filepath.Join(TestTempDir, "build/_test")
5858
err := os.MkdirAll(TestTempDir, os.FileMode(0755))
5959
if err != nil {
6060
panic(err)
@@ -200,7 +200,7 @@ func TestVolumeDrain_Downscale(t *testing.T) {
200200
require.NoError(t, c.GetClient().Get(ctx, client.ObjectKeyFromObject(pvc), pvc))
201201
assert.Equal(t, "drained", pvc.GetLabels()["logging.banzaicloud.io/drain-status"])
202202
}, func(t *testing.T, c common.Cluster) error {
203-
path := fmt.Sprintf("%s/cluster-%s.log", TestTempDir, t.Name())
203+
path := filepath.Join(TestTempDir, fmt.Sprintf("cluster-%s.log", t.Name()))
204204
t.Logf("Printing cluster logs to %s", path)
205205
return c.PrintLogs(common.PrintLogConfig{
206206
Namespaces: []string{ns, "default"},
@@ -359,7 +359,7 @@ func TestVolumeDrain_Downscale_DeleteVolume(t *testing.T) {
359359

360360
require.Eventually(t, cond.ResourceShouldBeAbsent(t, c.GetClient(), common.Resource(new(corev1.PersistentVolumeClaim), ns, logging.Name+"-fluentd-buffer-"+fluentdReplicaName)), 30*time.Second, time.Second/2)
361361
}, func(t *testing.T, c common.Cluster) error {
362-
path := fmt.Sprintf("%s/cluster-%s.log", TestTempDir, t.Name())
362+
path := filepath.Join(TestTempDir, fmt.Sprintf("cluster-%s.log", t.Name()))
363363
t.Logf("Printing cluster logs to %s", path)
364364
return c.PrintLogs(common.PrintLogConfig{
365365
Namespaces: []string{ns, "default"},

0 commit comments

Comments
 (0)