Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ SHELL = /usr/bin/env bash -o pipefail
# mounted into a Linux sandbox) never mixes incompatible binaries.
HOST_PLATFORM := $(shell go env GOOS)-$(shell go env GOARCH)

## Parallel test execution (override with PARALLEL=2)
PARALLEL ?= 4

## Location to install dependencies to (per-platform to keep host & sandbox separate)
LOCALBIN := $(shell pwd)/bin/$(HOST_PLATFORM)
$(LOCALBIN):
Expand Down Expand Up @@ -94,12 +97,13 @@ test: vet ## Run tests.
.PHONY: test-integration
test-integration: ## Run integration tests
@echo "==> Started integration tests"
@echo "==> Tip: Use TESTARGS='-short' for reduced volume sizes"
@if [ -f "$(PWD)/k8test/cluster/admin.conf" ]; then \
echo "==> Found k8test cluster config at $(PWD)/k8test/cluster/admin.conf, using k8test kubeconfig"; \
KUBECONFIG=$(PWD)/k8test/cluster/admin.conf go test -count 1 -v $(TESTARGS) -tags integration -parallel 4 -timeout 20m ./test/...; \
KUBECONFIG=$(PWD)/k8test/cluster/admin.conf go test -count 1 -v $(TESTARGS) -tags integration -parallel $(PARALLEL) -timeout 20m ./test/...; \
else \
echo "==> No k8test found, using standard kubeconfig loading"; \
go test -count 1 -v $(TESTARGS) -tags integration -parallel 4 -timeout 20m ./test/...; \
go test -count 1 -v $(TESTARGS) -tags integration -parallel $(PARALLEL) -timeout 20m ./test/...; \
fi

.PHONY: lint
Expand Down
4 changes: 4 additions & 0 deletions helpers/run-in-test-cluster
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ export CLUSTER_PREFIX="${CLUSTER_PREFIX-csi}"
export SUBNET="${SUBNET-10.200.1.0/24}"
export CONTROL_COUNT="${CONTROL_COUNT-3}"
export WORKER_COUNT="${WORKER_COUNT-2}"
export FLAVOR="${FLAVOR-flex-8-4}"
export PARALLEL="${PARALLEL-4}"
export IMAGE="${IMAGE-quay.io/cloudscalech/cloudscale-csi-plugin:test}"
export CCM_RELEASE_URL="https://github.com/cloudscale-ch/cloudscale-cloud-controller-manager/releases/latest/download/config.yml"

Expand Down Expand Up @@ -86,6 +88,7 @@ function ensure-cluster() {

# First create the cluster, without configuring the network
k8test/playbooks/create-cluster.yml \
-e flavor="${FLAVOR}" \
-e zone="$zone" \
-e ssh_key=k8test/cluster/ssh.pub \
-e control_count="${CONTROL_COUNT}" \
Expand All @@ -106,6 +109,7 @@ function ensure-cluster() {

# Finally, setup the cluster to completion (includes Cilium install)
k8test/playbooks/create-cluster.yml \
-e flavor="${FLAVOR}" \
-e zone="$zone" \
-e ssh_key=k8test/cluster/ssh.pub \
-e control_count="${CONTROL_COUNT}" \
Expand Down
16 changes: 8 additions & 8 deletions test/kubernetes/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2048,7 +2048,7 @@ func waitCloudscaleVolumeDeleted(t *testing.T, volumeName string) {
start := time.Now()

for {
ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
ctx, cancel := context.WithTimeout(context.Background(), 60*time.Second)
volumes, err := cloudscaleClient.Volumes.List(ctx, cloudscale.WithNameFilter(volumeName))
cancel()
if len(volumes) == 0 {
Expand All @@ -2064,13 +2064,13 @@ func waitCloudscaleVolumeDeleted(t *testing.T, volumeName string) {
}
}
}
if time.Now().UnixNano()-start.UnixNano() > (5 * time.Minute).Nanoseconds() {
if time.Now().UnixNano()-start.UnixNano() > (10 * time.Minute).Nanoseconds() {
t.Errorf("timeout exceeded while waiting for volume %v to be deleted from cloudscale", volumeName)
return
} else {
t.Logf("volume %v not deleted on cloudscale yet; awaiting deletion", volumeName)
time.Sleep(5 * time.Second)
}

t.Logf("volume %v not deleted on cloudscale yet; awaiting deletion", volumeName)
time.Sleep(10 * time.Second)
}
}

Expand Down Expand Up @@ -2628,7 +2628,7 @@ func waitCloudscaleVolumeSnapshotDeleted(t *testing.T, snapshotHandle string) {
start := time.Now()

for {
ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
ctx, cancel := context.WithTimeout(context.Background(), 60*time.Second)
_, err := cloudscaleClient.VolumeSnapshots.Get(ctx, snapshotHandle)
cancel()

Expand All @@ -2644,13 +2644,13 @@ func waitCloudscaleVolumeSnapshotDeleted(t *testing.T, snapshotHandle string) {
t.Logf("error checking snapshot %v: %v", snapshotHandle, err)
}

if time.Since(start) > 5*time.Minute {
if time.Since(start) > 10*time.Minute {
t.Errorf("timeout exceeded while waiting for snapshot %v to be deleted from cloudscale", snapshotHandle)
return
}

t.Logf("snapshot %v not deleted on cloudscale yet; awaiting deletion", snapshotHandle)
time.Sleep(5 * time.Second)
time.Sleep(10 * time.Second)
}
}

Expand Down
Loading