Skip to content

Commit

Permalink
test: fixing e2e test failure due to volume in use error (#55)
Browse files Browse the repository at this point in the history
Issue #, if available:
261
*Description of changes:*
Finch Container Development E2E Tests Compose down command fails to
delete the volumes due to volume being used by compose up command. This
PR added a delay of 10 sec after the compose up command to allow it to
fully up and running the service. This additional wait will prevent the
error of not being able to delete the volume by compose down command due
to concurrent access.

The compose down command fails to delete the volumes because the compose
up command is still using them. This PR adds a 10-second delay after the
compose up command to avoid the error of not being able to delete the
volume by the compose down command due to simultaneous access.

*Testing done:*
Yes


- [x] I've reviewed the guidance in CONTRIBUTING.md


#### License Acceptance

By submitting this pull request, I confirm that my contribution is made
under the terms of the Apache 2.0 license.

Signed-off-by: Monirul Islam <[email protected]>
  • Loading branch information
monirul authored Apr 5, 2023
1 parent 04560ae commit 72ccf1f
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion tests/compose_down.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ package tests
import (
"fmt"
"os"
"time"

"github.com/onsi/ginkgo/v2"
"github.com/onsi/gomega"

"github.com/runfinch/common-tests/command"
"github.com/runfinch/common-tests/ffs"
"github.com/runfinch/common-tests/option"
Expand Down Expand Up @@ -44,6 +44,11 @@ func ComposeDown(o *option.Option) {
volumes := volumes
ginkgo.It(fmt.Sprintf("should stop compose services and delete volumes by specifying %s flag", volumes), func() {
volumes := volumes
// Wait 10 sec before calling compose down since compose down cmd sometimes fails to delete the volume
// due to concurrent access of the volume.
// For more details - https://github.com/runfinch/finch/issues/261
time.Sleep(10 * time.Second)

command.Run(o, "compose", "down", volumes, "--file", composeFilePath)
containerShouldNotExist(o, containerNames...)
volumeShouldNotExist(o, "compose_data_volume")
Expand Down

0 comments on commit 72ccf1f

Please sign in to comment.