mirror of
https://github.com/psviderski/uncloud.git
synced 2026-08-26 19:13:34 +00:00
test: Add cleanup target that removes dangling test containers
This commit is contained in:
@@ -64,7 +64,26 @@ ucind-multiarch-image-push:
|
||||
|
||||
.PHONY: test
|
||||
test:
|
||||
ifeq ($(TEST_NAME),)
|
||||
go test -v ./...
|
||||
else
|
||||
go test -v -run ^$(TEST_NAME)$$ ./...
|
||||
endif
|
||||
|
||||
.PHONY: test-clean
|
||||
test-clean:
|
||||
@CONTAINERS=$$(docker ps --filter "name=ucind-test" -q); \
|
||||
if [ -n "$$CONTAINERS" ]; then \
|
||||
echo "Killing containers..."; \
|
||||
docker kill $$CONTAINERS; \
|
||||
fi; \
|
||||
CONTAINERS_STOPPED=$$(docker ps -a --filter "name=ucind-test" -q); \
|
||||
if [ -n "$$CONTAINERS_STOPPED" ]; then \
|
||||
echo "Removing stopped containers..."; \
|
||||
docker rm $$CONTAINERS_STOPPED; \
|
||||
else \
|
||||
echo "Nothing to clean."; \
|
||||
fi
|
||||
|
||||
.PHONY: vet
|
||||
vet:
|
||||
|
||||
@@ -72,7 +72,7 @@ func (p *Provisioner) CreateCluster(ctx context.Context, name string, opts Creat
|
||||
ManagedLabel: "",
|
||||
},
|
||||
}
|
||||
// Create a Docker network with the same as the cluster name.
|
||||
// Create a Docker network with the same name as the cluster name.
|
||||
if _, err = p.dockerCli.NetworkCreate(ctx, name, netOpts); err != nil {
|
||||
return c, fmt.Errorf("create Docker network '%s': %w", name, err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user