Skip to content

Commit

Permalink
handled case: missing required (by dependencies) module
Browse files Browse the repository at this point in the history
  • Loading branch information
allaVolkov committed Feb 14, 2019
1 parent 9d777ed commit db46f41
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 1 deletion.
4 changes: 4 additions & 0 deletions internal/buildops/modules_deps.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,10 @@ func getModulesOrder(m *mta.MTA) ([]string, error) {
requires := getBuildRequires(module)
if requires != nil {
for _, req := range requires {
_, err := m.GetModuleByName(req.Name)
if err != nil {
return nil, err
}
deps.Add(req.Name)
}
}
Expand Down
8 changes: 7 additions & 1 deletion internal/buildops/modules_deps_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (

"github.com/SAP/cloud-mta-build-tool/internal/fs"
"github.com/SAP/cloud-mta/mta"
"io/ioutil"
)

var _ = Describe("ModulesDeps", func() {
Expand Down Expand Up @@ -67,8 +68,13 @@ var _ = Describe("ModulesDeps", func() {
mtaStr := &mta.MTA{Modules: []*mta.Module{{Name: "someproj-db"}, {Name: "someproj-java"}}}
Ω(GetModulesNames(mtaStr)).Should(Equal([]string{"someproj-db", "someproj-java"}))
})
It("Required module not defined", func() {
mtaContent, _ := ioutil.ReadFile(getTestPath("mtahtml5", "mtaRequiredModuleNotDefined.yaml"))
mtaStr, _ := mta.Unmarshal(mtaContent)
_, err := GetModulesNames(mtaStr)
Ω(err.Error()).Should(Equal("the abc module is not defined "))
})
})

})

func executeAndProvideOutput(execute func()) string {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
ID: mtahtml5
_schema-version: '2.1'
version: 0.0.1

modules:
- name: ui5app
type: html5
path: testapp
parameters:
disk-quota: 256M
memory: 256M
build-parameters:
requires:
- name: abc


0 comments on commit db46f41

Please sign in to comment.