pritidesai closed pull request #903: resolves issue #898 URL: https://github.com/apache/incubator-openwhisk-wskdeploy/pull/903
This is a PR merged from a forked repository. As GitHub hides the original diff on merge, it is displayed below for the sake of provenance: As this is a foreign pull request (from a fork), the diff is supplied below (as it won't show otherwise due to GitHub magic): diff --git a/cmd/export.go b/cmd/export.go index d3d31b1a..ce3b6936 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 2f3e530e..6cc01240 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 00000000..44329389 --- /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 ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services