|
| 1 | +# OpenShift Cloud Controller Manager Operator Tests |
| 2 | + |
| 3 | +This directory contains OpenShift Tests Extension (OTE) binaries for testing the cluster-cloud-controller-manager-operator. |
| 4 | + |
| 5 | +## Structure |
| 6 | + |
| 7 | +The test suite is organized into separate sub-projects, each with independent dependencies: |
| 8 | + |
| 9 | +- **`aws-tests/`** - AWS-specific cloud controller manager tests |
| 10 | + - `e2e/aws/` - AWS-specific test implementations |
| 11 | + - `e2e/common/` - Common helper functions (feature gate checks) |
| 12 | + - `main.go` - Binary entry point |
| 13 | + - `go.mod` - Independent dependencies (includes AWS SDK) |
| 14 | +- **`operator-tests/`** - Multi-platform operator conformance tests |
| 15 | + - `e2e/operator/` - Operator test implementations |
| 16 | + - `e2e/common/` - Common helper functions (client config) |
| 17 | + - `main.go` - Binary entry point |
| 18 | + - `go.mod` - Independent dependencies (no AWS SDK) |
| 19 | +- **`bin/`** - Compiled test binaries |
| 20 | + |
| 21 | +## Test Binaries |
| 22 | + |
| 23 | +### 1. `cluster-cloud-controller-manager-operator-tests-ext` |
| 24 | + |
| 25 | +**Purpose:** General cloud controller manager operator tests that run on multiple platforms |
| 26 | + |
| 27 | +**Suites:** |
| 28 | +- `ccm/operator/conformance/parallel` - Parallel conformance tests |
| 29 | +- `ccm/operator/conformance/serial` - Serial conformance tests |
| 30 | + |
| 31 | +**Test Selection:** |
| 32 | +- Platform-agnostic tests that work across cloud providers |
| 33 | +- OpenShift-specific CCM operator functionality tests |
| 34 | +- Automatically filters tests based on platform labels (e.g., `[platform:vsphere]`) |
| 35 | + |
| 36 | +**Use Cases:** |
| 37 | +- General operator conformance testing |
| 38 | +- Multi-platform test runs |
| 39 | +- OpenShift-specific feature validation (e.g., VSphereMixedNodeEnv) |
| 40 | + |
| 41 | +### 2. `cloud-controller-manager-aws-tests-ext` |
| 42 | + |
| 43 | +**Purpose:** AWS-specific cloud controller manager tests |
| 44 | + |
| 45 | +**Suite:** `ccm/aws/conformance/parallel` |
| 46 | + |
| 47 | +**Test Selection:** |
| 48 | +- AWS load balancer tests (`[cloud-provider-aws-e2e] loadbalancer`) |
| 49 | +- AWS node tests (`[cloud-provider-aws-e2e] nodes`) |
| 50 | +- OpenShift AWS-specific tests (`[cloud-provider-aws-e2e-openshift]`) |
| 51 | +- Filters out ECR tests and Serial tests |
| 52 | + |
| 53 | +**Platform Filter:** AWS only (`PlatformEquals("aws")`) |
| 54 | + |
| 55 | +**Topology Exclusions:** |
| 56 | +- On SingleReplica topology, excludes: |
| 57 | + - "nodes should label nodes with topology network info if instance is supported" |
| 58 | + - "nodes should set zone-id topology label" |
| 59 | + |
| 60 | + |
| 61 | +## Test Organization |
| 62 | + |
| 63 | +### AWS Tests (`aws-tests/e2e/`) |
| 64 | + |
| 65 | +- `aws/helper.go` - AWS helper functions (feature gate checks, AWS clients) |
| 66 | +- `aws/loadbalancer.go` - AWS NLB and load balancer tests |
| 67 | +- `common/helper.go` - Feature gate checking (`IsFeatureEnabled`) |
| 68 | + |
| 69 | +### Operator Tests (`operator-tests/e2e/`) |
| 70 | + |
| 71 | +- `operator/vsphere_mixed_node.go` - VSphereMixedNodeEnv feature gate tests |
| 72 | +- `common/helper.go` - Client configuration (`NewClientConfigForTest`) |
| 73 | + |
| 74 | +### Test Prefixes |
| 75 | + |
| 76 | +- `[cloud-provider-aws-e2e-openshift]` - OpenShift-specific tests |
| 77 | + |
| 78 | +### Feature Gates Tested |
| 79 | + |
| 80 | +- `AWSServiceLBNetworkSecurityGroup` - Managed security groups for NLBs |
| 81 | +- `VSphereMixedNodeEnv` - Platform-type node labels on vSphere |
| 82 | + |
| 83 | +## Development |
| 84 | + |
| 85 | +### Adding New Tests |
| 86 | + |
| 87 | +1. Add test files to the appropriate sub-project's `e2e/` directory: |
| 88 | + - `aws-tests/e2e/aws/` - AWS-specific tests |
| 89 | + - `aws-tests/e2e/common/` - AWS-specific shared helpers |
| 90 | + - `operator-tests/e2e/operator/` - Operator tests |
| 91 | + - `operator-tests/e2e/common/` - Operator-specific shared helpers |
| 92 | + |
| 93 | +2. Import the test package in the binary's `main.go` (blank import for side effects): |
| 94 | + ```go |
| 95 | + import _ "github.com/openshift/cluster-cloud-controller-manager-operator/openshift-tests/aws-tests/e2e/aws" |
| 96 | + ``` |
| 97 | + |
| 98 | +3. Tests are automatically discovered by the OTE framework via Ginkgo suite scanning |
| 99 | + |
| 100 | +**Note:** The `e2e/common/` directories are independent in each sub-project and contain only the helper functions needed by that specific binary. |
| 101 | + |
| 102 | +### Building Binaries |
| 103 | + |
| 104 | +```bash |
| 105 | +# From project root - build both binaries |
| 106 | +make cloud-controller-manager-aws-tests-ext cluster-cloud-controller-manager-operator-tests-ext |
| 107 | + |
| 108 | +# Or build all test binaries |
| 109 | +make build |
| 110 | + |
| 111 | +# Or build individually from within each sub-project |
| 112 | +cd openshift-tests/aws-tests && go build -o ../bin/cloud-controller-manager-aws-tests-ext . |
| 113 | +cd openshift-tests/operator-tests && go build -o ../bin/cluster-cloud-controller-manager-operator-tests-ext . |
| 114 | +``` |
| 115 | + |
| 116 | +Binaries are built to `openshift-tests/bin/`: |
| 117 | +- `cloud-controller-manager-aws-tests-ext` (~95MB) |
| 118 | +- `cluster-cloud-controller-manager-operator-tests-ext` (~85MB) |
| 119 | + |
| 120 | +### Running Tests |
| 121 | + |
| 122 | +The test binaries are OpenShift Tests Extension (OTE) binaries and follow the OTE command structure: |
| 123 | + |
| 124 | +```bash |
| 125 | +# List available test suites |
| 126 | +./openshift-tests/bin/cloud-controller-manager-aws-tests-ext list |
| 127 | + |
| 128 | +# Run a specific suite |
| 129 | +./openshift-tests/bin/cloud-controller-manager-aws-tests-ext run ccm/aws/conformance/parallel |
| 130 | + |
| 131 | +# List operator tests |
| 132 | +./openshift-tests/bin/cluster-cloud-controller-manager-operator-tests-ext list |
| 133 | + |
| 134 | +# Run operator tests (parallel or serial) |
| 135 | +./openshift-tests/bin/cluster-cloud-controller-manager-operator-tests-ext run ccm/operator/conformance/parallel |
| 136 | +./openshift-tests/bin/cluster-cloud-controller-manager-operator-tests-ext run ccm/operator/conformance/serial |
| 137 | +``` |
| 138 | + |
| 139 | +**Prerequisites:** |
| 140 | +- `KUBECONFIG` environment variable must be set |
| 141 | +- For AWS tests: AWS credentials configured (via `AWS_ACCESS_KEY_ID`/`AWS_SECRET_ACCESS_KEY` or instance profile) |
| 142 | +- For AWS tests: `AWS_REGION` or `LEASED_RESOURCE` environment variable set |
| 143 | + |
| 144 | +### Updating Dependencies |
| 145 | + |
| 146 | +Each sub-project has its own `go.mod` file, allowing independent dependency management: |
| 147 | + |
| 148 | +```bash |
| 149 | +# From project root - update all modules in the workspace |
| 150 | +./hack/go-mod.sh |
| 151 | + |
| 152 | +# Or update a specific sub-project independently |
| 153 | +cd openshift-tests/aws-tests && go mod tidy |
| 154 | +cd openshift-tests/operator-tests && go mod tidy |
| 155 | +``` |
| 156 | + |
| 157 | +The `hack/go-mod.sh` script (run from project root): |
| 158 | +- Tidies all modules in the workspace (root, aws-tests, operator-tests) |
| 159 | +- Syncs workspace dependencies via `go work sync` |
| 160 | +- Re-tidies after sync to apply version bumps |
| 161 | +- Verifies all modules |
| 162 | +- Creates unified vendor directory |
| 163 | + |
| 164 | +**Benefits of separate modules:** |
| 165 | +- AWS SDK updates only affect `aws-tests/` - operator tests remain stable |
| 166 | +- Each binary can update dependencies independently without blocking the other |
| 167 | +- Faster, more focused dependency updates |
| 168 | +- Reduced dependency bloat (operator tests don't pull in AWS SDK) |
| 169 | + |
| 170 | +## Architecture |
| 171 | + |
| 172 | +### Go Workspace |
| 173 | + |
| 174 | +This directory contains multiple Go modules organized as a workspace: |
| 175 | +- Root module: `github.com/openshift/cluster-cloud-controller-manager-operator` |
| 176 | +- AWS tests: `github.com/openshift/cluster-cloud-controller-manager-operator/openshift-tests/aws-tests` |
| 177 | +- Operator tests: `github.com/openshift/cluster-cloud-controller-manager-operator/openshift-tests/operator-tests` |
| 178 | + |
| 179 | +All modules are coordinated via the workspace defined in `../go.work`. |
| 180 | + |
| 181 | +### OTE Framework |
| 182 | + |
| 183 | +Uses OpenShift Tests Extension framework: |
| 184 | +- Test discovery via Ginkgo suite scanning |
| 185 | +- Extension registration and suite management |
| 186 | +- Platform and topology filtering |
| 187 | +- Kubernetes E2E framework integration |
| 188 | + |
| 189 | +## References |
| 190 | + |
| 191 | +- [OpenShift Tests Extension](https://github.com/openshift-eng/openshift-tests-extension) |
| 192 | +- [Kubernetes E2E Framework](https://github.com/kubernetes/kubernetes/tree/master/test/e2e/framework) |
| 193 | +- [Cloud Provider AWS Tests](https://github.com/kubernetes/cloud-provider-aws/tree/master/tests/e2e) |
0 commit comments