You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openwhisk.apache.org by lz...@apache.org on 2017/09/22 01:20:46 UTC

[incubator-openwhisk-wskdeploy] branch master updated: adding test on package in manifest (#535)

This is an automated email from the ASF dual-hosted git repository.

lz1982 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 f892b89  adding test on package in manifest (#535)
f892b89 is described below

commit f892b899ceff2bbd0ead6125c2053432f4415b3c
Author: Priti Desai <pd...@us.ibm.com>
AuthorDate: Thu Sep 21 18:20:44 2017 -0700

    adding test on package in manifest (#535)
---
 .../validate-package-in-manifest/actions/hello.js  | 26 +++++++++++++
 .../validate-package-in-manifest/deployment.yaml   | 13 +++++++
 .../validate-package-in-manifest/manifest.yaml     | 44 ++++++++++++++++++++++
 .../validate-package-in-manifest_test.go           | 40 ++++++++++++++++++++
 4 files changed, 123 insertions(+)

diff --git a/tests/src/integration/validate-package-in-manifest/actions/hello.js b/tests/src/integration/validate-package-in-manifest/actions/hello.js
new file mode 100644
index 0000000..25fdafb
--- /dev/null
+++ b/tests/src/integration/validate-package-in-manifest/actions/hello.js
@@ -0,0 +1,26 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * Return a simple greeting message for the whole world.
+ */
+function main(params) {
+    msg = "Hello, " + params.name + " from " + params.place;
+    console.log(msg)
+    return { payload:  msg };
+}
+
diff --git a/tests/src/integration/validate-package-in-manifest/deployment.yaml b/tests/src/integration/validate-package-in-manifest/deployment.yaml
new file mode 100644
index 0000000..7200329
--- /dev/null
+++ b/tests/src/integration/validate-package-in-manifest/deployment.yaml
@@ -0,0 +1,13 @@
+application:
+  name: IntegrationTest
+  packages:
+    usingPackageInManifest:
+      actions:
+        helloNodejs-1:
+          inputs:
+            name: Amy
+            place: Paris
+        helloNodejs-3:
+          inputs:
+            name: Arthur
+            place: Hawaii
diff --git a/tests/src/integration/validate-package-in-manifest/manifest.yaml b/tests/src/integration/validate-package-in-manifest/manifest.yaml
new file mode 100644
index 0000000..961e83d
--- /dev/null
+++ b/tests/src/integration/validate-package-in-manifest/manifest.yaml
@@ -0,0 +1,44 @@
+package:
+    name: usingPackageInManifest
+    dependencies:
+        hellowhisk:
+            location: github.com/apache/incubator-openwhisk-test/packages/hellowhisk
+        myhelloworlds:
+            location: github.com/apache/incubator-openwhisk-test/packages/helloworlds
+    actions:
+        helloNodejs-1:
+            function: actions/hello.js
+            runtime: nodejs:6
+            inputs:
+                name:
+                    type: string
+                    description: name of a person
+                place:
+                    type: string
+                    description: location of a person
+            outputs:
+                payload:
+                    type: string
+                    description: a simple greeting message, Hello World!
+        helloNodejs-2:
+            function: actions/hello.js
+            runtime: nodejs:6
+        helloNodejs-3:
+            function: actions/hello.js
+            runtime: nodejs:6
+            inputs:
+                name:
+                    type: string
+                    description: name of a person
+                place:
+                    type: string
+                    description: location of a person
+    sequences:
+        helloworldnodejs-series:
+            actions: helloNodejs-1, helloNodejs-2, helloNodejs-3, hellowhisk/greeting, hellowhisk/httpGet, myhelloworlds/hello-js
+    triggers:
+        triggerNodeJS:
+    rules:
+        ruleNodeJS:
+            trigger: triggerNodeJS
+            action: helloworldnodejs-series
diff --git a/tests/src/integration/validate-package-in-manifest/validate-package-in-manifest_test.go b/tests/src/integration/validate-package-in-manifest/validate-package-in-manifest_test.go
new file mode 100644
index 0000000..7dd5f05
--- /dev/null
+++ b/tests/src/integration/validate-package-in-manifest/validate-package-in-manifest_test.go
@@ -0,0 +1,40 @@
+// +build integration
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package tests
+
+import (
+	"github.com/apache/incubator-openwhisk-wskdeploy/tests/src/integration/common"
+	"github.com/stretchr/testify/assert"
+	"os"
+	"testing"
+)
+
+func TestPackageInManifest(t *testing.T) {
+	wskdeploy := common.NewWskdeploy()
+	_, err := wskdeploy.Deploy(manifestPath, deploymentPath)
+	assert.Equal(t, nil, err, "Failed to deploy based on the manifest and deployment files.")
+	_, err = wskdeploy.Undeploy(manifestPath, deploymentPath)
+	assert.Equal(t, nil, err, "Failed to undeploy based on the manifest and deployment files.")
+}
+
+var (
+	manifestPath   = os.Getenv("GOPATH") + "/src/github.com/apache/incubator-openwhisk-wskdeploy/tests/src/integration/validate-package-in-manifest/manifest.yaml"
+	deploymentPath = os.Getenv("GOPATH") + "/src/github.com/apache/incubator-openwhisk-wskdeploy/tests/src/integration/validate-package-in-manifest/deployment.yaml"
+)

-- 
To stop receiving notification emails like this one, please contact
['"commits@openwhisk.apache.org" <co...@openwhisk.apache.org>'].