Skip to content

Commit

Permalink
Cleanup volumes when deleting, bump timeout. (#6)
Browse files Browse the repository at this point in the history
* bump the default timeout to 30 seconds

* remove volumes and links associated to containers
  • Loading branch information
jlevesy authored Mar 2, 2019
1 parent c4f4c15 commit 99217f8
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
5 changes: 1 addition & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,6 @@ integration_test:
docker-compose \
-f ./integration/docker-compose.yaml \
up --exit-code-from client client
docker-compose \
-f ./integration/docker-compose.yaml \
logs dind
docker-compose \
-f ./integration/docker-compose.yaml \
down -v
Expand All @@ -58,7 +55,7 @@ lint:
vendor:
go mod download

install: build
install:
mv ${DIST_DIR}/sind $${GOPATH}/bin/sind

build: clean dist binary
Expand Down
4 changes: 2 additions & 2 deletions cli/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (

var (
clusterName = ""
timeout = 10 * time.Second
timeout = 30 * time.Second
)

var rootCmd = &cobra.Command{
Expand All @@ -21,7 +21,7 @@ var rootCmd = &cobra.Command{

func init() {
rootCmd.Flags().StringVarP(&clusterName, "cluster", "c", "sind_default", "Cluster name.")
rootCmd.Flags().DurationVarP(&timeout, "timeout", "t", 10*time.Second, "Command timeout.")
rootCmd.Flags().DurationVarP(&timeout, "timeout", "t", timeout, "Command timeout.")
}

// Execute adds all child commands to the root command and sets flags appropriately.
Expand Down
9 changes: 8 additions & 1 deletion sind/delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,14 @@ func (c *Cluster) deleteContainers(ctx context.Context) error {
for _, container := range containers {
cid := container.ID
errg.Go(func() error {
return client.ContainerRemove(ctx, cid, types.ContainerRemoveOptions{Force: true})
return client.ContainerRemove(
ctx,
cid,
types.ContainerRemoveOptions{
Force: true,
RemoveVolumes: true,
},
)
})
}

Expand Down

0 comments on commit 99217f8

Please sign in to comment.