Skip to content

Commit

Permalink
Add a backwards compat test for project.toml v2 env
Browse files Browse the repository at this point in the history
Signed-off-by: Joe Kutner <jpkutner@gmail.com>
  • Loading branch information
jkutner committed Aug 12, 2022
1 parent 71021c7 commit 1c1eb83
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions pkg/project/project_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,39 @@ value = "this-should-get-overridden-because-its-deprecated"
expected, projectDescriptor.Metadata["pipeline"])
}
})
it("should be backwards compatible with older v0.2 project.toml file", func() {
projectToml := `
[_]
name = "gallant 0.2"
schema-version="0.2"
[[io.buildpacks.env.build]]
name = "JAVA_OPTS"
value = "-Xmx300m"
`
tmpProjectToml, err := createTmpProjectTomlFile(projectToml)
if err != nil {
t.Fatal(err)
}

projectDescriptor, err := ReadProjectDescriptor(tmpProjectToml.Name())
if err != nil {
t.Fatal(err)
}

var expected string

expected = "JAVA_OPTS"
if projectDescriptor.Build.Env[0].Name != expected {
t.Fatalf("Expected\n-----\n%#v\n-----\nbut got\n-----\n%#v\n",
expected, projectDescriptor.Build.Env[0].Name)
}

expected = "-Xmx300m"
if projectDescriptor.Build.Env[0].Value != expected {
t.Fatalf("Expected\n-----\n%#v\n-----\nbut got\n-----\n%#v\n",
expected, projectDescriptor.Build.Env[0].Value)
}
})
it("should parse a valid v0.1 project.toml file", func() {
projectToml := `
[project]
Expand Down

0 comments on commit 1c1eb83

Please sign in to comment.