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

pdesai 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 abd26a6  resolves issue #898 (#903)
abd26a6 is described below

commit abd26a609283d66680f6b68c4297f2d57dae9224
Author: Pavel Kravchenko <[email protected]>
AuthorDate: Mon May 14 21:25:43 2018 +0300

    resolves issue #898 (#903)
    
    * resolves issue #898
    
    - removed obsolete (now) check for multiple packages during export
    - added test
    
    * added missing manifest file
---
 cmd/export.go                                    |  7 ++--
 tests/src/integration/export/export_test.go      | 26 ++++++++++++++
 tests/src/integration/export/manifest_2pack.yaml | 43 ++++++++++++++++++++++++
 3 files changed, 72 insertions(+), 4 deletions(-)

diff --git a/cmd/export.go b/cmd/export.go
index d3d31b1..ce3b693 100644
--- a/cmd/export.go
+++ b/cmd/export.go
@@ -19,7 +19,6 @@ package cmd
 
 import (
        "encoding/base64"
-       "errors"
        "fmt"
        "os"
        "path/filepath"
@@ -150,9 +149,9 @@ func exportProject(projectName string, targetManifest 
string) error {
                                // TODO: throw if there more than single 
package managed by project
                                // currently will be a mess because triggers 
and rules managed under packages
                                // instead of the top level (similar to OW 
model)
-                               if len(maniyaml.Packages) > 1 {
-                                       return errors.New("currently can't work 
with more than one package managed by one project")
-                               }
+                               //                              if 
len(maniyaml.Packages) > 1 {
+                               //                                      return 
errors.New("currently can't work with more than one package managed by one 
project")
+                               //                              }
 
                                // perform the similar check on the list of 
actions from this package
                                // get a list of actions in your namespace
diff --git a/tests/src/integration/export/export_test.go 
b/tests/src/integration/export/export_test.go
index 2f3e530..6cc0124 100644
--- a/tests/src/integration/export/export_test.go
+++ b/tests/src/integration/export/export_test.go
@@ -62,6 +62,29 @@ func TestExport(t *testing.T) {
        assert.Equal(t, nil, err, "Failed to undeploy the lib2.")
 }
 
+func TestExport2Pack(t *testing.T) {
+       projectName := "2pack"
+       wskdeploy := common.NewWskdeploy()
+
+       _, err := wskdeploy.ManagedDeploymentOnlyManifest(manifest2PackPath)
+       assert.Equal(t, nil, err, "Failed to deploy the 2pack manifest file.")
+
+       _, err = wskdeploy.ExportProject(projectName, target2PackManifestPath)
+       assert.Equal(t, nil, err, "Failed to export project.")
+
+       _, err = os.Stat(target2PackManifestPath)
+       assert.Equal(t, nil, err, "Missing exported manifest file")
+
+       _, err = os.Stat(targetManifestFolder + "package_1/pack1_greeting1.js")
+       assert.Equal(t, nil, err, "Missing exported 
package_1/pack1_greeting1.js")
+
+       _, err = os.Stat(targetManifestFolder + "package_2/pack2_greeting2.js")
+       assert.Equal(t, nil, err, "Missing exported 
package_2/pack2_greeting2.js")
+
+       _, err = wskdeploy.UndeployManifestPathOnly(target2PackManifestPath)
+       assert.Equal(t, nil, err, "Failed to undeploy")
+}
+
 var (
        manifestLib1Path = os.Getenv("GOPATH") + 
"/src/github.com/apache/incubator-openwhisk-wskdeploy/tests/src/integration/export/manifest_lib1.yaml"
        manifestLib2Path = os.Getenv("GOPATH") + 
"/src/github.com/apache/incubator-openwhisk-wskdeploy/tests/src/integration/export/manifest_lib2.yaml"
@@ -69,4 +92,7 @@ var (
 
        targetManifestFolder = os.Getenv("GOPATH") + 
"/src/github.com/apache/incubator-openwhisk-wskdeploy/tests/src/integration/export/tmp/"
        targetManifestPath   = targetManifestFolder + "manifest.yaml"
+
+       manifest2PackPath       = os.Getenv("GOPATH") + 
"/src/github.com/apache/incubator-openwhisk-wskdeploy/tests/src/integration/export/manifest_2pack.yaml"
+       target2PackManifestPath = targetManifestFolder + 
"exported2packmanifest.yaml"
 )
diff --git a/tests/src/integration/export/manifest_2pack.yaml 
b/tests/src/integration/export/manifest_2pack.yaml
new file mode 100644
index 0000000..4432938
--- /dev/null
+++ b/tests/src/integration/export/manifest_2pack.yaml
@@ -0,0 +1,43 @@
+#
+# 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.
+#
+
+project:
+  name: 2pack
+packages:
+  package_1:
+      version: 1.0
+      license: Apache-2.0
+      actions:
+        pack1_greeting1:
+          version: 1.0
+          function: src/greeting.js
+          runtime: nodejs:6
+        pack1_greeting2:
+          version: 1.0
+          function: src/greeting.js
+          runtime: nodejs:6
+  package_2:
+      version: 1.0
+      license: Apache-2.0
+      actions:
+        pack2_greeting1:
+          version: 1.0
+          function: src/greeting.js
+          runtime: nodejs:6
+        pack2_greeting2:
+          version: 1.0
+          function: src/greeting.js
+          runtime: nodejs:6
\ No newline at end of file

-- 
To stop receiving notification emails like this one, please contact
[email protected].

Reply via email to