1
- // +build skip_integration
1
+ // +build integration
2
2
3
3
/*
4
4
* Licensed to the Apache Software Foundation (ASF) under one or more
@@ -44,6 +44,8 @@ func TestExport(t *testing.T) {
44
44
45
45
wskdeploy := common .NewWskdeploy ()
46
46
47
+ defer os .RemoveAll (targetManifestFolder )
48
+
47
49
_ , err := wskdeploy .ManagedDeploymentOnlyManifest (manifestLib1Path )
48
50
assert .Equal (t , nil , err , "Failed to deploy the lib1 manifest file." )
49
51
@@ -81,6 +83,8 @@ func SkipTestExportHelloWorld(t *testing.T) {
81
83
targetManifestFolder := os .Getenv ("GOPATH" ) + EXPORT_TEST_PATH + "tmp-" + strconv .Itoa (rand .Intn (1000 )) + "/"
82
84
targetManifestHelloWorldPath := targetManifestFolder + "manifest-" + projectName + ".yaml"
83
85
86
+ defer os .RemoveAll (targetManifestFolder )
87
+
84
88
wskdeploy := common .NewWskdeploy ()
85
89
86
90
_ , err := wskdeploy .ManagedDeploymentManifestAndProject (manifestHelloWorldPath , projectName )
@@ -114,6 +118,9 @@ func TestExport2Pack(t *testing.T) {
114
118
manifest2PackPath := os .Getenv ("GOPATH" ) + EXPORT_TEST_PATH + "manifest_2pack.yaml"
115
119
targetManifestFolder := os .Getenv ("GOPATH" ) + EXPORT_TEST_PATH + "tmp-" + strconv .Itoa (rand .Intn (1000 )) + "/"
116
120
target2PackManifestPath := targetManifestFolder + "exported2packmanifest.yaml"
121
+
122
+ defer os .RemoveAll (targetManifestFolder )
123
+
117
124
projectName := "2pack"
118
125
wskdeploy := common .NewWskdeploy ()
119
126
@@ -135,3 +142,46 @@ func TestExport2Pack(t *testing.T) {
135
142
_ , err = wskdeploy .UndeployManifestPathOnly (manifest2PackPath )
136
143
assert .Equal (t , nil , err , "Failed to undeploy" )
137
144
}
145
+
146
+ func TestExportApi (t * testing.T ) {
147
+ projectName := "ApiExp"
148
+ wskdeploy := common .NewWskdeploy ()
149
+
150
+ defer os .RemoveAll (targetManifestFolder )
151
+
152
+ _ , err := wskdeploy .ManagedDeploymentManifestAndProject (manifestApiExpPath , projectName )
153
+ assert .Equal (t , nil , err , "Failed to deploy the ApiExp manifest file." )
154
+
155
+ _ , err = wskdeploy .ExportProject (projectName , targetApiExpManifestPath )
156
+ assert .Equal (t , nil , err , "Failed to export project." )
157
+
158
+ _ , err = os .Stat (manifestApiExpPath )
159
+ assert .Equal (t , nil , err , "Missing exported manifest file" )
160
+
161
+ _ , err = os .Stat (targetManifestFolder + "api-gateway-test/greeting.js" )
162
+ assert .Equal (t , nil , err , "Missing exported api-gateway-test/greeting.js" )
163
+
164
+ _ , err = wskdeploy .UndeployManifestPathOnly (manifestApiExpPath )
165
+ assert .Equal (t , nil , err , "Failed to undeploy" )
166
+
167
+ _ , err = wskdeploy .ManagedDeploymentOnlyManifest (targetApiExpManifestPath )
168
+ assert .Equal (t , nil , err , "Failed to redeploy the exported manifest file." )
169
+
170
+ _ , err = wskdeploy .UndeployManifestPathOnly (targetApiExpManifestPath )
171
+ assert .Equal (t , nil , err , "Failed to undeploy the exported manifest file" )
172
+ }
173
+
174
+ var (
175
+ manifestLib1Path = os .Getenv ("GOPATH" ) + "/src/github.com/apache/incubator-openwhisk-wskdeploy/tests/src/integration/export/manifest_lib1.yaml"
176
+ manifestLib2Path = os .Getenv ("GOPATH" ) + "/src/github.com/apache/incubator-openwhisk-wskdeploy/tests/src/integration/export/manifest_lib2.yaml"
177
+ manifestExtPath = os .Getenv ("GOPATH" ) + "/src/github.com/apache/incubator-openwhisk-wskdeploy/tests/src/integration/export/manifest_ext.yaml"
178
+
179
+ targetManifestFolder = os .Getenv ("GOPATH" ) + "/src/github.com/apache/incubator-openwhisk-wskdeploy/tests/src/integration/export/tmp/"
180
+ targetManifestPath = targetManifestFolder + "manifest.yaml"
181
+
182
+ manifest2PackPath = os .Getenv ("GOPATH" ) + "/src/github.com/apache/incubator-openwhisk-wskdeploy/tests/src/integration/export/manifest_2pack.yaml"
183
+ target2PackManifestPath = targetManifestFolder + "exported2packmanifest.yaml"
184
+
185
+ manifestApiExpPath = os .Getenv ("GOPATH" ) + "/src/github.com/apache/incubator-openwhisk-wskdeploy/tests/src/integration/export/manifest_apiexp.yaml"
186
+ targetApiExpManifestPath = targetManifestFolder + "exportedapimanifest.yaml"
187
+ )
0 commit comments