-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add helm units tests for gcp cluster crds
- Loading branch information
Showing
3 changed files
with
183 additions
and
0 deletions.
There are no files selected for viewing
33 changes: 33 additions & 0 deletions
33
bootstrap/helm/cluster-api-cluster/tests/gcp_cluster_test.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
suite: test gcp cluster | ||
templates: | ||
- gcp/cluster.yaml | ||
tests: | ||
- it: should be created with default values when provider is gcp | ||
set: | ||
provider: gcp | ||
type: managed | ||
asserts: | ||
- hasDocuments: | ||
count: 1 | ||
- isKind: | ||
of: GCPManagedCluster | ||
- equal: | ||
path: metadata.name | ||
value: plural | ||
- isNullOrEmpty: | ||
path: spec.project | ||
- isNullOrEmpty: | ||
path: spec.region | ||
- lengthEqual: | ||
path: spec.network.subnets | ||
count: 1 | ||
- equal: | ||
path: spec.network.subnets[0].name | ||
value: plural-subnetwork | ||
- it: should not be created when provider is not gcp | ||
set: | ||
type: managed | ||
asserts: | ||
- hasDocuments: | ||
count: 0 | ||
|
71 changes: 71 additions & 0 deletions
71
bootstrap/helm/cluster-api-cluster/tests/gcp_control_plane_test.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
suite: test gcp control plane | ||
templates: | ||
- gcp/control-plane.yaml | ||
tests: | ||
- it: should be created with default values when provider is gcp | ||
set: | ||
provider: gcp | ||
type: managed | ||
asserts: | ||
- hasDocuments: | ||
count: 1 | ||
- isKind: | ||
of: GCPManagedControlPlane | ||
- equal: | ||
path: metadata.name | ||
value: plural | ||
- equal: | ||
path: spec.clusterName | ||
value: plural | ||
- isNullOrEmpty: | ||
path: spec.project | ||
- isNullOrEmpty: | ||
path: spec.location | ||
- equal: | ||
path: spec.controlPlaneVersion | ||
value: "1.24.16" | ||
- it: should use custom kubernetes version if provided | ||
set: | ||
provider: gcp | ||
type: managed | ||
cluster.kubernetesVersion: 1.24 | ||
asserts: | ||
- hasDocuments: | ||
count: 1 | ||
- isKind: | ||
of: GCPManagedControlPlane | ||
- equal: | ||
path: spec.controlPlaneVersion | ||
value: "1.24" | ||
- it: should not contain release channel if set to "unspecified" | ||
set: | ||
provider: gcp | ||
type: managed | ||
cluster.gcp.releaseChannel: unspecified | ||
asserts: | ||
- hasDocuments: | ||
count: 1 | ||
- isKind: | ||
of: GCPManagedControlPlane | ||
- notExists: | ||
path: spec.releaseChannel | ||
- it: should contain release channel if set | ||
set: | ||
provider: gcp | ||
type: managed | ||
cluster.gcp.releaseChannel: stable | ||
asserts: | ||
- hasDocuments: | ||
count: 1 | ||
- isKind: | ||
of: GCPManagedControlPlane | ||
- equal: | ||
path: spec.releaseChannel | ||
value: stable | ||
- it: should not be created when provider is not gcp | ||
set: | ||
type: managed | ||
asserts: | ||
- hasDocuments: | ||
count: 0 | ||
|
79 changes: 79 additions & 0 deletions
79
bootstrap/helm/cluster-api-cluster/tests/gcp_machinepools_test.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
suite: test gcp machine pools | ||
templates: | ||
- gcp/machinepools.yaml | ||
tests: | ||
- it: should be created with default values when provider is gcp | ||
set: | ||
provider: gcp | ||
type: managed | ||
asserts: | ||
- hasDocuments: | ||
count: 6 | ||
- documentIndex: 0 | ||
isKind: | ||
of: GCPManagedMachinePool | ||
- documentIndex: 1 | ||
isKind: | ||
of: MachinePool | ||
- documentIndex: 0 | ||
equal: | ||
path: metadata.name | ||
value: large-burst-on-demand | ||
- documentIndex: 0 | ||
equal: | ||
path: spec.nodePoolName | ||
value: large-burst-on-demand | ||
- documentIndex: 0 | ||
equal: | ||
path: spec.machineType | ||
value: e2-standard-8 | ||
- documentIndex: 2 | ||
equal: | ||
path: metadata.name | ||
value: medium-burst-on-demand | ||
- documentIndex: 2 | ||
equal: | ||
path: spec.nodePoolName | ||
value: medium-burst-on-demand | ||
- documentIndex: 2 | ||
equal: | ||
path: spec.machineType | ||
value: e2-standard-4 | ||
- documentIndex: 4 | ||
equal: | ||
path: metadata.name | ||
value: small-burst-on-demand | ||
- documentIndex: 4 | ||
equal: | ||
path: spec.nodePoolName | ||
value: small-burst-on-demand | ||
- documentIndex: 4 | ||
equal: | ||
path: spec.machineType | ||
value: e2-standard-2 | ||
- it: should have default kubernetes version set | ||
set: | ||
provider: gcp | ||
type: managed | ||
asserts: | ||
- documentIndex: 1 | ||
equal: | ||
path: spec.template.spec.version | ||
value: "1.24.16" | ||
- it: should have custom kubernetes version set | ||
set: | ||
provider: gcp | ||
type: managed | ||
cluster.kubernetesVersion: 1.24 | ||
asserts: | ||
- documentIndex: 1 | ||
equal: | ||
path: spec.template.spec.version | ||
value: "1.24" | ||
- it: should not be created when provider is not gcp | ||
set: | ||
type: managed | ||
asserts: | ||
- hasDocuments: | ||
count: 0 | ||
|