You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openwhisk.apache.org by mr...@apache.org on 2017/09/06 01:56:13 UTC
[incubator-openwhisk-wskdeploy] branch master updated: more unit
tests for yamlparser.go (#440)
This is an automated email from the ASF dual-hosted git repository.
mrutkowski pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-openwhisk-wskdeploy.git
The following commit(s) were added to refs/heads/master by this push:
new 7d3572a more unit tests for yamlparser.go (#440)
7d3572a is described below
commit 7d3572ae44fbb00ee12faed16a04eb8aa077be3f
Author: Ying Chun Guo <gu...@cn.ibm.com>
AuthorDate: Wed Sep 6 09:56:12 2017 +0800
more unit tests for yamlparser.go (#440)
---
parsers/yamlparser_test.go | 41 +++++++++++++++++++++++++++++++++++++++++
tests/dat/manifest2.yaml | 36 ++++++++++++++++++++++++++++++++++++
2 files changed, 77 insertions(+)
diff --git a/parsers/yamlparser_test.go b/parsers/yamlparser_test.go
index 7bef6e3..242ecc1 100644
--- a/parsers/yamlparser_test.go
+++ b/parsers/yamlparser_test.go
@@ -26,6 +26,7 @@ import (
)
var manifestfile1 = "../tests/dat/manifest1.yaml"
+var manifestfile2 = "../tests/dat/manifest2.yaml"
var manifestfile3 = "../tests/dat/manifest3.yaml"
var manifestfile4 = "../tests/dat/manifest4.yaml"
var manifestfile5 = "../tests/dat/manifest5.yaml"
@@ -308,3 +309,43 @@ func TestComposeWskRule(t *testing.T) {
}
}
}
+
+func TestGetActionList(t *testing.T) {
+ mm := NewYAMLParser()
+ manifest := mm.ParseManifest(manifestfile2)
+ pkg := manifest.Package
+ actions := pkg.GetActionList()
+ assert.Equal(t,3, len(actions), "Get action list failed.")
+}
+
+func TestGetTriggerList(t *testing.T) {
+ mm := NewYAMLParser()
+ manifest := mm.ParseManifest(manifestfile2)
+ pkg := manifest.Package
+ triggers := pkg.GetTriggerList()
+ assert.Equal(t,2, len(triggers), "Get trigger list failed.")
+}
+
+func TestGetRuleList(t *testing.T) {
+ mm := NewYAMLParser()
+ manifest := mm.ParseManifest(manifestfile2)
+ pkg := manifest.Package
+ rules := pkg.GetRuleList()
+ assert.Equal(t,3, len(rules), "Get trigger list failed.")
+}
+
+func TestGetFeedList(t *testing.T) {
+ mm := NewYAMLParser()
+ manifest := mm.ParseManifest(manifestfile2)
+ pkg := manifest.Package
+ feeds := pkg.GetFeedList()
+ assert.Equal(t,4, len(feeds), "Get feed list failed.")
+}
+
+func TestGetApisList(t *testing.T) {
+ mm := NewYAMLParser()
+ manifest := mm.ParseManifest(manifestfile2)
+ pkg := manifest.Package
+ apis := pkg.GetApis()
+ assert.Equal(t,5, len(apis), "Get api list failed.")
+}
diff --git a/tests/dat/manifest2.yaml b/tests/dat/manifest2.yaml
new file mode 100644
index 0000000..8e37b6b
--- /dev/null
+++ b/tests/dat/manifest2.yaml
@@ -0,0 +1,36 @@
+package:
+ name: manifest2
+ version: 1.0
+ license: Apache-2.0
+ actions:
+ first_action:
+ second_action:
+ third_action:
+ triggers:
+ trigger1:
+ trigger2:
+ rules:
+ rule1:
+ trigger: trigger1
+ action: first_action
+ rule3:
+ trigger: trigger2
+ action: second_action
+ rule2:
+ trigger: trigger1
+ action: second_action
+ feeds:
+ feed1:
+ feed2:
+ feed3:
+ feed4:
+ apis:
+ book-club: #api name
+ club: # shared base path
+ books: #path
+ getBooks: get #action name:verb
+ postBooks: post
+ putBooks: put
+ deleteBooks: delete
+ members: #path
+ listMembers: get #action name:verb
--
To stop receiving notification emails like this one, please contact
['"commits@openwhisk.apache.org" <co...@openwhisk.apache.org>'].