End-to-end tests for Deckhouse storage components.
- Create test with script:
cd tests && ./create-test.sh <your-test-name> - Update environment variables in
tests/<your-test-name>/test_exports - Update
tests/<your-test-name>/cluster_config.yml - Apply them:
source tests/<your-test-name>/test_exports - Write your test in
tests/<your-test-name>/<your-test-name>_test.go(Section marked---=== TESTS START HERE ===---) - Run the test:
go test -timeout=240m -v ./tests/<your-test-name> -count=1
Use this mode to run tests against a cluster that is already running (faster iterations, no virtualization/VM setup).
- Set cluster creation mode to use existing cluster:
export TEST_CLUSTER_CREATE_MODE=alwaysUseExisting - Point SSH to the test cluster (the Kubernetes API master you want to run tests on):
- Direct access:
SSH_HOST= IP/hostname of the cluster master,SSH_USER= user that can read kubeconfig on that host (preferssudo cat /etc/kubernetes/super-admin.confif that file exists, otherwisesudo cat /etc/kubernetes/admin.conf). - Via jump host: set
SSH_JUMP_HOST,SSH_JUMP_USER,SSH_JUMP_KEY_PATH(optional);SSH_HOST/SSH_USERare the target cluster master.
- Direct access:
- Source the rest of your test env (e.g.
source tests/<your-test-name>/test_exports), then run:go test -timeout=240m -v ./tests/<your-test-name> -count=1
Kubeconfig is written to /tmp/e2e/ (e.g. /tmp/e2e/kubeconfig-<master-ip>.yml). The framework acquires a cluster lock so only one test run uses the cluster at a time. If a previous run left the lock (crash, Ctrl+C), set TEST_CLUSTER_FORCE_LOCK_RELEASE=true for the next run (do not use if another test might be using the cluster).
The -count=1 flag prevents Go from using cached test results.
Timeout 240m is a global timeout for entire testkit. Adjust it on your needs.
go test -timeout=240m -v ./tests/test-folder-name -count=1 -ginkgo.focus="should create virtual machines"NOTE: DO NOT EDIT THIS TESTKIT!
Template folder for creating new E2E tests. Contains a complete framework with:
- Automatic test cluster creation and teardown
- Module enablement and readiness verification
- Environment variable validation and configuration
- Example test structure with BeforeAll/AfterAll hooks
Use ./tests/create-test.sh <your-test-name> to create a new test from this template.
Stress tests for all CSI storage drivers. This test suite:
- Creates a test cluster with required modules (snapshot-controller, and one or more CSI drivers: csi-huawei, csi-hpe, csi-netapp, csi-s3, etc.)
- Applies CSI custom resources from YAML files in
files/directory (storage connections, storage classes, NGCs) - Validates environment variables referenced in CR files are set before applying
- Runs flog stress test with PVC resize operations
- Runs comprehensive snapshot/resize/clone stress test (multiple resize stages, snapshots, clones)
Designed to validate any CSI driver stability under high load with concurrent PVC operations, snapshots, and clones. Configure which drivers to test by editing crFiles and storageClassNames in the test file.
Run the test: go test -timeout=120m -v ./tests/csi-all-stress-tests -count=1
See docs/FUNCTIONS_GLOSSARY.md for a full list of all exported functions in the pkg/ directory, grouped by resource (cluster, VM, PVC, LVMVolumeGroup, etc.).
SSH_USER-- SSH username for connecting to the base clusterSSH_HOST-- SSH host address of the base clusterTEST_CLUSTER_CREATE_MODE-- Cluster creation mode:alwaysUseExisting,alwaysCreateNew, orcommanderTEST_CLUSTER_STORAGE_CLASS-- Storage class for DKP cluster deploymentDKP_LICENSE_KEY-- Deckhouse Platform license keyREGISTRY_DOCKER_CFG-- Docker registry credentials for downloading images from Deckhouse registry
SSH_PRIVATE_KEY-- Path to SSH private key file. Default:~/.ssh/id_rsa. IfSSH_AUTH_SOCKis set, SSH agent keys are also tried as fallbackSSH_PUBLIC_KEY-- Path to SSH public key file, or plain-text key content. Default:~/.ssh/id_rsa.pubSSH_PASSPHRASE-- Passphrase for the SSH private key. Required for non-interactive mode with encrypted keysSSH_VM_USER-- SSH user for connecting to VMs deployed inside the test cluster. Default:cloudSSH_VM_PASSWORD-- Password for SSH to VMs (e.g.cloud) when connecting from jump host for lsblk checks. If set, usessshpass; leave empty for key-based auth. Required when VMs accept only password auth.SSH_JUMP_HOST-- Jump host address for connecting to clusters behind a bastionSSH_JUMP_USER-- Jump host SSH user. Defaults toSSH_USERif jump host is setSSH_JUMP_KEY_PATH-- Jump host SSH key path. Defaults toSSH_PRIVATE_KEYif jump host is set
YAML_CONFIG_FILENAME-- Filename of the cluster definition YAML. Default:cluster_config.ymlTEST_CLUSTER_CLEANUP-- Set totrueto remove the test cluster after tests complete. Default:falseTEST_CLUSTER_RESUME-- Set totrueto continue from a previous failed run (only foralwaysCreateNew). If the test failed in the middle of cluster creation, re-run withTEST_CLUSTER_RESUME=true; the framework will load saved state from/tmp/e2e/cluster-state.json(written after step 6), restore VM hostnames, and run the remaining steps (connect to first master, add nodes, enable modules). Requires that step 6 (VMs created, VM info gathered) completed before the failure.TEST_CLUSTER_NAMESPACE-- Namespace for DKP cluster deployment. Default:e2e-test-clusterKUBE_CONFIG_PATH-- Path to a kubeconfig file. Used as fallback if SSH-based kubeconfig retrieval failsKUBE_INSECURE_SKIP_TLS_VERIFY-- Set totrueto skip TLS certificate verification for the Kubernetes API (e.g. self-signed certs or tunnel to 127.0.0.1). Default: not set (verify TLS)IMAGE_PULL_POLICY-- Image pull policy for ClusterVirtualImages:AlwaysorIfNotExists. Default:IfNotExists
LOG_LEVEL-- Log level:debug,info,warn, orerror. Default:debugLOG_FILE_PATH-- Path to log file. If set, logs to both console and fileLOG_TIMESTAMPS_ENABLED-- Whether to include timestamps in log output. Default:true
COMMANDER_URL-- URL of the Deckhouse Commander API (required)COMMANDER_TOKEN-- API token for Commander authentication (required)COMMANDER_CLUSTER_NAME-- Name of the cluster in Commander to use or create. Default:e2e-test-clusterCOMMANDER_TEMPLATE_NAME-- Template name for creating a new cluster. Required whenCOMMANDER_CREATE_IF_NOT_EXISTS=trueCOMMANDER_TEMPLATE_VERSION-- Template version to use. Defaults to latestCOMMANDER_REGISTRY_NAME-- Registry name for cluster creation (auto-resolved to registry_id)COMMANDER_CREATE_IF_NOT_EXISTS-- Set totrueto create a new cluster if it doesn't exist. Default:falseCOMMANDER_WAIT_TIMEOUT-- Timeout for waiting for cluster to become ready. Default:30mCOMMANDER_INSECURE_SKIP_TLS_VERIFY-- Skip TLS certificate verification for Commander API. Default:falseCOMMANDER_CA_CERT-- Path to CA certificate file for verifying Commander API TLSCOMMANDER_AUTH_METHOD-- Auth method:x-auth-token,bearer,token,cookie, orbasic. Default:x-auth-tokenCOMMANDER_AUTH_USER-- Username for basic authentication (only withauth_method=basic)COMMANDER_API_PREFIX-- API path prefix for Commander API. Default:/api/v1COMMANDER_VALUES-- Template input values for cluster creation as JSON string
STRESS_TEST_PVC_SIZE-- Initial PVC size. Default:100MiSTRESS_TEST_PODS_COUNT-- Number of pods to create. Default:100STRESS_TEST_PVC_SIZE_AFTER_RESIZE-- PVC size after first resize. Default:200MiSTRESS_TEST_PVC_SIZE_AFTER_RESIZE_STAGE2-- PVC size after second resize. Default:300MiSTRESS_TEST_SNAPSHOTS_PER_PVC-- Number of snapshots per PVC. Default:2STRESS_TEST_MAX_ATTEMPTS-- Maximum attempts for waiting operations. Default:360STRESS_TEST_INTERVAL-- Interval between attempts in seconds. Default:5STRESS_TEST_CLEANUP-- Whether to cleanup resources after stress tests. Default:true