Skip to content

Commit b60e35c

Browse files
fix: fix ci error in errorcheck.
Signed-off-by: Electronic-Waste <[email protected]>
1 parent 2496e94 commit b60e35c

File tree

1 file changed

+3
-14
lines changed

1 file changed

+3
-14
lines changed

pkg/metricscollector/v1beta1/file-metricscollector/file-metricscollector_test.go

+3-14
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,8 @@ const (
4242
)
4343

4444
var (
45-
testJsonDataPath = filepath.Join("testdata", "JSON")
45+
testDir = "testdata"
46+
testJsonDataPath = filepath.Join(testDir, "JSON")
4647
testTextDataPath = filepath.Join("testdata", "TEXT")
4748
)
4849

@@ -56,7 +57,7 @@ func TestCollectObservationLog(t *testing.T) {
5657
if err := generateTEXTTestFiles(); err != nil {
5758
t.Fatal(err)
5859
}
59-
defer deleteTestDirs()
60+
defer os.RemoveAll(testDir)
6061

6162
testCases := map[string]struct {
6263
filePath string
@@ -337,18 +338,6 @@ func generateTestDirs() error {
337338
return nil
338339
}
339340

340-
func deleteTestDirs() error {
341-
if err := os.RemoveAll(filepath.Dir(testJsonDataPath)); err != nil {
342-
return err
343-
}
344-
345-
if err := os.RemoveAll(filepath.Dir(testTextDataPath)); err != nil {
346-
return err
347-
}
348-
349-
return nil
350-
}
351-
352341
func generateJSONTestFiles() error {
353342
testData := []struct {
354343
fileName string

0 commit comments

Comments
 (0)