Skip to content

Commit

Permalink
test(windows): remove temp files after test
Browse files Browse the repository at this point in the history
  • Loading branch information
qvalentin committed Jan 27, 2024
1 parent bd4332c commit ad3ccf6
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions internal/charts/chart_for_document_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,16 @@ func TestGetChartForDocumentWorksForNewToAddChart(t *testing.T) {
err = os.MkdirAll(expectedChartDirectory, 0o755)
)
assert.NoError(t, err)
_, _ = os.Create(filepath.Join(expectedChartDirectory, "Chart.yaml"))
chartFile := filepath.Join(expectedChartDirectory, "Chart.yaml")
_, _ = os.Create(chartFile)

result1, error := chartStore.GetChartForDoc(uri.File(filepath.Join(expectedChartDirectory, "templates", "deployment.yaml")))
assert.NoError(t, error)
assert.Same(t, expectedChart, result1)

assert.Same(t, expectedChart, chartStore.Charts[uri.File(expectedChartDirectory)])

os.Remove(chartFile)
}

func TestGetChartForDocumentWorksForNewToAddChartWithNestedFile(t *testing.T) {
Expand All @@ -77,11 +80,14 @@ func TestGetChartForDocumentWorksForNewToAddChartWithNestedFile(t *testing.T) {
err = os.MkdirAll(expectedChartDirectory, 0o755)
)
assert.NoError(t, err)
_, _ = os.Create(filepath.Join(expectedChartDirectory, "Chart.yaml"))
chartFile := filepath.Join(expectedChartDirectory, "Chart.yaml")
_, _ = os.Create(chartFile)

result1, error := chartStore.GetChartForDoc(uri.File(filepath.Join(expectedChartDirectory, "templates", "nested", "deployment.yaml")))
assert.NoError(t, error)
assert.Same(t, expectedChart, result1)

assert.Same(t, expectedChart, chartStore.Charts[uri.File(expectedChartDirectory)])

os.Remove(chartFile)
}

0 comments on commit ad3ccf6

Please sign in to comment.