Skip to content

Commit

Permalink
Add a test to ensure that extra attributes in the yaml work
Browse files Browse the repository at this point in the history
  • Loading branch information
jfahrer committed Jul 10, 2019
1 parent 0ace199 commit c042e3f
Showing 1 changed file with 26 additions and 3 deletions.
29 changes: 26 additions & 3 deletions yaml_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,27 @@ commands:
bundle: run
`

var yamlWithExtraAttributes = `
strategies:
run:
handler: docker_compose_run
service: app
remove: true
run_with_docker:
handler: docker_run
image: alpine:latest
default_strategy: run
commands:
ls: run_with_docker
bundle: run
something-else:
foo: bar
`

func TestParseYaml(t *testing.T) {
yaml, err := parseYaml([]byte(fullYaml))
expectedResult := &yamlCfg{
Strategies: map[string]map[string]interface{}{
"run": {
Expand All @@ -43,8 +62,12 @@ func TestParseYaml(t *testing.T) {
"bundle": "run",
},
}

yaml, err := parseYaml([]byte(fullYaml))
assert.NoError(t, err)
assert.Equal(t, yaml, expectedResult)
}

// TODO: Test parsing yaml with additional fields
yaml, err = parseYaml([]byte(yamlWithExtraAttributes))
assert.NoError(t, err)
assert.Equal(t, yaml, expectedResult)
}

0 comments on commit c042e3f

Please sign in to comment.