diff --git a/internal/docker/deployer.go b/internal/docker/deployer.go index 18f03129..44d900cc 100644 --- a/internal/docker/deployer.go +++ b/internal/docker/deployer.go @@ -205,6 +205,13 @@ func (d *Deployer) PrintLogs(dep *Deployment) { // Destroy a deployment. This will kill all running containers. func (d *Deployer) Destroy(dep *Deployment, printServerLogs bool, testName string, failed bool) { for _, hsDep := range dep.HS { + result, err := d.executePostScript(hsDep, testName, failed) + if err != nil { + log.Printf("Failed to execute post test script: %s - %s", err, string(result)) + } + if result != nil { + log.Printf("Post test script result: %s", string(result)) + } if printServerLogs { // If we want the logs we gracefully stop the containers to allow // the logs to be flushed. @@ -224,14 +231,6 @@ func (d *Deployer) Destroy(dep *Deployment, printServerLogs bool, testName strin } } - result, err := d.executePostScript(hsDep, testName, failed) - if err != nil { - log.Printf("Failed to execute post test script: %s - %s", err, string(result)) - } - if printServerLogs && err == nil && result != nil { - log.Printf("Post test script result: %s", string(result)) - } - err = d.Docker.ContainerRemove(context.Background(), hsDep.ContainerID, types.ContainerRemoveOptions{ Force: true, })