Skip to content

Commit b349326

Browse files
committed
Address PR comments
1 parent 28ede51 commit b349326

File tree

10 files changed

+43
-245
lines changed

10 files changed

+43
-245
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,9 @@ tilt-settings.json
5454

5555
# e2e output
5656
test/e2e/junit.e2e_suite.*.xml
57-
test/e2e/logs/*
57+
test/e2e/capz-e2e-*.yaml
5858
test/e2e/config/azure-dev-envsubst.yaml
59+
test/e2e/logs/*
5960
_artifacts
6061

6162
# boilerplate_test output

Makefile

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -74,11 +74,11 @@ RBAC_ROOT ?= $(MANIFEST_ROOT)/rbac
7474
PULL_POLICY ?= Always
7575

7676
# Allow overriding the e2e configurations
77+
ARTIFACTS ?= $(ROOT_DIR)/_artifacts
7778
E2E_CONF_FILE ?= $(ROOT_DIR)/test/e2e/config/azure-dev.yaml
7879
E2E_CONF_FILE_ENVSUBST := $(ROOT_DIR)/test/e2e/config/azure-dev-envsubst.yaml
79-
E2E_ARTIFACTS ?= $(ROOT_DIR)/_artifacts
80-
E2E_SKIP_RESOURCE_CLEANUP ?= false
81-
E2E_USE_EXISTING_CLUSTER ?= false
80+
SKIP_CLEANUP ?= false
81+
SKIP_CREATE_MGMT_CLUSTER ?= false
8282

8383
CLUSTER_TEMPLATE ?= cluster-template.yaml
8484
MANAGED_CLUSTER_TEMPLATE ?= cluster-template-aks.yaml
@@ -113,10 +113,10 @@ test-e2e: $(ENVSUBST) ## Run e2e tests
113113
MANAGER_IMAGE=$(CONTROLLER_IMG)-$(ARCH):$(TAG) \
114114
$(ENVSUBST) < $(E2E_CONF_FILE) > $(E2E_CONF_FILE_ENVSUBST) && \
115115
go test ./test/e2e -v -tags=e2e -ginkgo.v -ginkgo.trace -count=1 -timeout=90m \
116-
-e2e.artifacts-folder="$(E2E_ARTIFACTS)" \
116+
-e2e.artifacts-folder="$(ARTIFACTS)" \
117117
-e2e.config="$(E2E_CONF_FILE_ENVSUBST)" \
118-
-e2e.skip-resource-cleanup="$(E2E_SKIP_RESOURCE_CLEANUP)" \
119-
-e2e.use-existing-cluster="$(E2E_USE_EXISTING_CLUSTER)"
118+
-e2e.skip-resource-cleanup="$(SKIP_CLEANUP)" \
119+
-e2e.use-existing-cluster="$(SKIP_CREATE_MGMT_CLUSTER)"
120120

121121
$(KUBECTL) $(KUBE_APISERVER) $(ETCD): ## install test asset kubectl, kube-apiserver, etcd
122122
source ./scripts/fetch_ext_bins.sh && fetch_tools

docs/development.md

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -335,6 +335,8 @@ To generate the mocks you can run
335335
make generate-go
336336
```
337337

338+
339+
338340
#### E2E Testing
339341

340342
To run E2E locally, set `AZURE_CLIENT_ID`, `AZURE_CLIENT_SECRET`, `AZURE_SUBSCRIPTION_ID`, `AZURE_TENANT_ID` and run:
@@ -345,15 +347,13 @@ To run E2E locally, set `AZURE_CLIENT_ID`, `AZURE_CLIENT_SECRET`, `AZURE_SUBSCRI
345347

346348
You can optionally set the following variables:
347349

348-
| Variable | Description | Default |
349-
|------------------------------------|---------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------|
350-
| `AZURE_SSH_PUBLIC_KEY_FILE` | Use your own SSH key. | `${GOPATH}/src/sigs.k8s.io/cluster-api-provider-azure/.sshkey` |
351-
| `AZURE_CONTROL_PLANE_MACHINE_TYPE` | The machine type of the control plane. | `Standard_D2s_v3` |
352-
| `AZURE_NODE_MACHINE_TYPE` | The machine type of the node machine. | `Standard_D2s_v3` |
353-
| `E2E_CONF_FILE` | The path of the [E2E configuration file](https://cluster-api.sigs.k8s.io/developer/e2e.html#defining-an-e2e-config-file). | `${GOPATH}/src/sigs.k8s.io/cluster-api-provider-azure/test/e2e/config/azure-dev.yaml` |
354-
| `E2E_ARTIFACTS` | The path of the artifacts folder. | `${GOPATH}/src/sigs.k8s.io/cluster-api-provider-azure/_artifacts` |
355-
| `E2E_SKIP_RESOURCE_CLEANUP` | Set to `true` if you do not want the bootstrap and workload clusters to be cleaned up after running E2E tests. | `false` |
356-
| `E2E_USE_EXISTING_CLUSTER` | Set to `true` if you are using your own bootstrap cluster. | `false` |
350+
| Variable | Description | Default |
351+
|----------------------------|---------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------|
352+
| `E2E_CONF_FILE` | The path of the [E2E configuration file](https://cluster-api.sigs.k8s.io/developer/e2e.html#defining-an-e2e-config-file). | `${GOPATH}/src/sigs.k8s.io/cluster-api-provider-azure/test/e2e/config/azure-dev.yaml` |
353+
| `SKIP_CLEANUP` | Set to `true` if you do not want the bootstrap and workload clusters to be cleaned up after running E2E tests. | `false` |
354+
| `SKIP_CREATE_MGMT_CLUSTER` | Skip management cluster creation. | `false` |
355+
356+
You can also customize the configuration of the CAPZ cluster created by the E2E tests (except for `CLUSTER_NAME`, `AZURE_RESOURCE_GROUP`, `AZURE_VNET_NAME`, `CONTROL_PLANE_MACHINE_COUNT`, and `WORKER_MACHINE_COUNT`, since they are generated by individual test cases). See [Customizing the cluster deployment](#customizing-the-cluster-deployment) for more details.
357357

358358
#### Conformance Testing
359359

@@ -365,20 +365,20 @@ To run Conformance locally, set `AZURE_CLIENT_ID`, `AZURE_CLIENT_SECRET`, `AZURE
365365

366366
You can optionally set the following variables:
367367

368-
| Variable | Description |
369-
|-----------------------------|---------------------------------------------------------------------------------------------------------------|
370-
| `AZURE_SSH_PUBLIC_KEY_FILE` | Use your own SSH key. |
371-
| `SKIP_CREATE_CLUSTER` | Skip cluster creation. |
372-
| `SKIP_UPSTREAM_E2E_TESTS` | Skip running upstream Kubernetes E2E tests. |
373-
| `SKIP_CLEANUP` | Skip deleting the cluster after the tests finish running. |
374-
| `KUBECONFIG` | Provide your existing cluster kubeconfig filepath. If no kubeconfig is provided, `./kubeconfig` will be used. |
375-
| `SKIP` | Regexp for test cases to skip. |
376-
| `FOCUS` | Regexp for which test cases to run. |
377-
| `PARALLEL` | Skip serial tests and set --ginkgo-parallel. |
378-
| `USE_CI_ARTIFACTS` | Use a CI version of Kubernetes, ie. not a released version (eg. `v1.19.0-alpha.1.426+0926c9c47677e9`) |
379-
| `CI_VERSION` | Provide a custom CI version of Kubernetes. By default, the latest master commit will be used. |
380-
381-
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.
368+
| Variable | Description |
369+
|--------------------------------|---------------------------------------------------------------------------------------------------------------|
370+
| `AZURE_SSH_PUBLIC_KEY_FILE` | Use your own SSH key. |
371+
| `SKIP_CREATE_WORKLOAD_CLUSTER` | Skip workload cluster creation. |
372+
| `SKIP_UPSTREAM_E2E_TESTS` | Skip running upstream Kubernetes E2E tests. |
373+
| `SKIP_CLEANUP` | Skip deleting the cluster after the tests finish running. |
374+
| `KUBECONFIG` | Provide your existing cluster kubeconfig filepath. If no kubeconfig is provided, `./kubeconfig` will be used. |
375+
| `SKIP` | Regexp for test cases to skip. |
376+
| `FOCUS` | Regexp for which test cases to run. |
377+
| `PARALLEL` | Skip serial tests and set --ginkgo-parallel. |
378+
| `USE_CI_ARTIFACTS` | Use a CI version of Kubernetes, ie. not a released version (eg. `v1.19.0-alpha.1.426+0926c9c47677e9`) |
379+
| `CI_VERSION` | Provide a custom CI version of Kubernetes. By default, the latest master commit will be used. |
380+
381+
You can also customize the configuration of the CAPZ cluster (assuming that `SKIP_CREATE_WORKLOAD_CLUSTER` is not set). See [Customizing the cluster deployment](#customizing-the-cluster-deployment) for more details.
382382

383383
In addition to upstream E2E, you can append custom commands to `./scripts/ci-entrypoint.sh` to run E2E from other projects against a CAPZ cluster:
384384

scripts/ci-e2e.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ export AZURE_SUBSCRIPTION_ID_B64="$(echo -n "$AZURE_SUBSCRIPTION_ID" | base64 |
5252
export AZURE_TENANT_ID_B64="$(echo -n "$AZURE_TENANT_ID" | base64 | tr -d '\n')"
5353
export AZURE_CLIENT_ID_B64="$(echo -n "$AZURE_CLIENT_ID" | base64 | tr -d '\n')"
5454
export AZURE_CLIENT_SECRET_B64="$(echo -n "$AZURE_CLIENT_SECRET" | base64 | tr -d '\n')"
55-
export AZURE_LOCATION="${E2E_REGION:-$(get_random_region)}"
55+
export AZURE_LOCATION="${AZURE_LOCATION:-$(get_random_region)}"
5656
export AZURE_CONTROL_PLANE_MACHINE_TYPE="${AZURE_CONTROL_PLANE_MACHINE_TYPE:-"Standard_D2s_v3"}"
5757
export AZURE_NODE_MACHINE_TYPE="${AZURE_NODE_MACHINE_TYPE:-"Standard_D2s_v3"}"
5858

scripts/ci-entrypoint.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ ARTIFACTS="${ARTIFACTS:-${PWD}/_artifacts}"
156156
mkdir -p "${ARTIFACTS}/logs"
157157

158158
# create cluster
159-
if [[ -z "${SKIP_CREATE_CLUSTER:-}" ]]; then
159+
if [[ -z "${SKIP_CREATE_WORKLOAD_CLUSTER:-}" ]]; then
160160
create_cluster
161161
fi
162162

test/e2e/common.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,10 @@ import (
3232

3333
// Test suite constants for e2e config variables
3434
const (
35-
KubernetesVersion = "KUBERNETES_VERSION"
36-
CNIPath = "CNI"
35+
KubernetesVersion = "KUBERNETES_VERSION"
36+
CNIPath = "CNI"
37+
AzureResourceGroup = "AZURE_RESOURCE_GROUP"
38+
AzureVNetName = "AZURE_VNET_NAME"
3739
)
3840

3941
func Byf(format string, a ...interface{}) {

test/e2e/config/azure-dev.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,10 @@ providers:
4444
- name: v0.4.0
4545
value: ../../../config
4646
files:
47-
- sourcePath: ../data/infrastructure-azure/cluster-template.yaml
47+
- sourcePath: ../../../templates/cluster-template.yaml
4848

4949
variables:
50-
KUBERNETES_VERSION: "v1.17.4"
50+
KUBERNETES_VERSION: "${KUBERNETES_VERSION:-v1.17.4}"
5151
CNI: "../../templates/addons/calico.yaml"
5252

5353
intervals:

test/e2e/create_workload_cluster_test.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,14 @@ var _ = Describe("Workoad cluster creation", func() {
5656
namespace, cancelWatches = setupSpecNamespace(ctx, specName, bootstrapClusterProxy, artifactFolder)
5757

5858
clusterName = fmt.Sprintf("capz-e2e-%s", util.RandomString(6))
59+
Expect(os.Setenv(AzureResourceGroup, clusterName)).NotTo(HaveOccurred())
60+
Expect(os.Setenv(AzureVNetName, fmt.Sprintf("%s-vnet", clusterName))).NotTo(HaveOccurred())
5961
})
6062

6163
AfterEach(func() {
6264
cleanup(ctx, specName, bootstrapClusterProxy, artifactFolder, namespace, cancelWatches, cluster, e2eConfig.GetIntervals, skipCleanup)
65+
Expect(os.Unsetenv(AzureResourceGroup)).NotTo(HaveOccurred())
66+
Expect(os.Unsetenv(AzureVNetName)).NotTo(HaveOccurred())
6367
})
6468

6569
Context("Create single controlplane cluster", func() {

test/e2e/data/infrastructure-azure/cluster-template.yaml

Lines changed: 0 additions & 204 deletions
This file was deleted.

test/e2e/e2e_suite_test.go

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -78,11 +78,6 @@ func init() {
7878
}
7979

8080
func TestE2E(t *testing.T) {
81-
// If running in prow, make sure to use the artifacts folder that will be reported in test grid (ignoring the value provided by flag).
82-
if prowArtifactFolder, exists := os.LookupEnv("ARTIFACTS"); exists {
83-
artifactFolder = prowArtifactFolder
84-
}
85-
8681
RegisterFailHandler(Fail)
8782
junitPath := filepath.Join(artifactFolder, fmt.Sprintf("junit.e2e_suite.%d.xml", config.GinkgoConfig.ParallelNode))
8883
junitReporter := reporters.NewJUnitReporter(junitPath)

0 commit comments

Comments
 (0)