Skip to content

Commit

Permalink
fixed tests to use current CLI version
Browse files Browse the repository at this point in the history
  • Loading branch information
allaVolkov committed Feb 24, 2019
1 parent 3d15acc commit 4d1a0cb
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 4 deletions.
2 changes: 1 addition & 1 deletion internal/artifacts/artifacts_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ func getResultPath() string {
}

func removeSpecialSymbols(b []byte) string {
reg, _ := regexp.Compile("[^a-zA-Z0-9]+")
reg, _ := regexp.Compile("[^a-zA-Z0-9._{}]+")
s := string(b)
s = strings.Replace(s, "0xd, ", "", -1)
s = reg.ReplaceAllString(s, "")
Expand Down
11 changes: 11 additions & 0 deletions internal/artifacts/manifest_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import (
"github.com/SAP/cloud-mta-build-tool/internal/archive"
"github.com/SAP/cloud-mta-build-tool/internal/conttype"
"github.com/SAP/cloud-mta-build-tool/internal/version"
"strings"
)

var _ = Describe("manifest", func() {
Expand Down Expand Up @@ -42,6 +43,8 @@ var _ = Describe("manifest", func() {
Ω(setManifestDesc(&loc, &loc, mtaObj.Modules, []*mta.Resource{}, []string{}, false)).Should(Succeed())
actual := getFileContent(getTestPath("result", ".mta_mta_build_tmp", "META-INF", "MANIFEST.MF"))
golden := getFileContent(getTestPath("golden_manifest.mf"))
v, _ := version.GetVersion()
golden = strings.Replace( golden, "{{cli_version}}", v.CliVersion, -1)
fmt.Println(actual)
fmt.Println(golden)
Ω(actual).Should(Equal(golden))
Expand All @@ -59,6 +62,8 @@ var _ = Describe("manifest", func() {
Ω(setManifestDesc(&loc, &loc, mtaObj.Modules, []*mta.Resource{}, []string{"node-js"}, false)).Should(Succeed())
actual := getFileContent(getTestPath("result", ".mta_mta_build_tmp", "META-INF", "MANIFEST.MF"))
golden := getFileContent(getTestPath("golden_manifest.mf"))
v, _ := version.GetVersion()
golden = strings.Replace( golden, "{{cli_version}}", v.CliVersion, -1)
fmt.Println(actual)
fmt.Println(golden)
Ω(actual).Should(Equal(golden))
Expand Down Expand Up @@ -87,6 +92,8 @@ var _ = Describe("manifest", func() {
Ω(setManifestDesc(&loc, &loc, mtaObj.Modules, []*mta.Resource{}, []string{}, false)).Should(Succeed())
actual := getFileContent(getTestPath("result", ".mta_mta_build_tmp", "META-INF", "MANIFEST.MF"))
golden := getFileContent(getTestPath("golden_assembly_manifest_no_paths.mf"))
v, _ := version.GetVersion()
golden = strings.Replace( golden, "{{cli_version}}", v.CliVersion, -1)
fmt.Println(actual)
fmt.Println(golden)
Ω(actual).Should(Equal(golden))
Expand All @@ -102,6 +109,8 @@ var _ = Describe("manifest", func() {
Ω(setManifestDesc(&loc, &loc, mtaObj.Modules, mtaObj.Resources, []string{}, false)).Should(Succeed())
actual := getFileContent(getTestPath("result", ".assembly-sample_mta_build_tmp", "META-INF", "MANIFEST.MF"))
golden := getFileContent(getTestPath("golden_assembly_manifest.mf"))
v, _ := version.GetVersion()
golden = strings.Replace( golden, "{{cli_version}}", v.CliVersion, -1)
fmt.Println(actual)
fmt.Println(golden)
Ω(actual).Should(Equal(golden))
Expand Down Expand Up @@ -156,6 +165,8 @@ var _ = Describe("manifest", func() {
Ω(genManifest(loc.GetManifestPath(), entries)).Should(Succeed())
actual := getFileContent(getTestPath("result", ".mta_mta_build_tmp", "META-INF", "MANIFEST.MF"))
golden := getFileContent(getTestPath("golden_manifest.mf"))
v, _ := version.GetVersion()
golden = strings.Replace( golden, "{{cli_version}}", v.CliVersion, -1)
Ω(actual).Should(Equal(golden))
})
It("Fails on wrong location", func() {
Expand Down
2 changes: 1 addition & 1 deletion internal/artifacts/testdata/golden_assembly_manifest.mf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
manifest-Version: 1.0
Created-By: SAP Application Archive Builder v0.0.9
Created-By: SAP Application Archive Builder {{cli_version}}

Name: web/
MTA-Module: java-hello-world
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
manifest-Version: 1.0
Created-By: SAP Application Archive Builder v0.0.9
Created-By: SAP Application Archive Builder {{cli_version}}

Name: META-INF/mtad.yaml
Content-Type: text/plain
Expand Down
2 changes: 1 addition & 1 deletion internal/artifacts/testdata/golden_manifest.mf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
manifest-Version: 1.0
Created-By: SAP Application Archive Builder v0.0.9
Created-By: SAP Application Archive Builder {{cli_version}}

Name: node-js/data.zip
MTA-Module: node-js
Expand Down

0 comments on commit 4d1a0cb

Please sign in to comment.