Skip to content

Commit c2472ce

Browse files
authored
Merge pull request #507 from CecileRobertMichon/conformance
Fix conformance test script to allow building from k8s release
2 parents a04fbed + 1490f4c commit c2472ce

File tree

2 files changed

+41
-14
lines changed

2 files changed

+41
-14
lines changed

docs/development.md

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,32 @@ To run E2E locally, set `AZURE_CLIENT_ID`, `AZURE_CLIENT_SECRET`, `AZURE_SUBSCRI
289289
./scripts/ci-e2e.sh
290290
```
291291

292-
You can optionally set `AZURE_SSH_PUBLIC_KEY_FILE` to use your own ssh key.
292+
You can optionally set `AZURE_SSH_PUBLIC_KEY_FILE` to use your own SSH key.
293+
294+
#### Conformance Testing
295+
296+
To run Conformance locally, set `AZURE_CLIENT_ID`, `AZURE_CLIENT_SECRET`, `AZURE_SUBSCRIPTION_ID`, `AZURE_TENANT_ID` and run:
297+
298+
```bash
299+
./scripts/ci-conformance.sh
300+
```
301+
302+
You can optionally set the following variables:
303+
304+
| Variable | Description |
305+
| --------------------------- | -------------------------------------------------------------------------------------------------------------- |
306+
| `AZURE_SSH_PUBLIC_KEY_FILE` | Use your own SSH key. |
307+
| `SKIP_CREATE_CLUSTER` | Skip cluster creation. |
308+
| `SKIP_TESTS` | Skip running Kubernetes E2E tests. |
309+
| `SKIP_CLEANUP` | Skip deleting the cluster after the tests finish running. |
310+
| `KUBECONFIG` | Provide your existing cluster kubeconfig filepath. If no kubeconfig is provided, `./kubeconfig` will be used. |
311+
| `SKIP` | Regexp for test cases to skip. |
312+
| `FOCUS` | Regexp for which test cases to run. |
313+
| `PARALLEL` | Skip serial tests and set --ginkgo-parallel. |
314+
| `USE_CI_ARTIFACTS` | Use a CI version of Kubernetes, ie. not a released version (eg. `v1.19.0-alpha.1.426+0926c9c47677e9`) |
315+
| `CI_VERSION` | Provide a custom CI version of Kubernetes. By default, the latest master commit will be used. |
316+
317+
You can also customize the configuration of the CAPZ cluster (assuming that `SKIP_CREATE_CLUSTER` is not set). See [Customizing the cluster deployment](#customizing-the-cluster-deployment) for more details.
293318

294319
<!-- References -->
295320

scripts/ci-conformance.sh

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,9 @@ build_k8s() {
7777

7878
create_cluster() {
7979
export CLUSTER_NAME="capz-conformance-$(head /dev/urandom | LC_ALL=C tr -dc a-z0-9 | head -c 6 ; echo '')"
80+
# Conformance test suite needs a cluster with at least 2 nodes
81+
export CONTROL_PLANE_MACHINE_COUNT=${CONTROL_PLANE_MACHINE_COUNT:-3}
82+
export WORKER_MACHINE_COUNT=${WORKER_MACHINE_COUNT:-2}
8083
export CI_VERSION=${CI_VERSION:-$(curl -sSL https://dl.k8s.io/ci/k8s-master.txt)}
8184
export REGISTRY=conformance
8285
${REPO_ROOT}/hack/create-dev-cluster.sh
@@ -90,12 +93,12 @@ run_tests() {
9093
FOCUS="${FOCUS:-"\\[Conformance\\]"}"
9194
# if we set PARALLEL=true, skip serial tests set --ginkgo-parallel
9295
if [[ "${PARALLEL:-false}" == "true" ]]; then
93-
export GINKGO_PARALLEL=y
94-
if [[ -z "${SKIP}" ]]; then
95-
SKIP="\\[Serial\\]"
96-
else
97-
SKIP="\\[Serial\\]|${SKIP}"
98-
fi
96+
export GINKGO_PARALLEL=y
97+
if [[ -z "${SKIP}" ]]; then
98+
SKIP="\\[Serial\\]"
99+
else
100+
SKIP="\\[Serial\\]|${SKIP}"
101+
fi
99102
fi
100103

101104
# get the number of worker nodes
@@ -132,21 +135,20 @@ cleanup() {
132135
}
133136

134137
# create cluster
135-
SKIP_CREATE_CLUSTER=${SKIP_CREATE_CLUSTER:-""}
136-
if [[ -z "${SKIP_CREATE_CLUSTER}" ]]; then
137-
add_kustomize_patch
138+
if [[ -z "${SKIP_CREATE_CLUSTER:-}" ]]; then
139+
if [[ -n ${CI_VERSION:-} || -n ${USE_CI_ARTIFACTS:-} ]]; then
140+
add_kustomize_patch
141+
fi
138142
create_cluster
139143
fi
140144

141145
# build k8s binaries and run conformance tests
142-
SKIP_TESTS=${SKIP_TESTS:-""}
143-
if [[ -z "${SKIP_TESTS}" ]]; then
146+
if [[ -z "${SKIP_TESTS:-}" ]]; then
144147
build_k8s
145148
run_tests
146149
fi
147150

148151
# cleanup
149-
SKIP_CLEANUP=${SKIP_CLEANUP:-""}
150-
if [[ -z "${SKIP_CLEANUP}" ]]; then
152+
if [[ -z "${SKIP_CLEANUP:-}" ]]; then
151153
cleanup
152154
fi

0 commit comments

Comments
 (0)