Skip to content

Commit

Permalink
Fix: Lint error in tests
Browse files Browse the repository at this point in the history
Signed-off-by: santoshkal <ksantosh@intelops.dev>
  • Loading branch information
santoshkal committed Oct 2, 2023
1 parent fb067dc commit f5b7ba2
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions pkg/parser/inputParser_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ dockerfile
func TestReadAndParseFile(t *testing.T) {
// Create temp yaml file
yamlFile, _ := os.CreateTemp("", "test*.yaml")
yamlFile.WriteString(`
_, err := yamlFile.WriteString(`
dockerfile:
- stage: 1
instructions:
Expand All @@ -49,17 +49,19 @@ dockerfile:
- run:
- "echo world"
`)
assert.NoError(t, err)
defer os.Remove(yamlFile.Name())

// Read and parse YAML file
var yamlData InputYAML
err := ReadAndParseFile(yamlFile.Name(), &yamlData)
err = ReadAndParseFile(yamlFile.Name(), &yamlData)
assert.NoError(t, err)
assert.Equal(t, 2, len(yamlData.Dockerfile))

// Create temp json file
jsonFile, _ := os.CreateTemp("", "test*.json")
jsonFile.WriteString(`{"dockerfile":[{"stage":1,"instructions":[{"run":["echo hello"]}]},{"stage":2,"instructions":[{"run":["echo world"]}]}]}`)
_, err = jsonFile.WriteString(`{"dockerfile":[{"stage":1,"instructions":[{"run":["echo hello"]}]},{"stage":2,"instructions":[{"run":["echo world"]}]}]}`)
assert.NoError(t, err)
defer os.Remove(jsonFile.Name())

// Read and parse JSON file
Expand Down

0 comments on commit f5b7ba2

Please sign in to comment.