Merge lp:~rvb/gwacl/fix-destroydeploy into lp:gwacl

Proposed by Raphaël Badin
Status: Rejected
Rejected by: Raphaël Badin
Proposed branch: lp:~rvb/gwacl/fix-destroydeploy
Merge into: lp:gwacl
Diff against target: 84 lines (+17/-21)
3 files modified
example/management/run.go (+4/-18)
management.go (+8/-3)
management_test.go (+5/-0)
To merge this branch: bzr merge lp:~rvb/gwacl/fix-destroydeploy
Reviewer Review Type Date Requested Status
Gavin Panella Approve
Review via email: mp+173034@code.launchpad.net

Commit message

Do not check the error we get from stopping the VM inside DestroyDeployment.

To post a comment you must log in.
Revision history for this message
Gavin Panella (allenap) wrote :

Looks good.

[1]

-        if err != nil && !IsNotFoundError(err) {
-            return err
-        }
+        // Even when the operation itself works (i.e. the VM is stopped) we
+        // seem to alway get a 500 error back.
+        // We chose to ignore the error.
+        // If the operation errors for real and the VM is still running then
+        // the next operation (deleting the disks) will fail.
+        // if err != nil && !IsNotFoundError(err) {
+        //    return err
+        // }

I suggest only ignoring 500 errors. A new IsInternalServerError()
helper would be good here.

[2]

+/*
+// This test is currently disabled as we chose to ignore the errors returned
+// when shutting down the VM.  See the comment in DestroyDeployment's code
+// for more information.
 func (suite *suiteDestroyDeployment) TestFailsShuttingDownRole(c *C) {
     var responses []DispatcherResponse
     // Prepare.
@@ -377,6 +381,7 @@
     c.Check(err, ErrorMatches, "POST request failed [(]500: Internal Server Error[)]")
     c.Check(record, HasLen, 2)
 }
+*/

You can use c.ExpectFailure(reason string) here; see
http://godoc.org/launchpad.net/gocheck#C.ExpectFailure.

review: Approve
lp:~rvb/gwacl/fix-destroydeploy updated
164. By Raphaël Badin

Remove the storage account.

165. By Raphaël Badin

Remove the storage account.

Revision history for this message
Raphaël Badin (rvb) wrote :

Unmerged revisions

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'example/management/run.go'
--- example/management/run.go 2013-07-02 13:53:21 +0000
+++ example/management/run.go 2013-07-04 17:27:26 +0000
@@ -172,17 +172,10 @@
172 fmt.Println("Done adding VM deployment\n")172 fmt.Println("Done adding VM deployment\n")
173173
174 defer func() {174 defer func() {
175 fmt.Println("Deleting VM disk...")175 fmt.Printf("Destroying deployment %s...\n", machineName)
176 err = api.DeleteDisk(diskName)176 requestDestroyDeployment := &gwacl.DestroyDeploymentRequest{ServiceName: hostServiceName, DeploymentName: machineName}
177 checkError(err)177 api.DestroyDeployment(requestDestroyDeployment)
178 fmt.Println("Done deleting VM disk\n")178 fmt.Println("Done destroying deployment\n")
179 }()
180
181 defer func() {
182 fmt.Println("Deleting deployment...")
183 err = api.DeleteDeployment(hostServiceName, deployment.Name)
184 checkError(err)
185 fmt.Println("Done deleting deployment\n")
186 }()179 }()
187180
188 fmt.Println("Starting VM...")181 fmt.Println("Starting VM...")
@@ -190,13 +183,6 @@
190 checkError(err)183 checkError(err)
191 fmt.Println("Done starting VM\n")184 fmt.Println("Done starting VM\n")
192185
193 defer func() {
194 fmt.Println("Stopping VM...")
195 err = api.ShutdownRole(&gwacl.ShutdownRoleRequest{hostServiceName, deployment.Name, role.RoleName})
196 checkError(err)
197 fmt.Println("Done stopping VM\n")
198 }()
199
200 fmt.Println("Listing VM...")186 fmt.Println("Listing VM...")
201 instances, err := api.ListInstances(&gwacl.ListInstancesRequest{hostServiceName})187 instances, err := api.ListInstances(&gwacl.ListInstancesRequest{hostServiceName})
202 checkError(err)188 checkError(err)
203189
=== modified file 'management.go'
--- management.go 2013-07-04 09:53:30 +0000
+++ management.go 2013-07-04 17:27:26 +0000
@@ -121,9 +121,14 @@
121 DeploymentName: request.DeploymentName,121 DeploymentName: request.DeploymentName,
122 RoleName: roleInstance.RoleName,122 RoleName: roleInstance.RoleName,
123 })123 })
124 if err != nil && !IsNotFoundError(err) {124 // Even when the operation itself works (i.e. the VM is stopped) we
125 return err125 // seem to alway get a 500 error back.
126 }126 // We chose to ignore the error.
127 // If the operation errors for real and the VM is still running then
128 // the next operation (deleting the disks) will fail.
129 // if err != nil && !IsNotFoundError(err) {
130 // return err
131 // }
127 }132 }
128 // 2. Delete VM disks.133 // 2. Delete VM disks.
129 diskNameMap := make(map[string]bool)134 diskNameMap := make(map[string]bool)
130135
=== modified file 'management_test.go'
--- management_test.go 2013-07-04 10:53:40 +0000
+++ management_test.go 2013-07-04 17:27:26 +0000
@@ -359,6 +359,10 @@
359 c.Check(record, HasLen, 1)359 c.Check(record, HasLen, 1)
360}360}
361361
362/*
363// This test is currently disabled as we chose to ignore the errors returned
364// when shutting down the VM. See the comment in DestroyDeployment's code
365// for more information.
362func (suite *suiteDestroyDeployment) TestFailsShuttingDownRole(c *C) {366func (suite *suiteDestroyDeployment) TestFailsShuttingDownRole(c *C) {
363 var responses []DispatcherResponse367 var responses []DispatcherResponse
364 // Prepare.368 // Prepare.
@@ -377,6 +381,7 @@
377 c.Check(err, ErrorMatches, "POST request failed [(]500: Internal Server Error[)]")381 c.Check(err, ErrorMatches, "POST request failed [(]500: Internal Server Error[)]")
378 c.Check(record, HasLen, 2)382 c.Check(record, HasLen, 2)
379}383}
384*/
380385
381func (suite *suiteDestroyDeployment) TestFailsDeletingDisk(c *C) {386func (suite *suiteDestroyDeployment) TestFailsDeletingDisk(c *C) {
382 var responses []DispatcherResponse387 var responses []DispatcherResponse

Subscribers

People subscribed via source and target branches

to all changes: