Skip to content

Commit

Permalink
add test to validate resource schema
Browse files Browse the repository at this point in the history
  • Loading branch information
gemmahou committed Mar 27, 2024
1 parent f6a47be commit 6b98185
Show file tree
Hide file tree
Showing 36 changed files with 1,345 additions and 0 deletions.
33 changes: 33 additions & 0 deletions tests/e2e/golden/object/billingaccountiampolicy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
apiVersion: iam.cnrm.cloud.google.com/v1beta1
kind: IAMPolicy
metadata:
annotations:
cnrm.cloud.google.com/deletion-policy: abandon
cnrm.cloud.google.com/state-into-spec: merge
finalizers:
- cnrm.cloud.google.com/finalizer
- cnrm.cloud.google.com/deletion-defender
generation: 1
labels:
cnrm-test: "true"
name: iamexternalonlyref-${uniqueId}
namespace: ${uniqueId}
spec:
bindings:
- members:
- group:[email protected]
- serviceAccount:[email protected]
- user:[email protected]
role: roles/billing.admin
resourceRef:
apiVersion: billing.cnrm.cloud.google.com/v1beta1
external: 123456-777777-000002
kind: BillingAccount
status:
conditions:
- lastTransitionTime: "1970-01-01T00:00:00Z"
message: The resource is up to date
reason: UpToDate
status: "True"
type: Ready
observedGeneration: 1
28 changes: 28 additions & 0 deletions tests/e2e/golden/object/billingaccountiampolicymember.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
apiVersion: iam.cnrm.cloud.google.com/v1beta1
kind: IAMPolicyMember
metadata:
annotations:
cnrm.cloud.google.com/state-into-spec: merge
finalizers:
- cnrm.cloud.google.com/finalizer
- cnrm.cloud.google.com/deletion-defender
generation: 1
labels:
cnrm-test: "true"
name: iamexternalonlyref-${uniqueId}
namespace: ${uniqueId}
spec:
member: serviceAccount:extonly-${uniqueId}@${projectId}.iam.gserviceaccount.com
resourceRef:
apiVersion: billing.cnrm.cloud.google.com/v1beta1
external: 123456-777777-000001
kind: BillingAccount
role: roles/billing.viewer
status:
conditions:
- lastTransitionTime: "1970-01-01T00:00:00Z"
message: The resource is up to date
reason: UpToDate
status: "True"
type: Ready
observedGeneration: 1
35 changes: 35 additions & 0 deletions tests/e2e/golden/object/computediskfromsourcedisk.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
apiVersion: compute.cnrm.cloud.google.com/v1beta1
kind: ComputeDisk
metadata:
annotations:
cnrm.cloud.google.com/management-conflict-prevention-policy: none
cnrm.cloud.google.com/observed-secret-versions: (removed)
cnrm.cloud.google.com/state-into-spec: merge
finalizers:
- cnrm.cloud.google.com/finalizer
- cnrm.cloud.google.com/deletion-defender
generation: 2
labels:
cnrm-test: "true"
name: computedisk-1-${uniqueId}
namespace: ${uniqueId}
spec:
description: an example disk from source disk
location: us-central1-a
physicalBlockSizeBytes: 4096
projectRef:
external: ${projectId}
resourceID: computedisk-1-${uniqueId}
sourceDiskRef:
name: computedisk-2-${uniqueId}
type: pd-standard
status:
conditions:
- lastTransitionTime: "1970-01-01T00:00:00Z"
message: The resource is up to date
reason: UpToDate
status: "True"
type: Ready
creationTimestamp: "1970-01-01T00:00:00Z"
observedGeneration: 2
selfLink: https://compute.googleapis.com/compute/v1/projects/${projectId}/zones/us-central1-a/disks/computedisk-1-${uniqueId}
30 changes: 30 additions & 0 deletions tests/e2e/golden/object/computenetwork.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
apiVersion: compute.cnrm.cloud.google.com/v1beta1
kind: ComputeNetwork
metadata:
annotations:
cnrm.cloud.google.com/management-conflict-prevention-policy: none
cnrm.cloud.google.com/project-id: ${projectId}
cnrm.cloud.google.com/state-into-spec: merge
finalizers:
- cnrm.cloud.google.com/finalizer
- cnrm.cloud.google.com/deletion-defender
generation: 3
labels:
cnrm-test: "true"
label-one: value-one
name: computenetwork-${uniqueId}
namespace: ${uniqueId}
spec:
autoCreateSubnetworks: false
networkFirewallPolicyEnforcementOrder: AFTER_CLASSIC_FIREWALL
resourceID: computenetwork-${uniqueId}
routingMode: GLOBAL
status:
conditions:
- lastTransitionTime: "1970-01-01T00:00:00Z"
message: The resource is up to date
reason: UpToDate
status: "True"
type: Ready
observedGeneration: 3
selfLink: https://compute.googleapis.com/compute/v1/projects/${projectId}/global/networks/computenetwork-${uniqueId}
33 changes: 33 additions & 0 deletions tests/e2e/golden/object/computenodegroup.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
apiVersion: compute.cnrm.cloud.google.com/v1beta1
kind: ComputeNodeGroup
metadata:
annotations:
cnrm.cloud.google.com/management-conflict-prevention-policy: none
cnrm.cloud.google.com/project-id: ${projectId}
cnrm.cloud.google.com/state-into-spec: merge
finalizers:
- cnrm.cloud.google.com/finalizer
- cnrm.cloud.google.com/deletion-defender
generation: 2
labels:
cnrm-test: "true"
name: computenodegroup-${uniqueId}
namespace: ${uniqueId}
spec:
description: A single sole-tenant node in the us-central1-b zone.
maintenancePolicy: DEFAULT
nodeTemplateRef:
name: computenodetemplate-${uniqueId}
resourceID: computenodegroup-${uniqueId}
size: 1
zone: us-central1-b
status:
conditions:
- lastTransitionTime: "1970-01-01T00:00:00Z"
message: The resource is up to date
reason: UpToDate
status: "True"
type: Ready
creationTimestamp: "1970-01-01T00:00:00Z"
observedGeneration: 2
selfLink: https://compute.googleapis.com/compute/v1/projects/${projectId}/zones/us-central1-b/nodeGroups/computenodegroup-${uniqueId}
35 changes: 35 additions & 0 deletions tests/e2e/golden/object/computenodetemplate.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
apiVersion: compute.cnrm.cloud.google.com/v1beta1
kind: ComputeNodeTemplate
metadata:
annotations:
cnrm.cloud.google.com/management-conflict-prevention-policy: none
cnrm.cloud.google.com/project-id: ${projectId}
cnrm.cloud.google.com/state-into-spec: merge
finalizers:
- cnrm.cloud.google.com/finalizer
- cnrm.cloud.google.com/deletion-defender
generation: 2
labels:
cnrm-test: "true"
memory_guarantee: "false"
name: computenodetemplate-${uniqueId}
namespace: ${uniqueId}
spec:
cpuOvercommitType: NONE
description: Node template for sole tenant nodes running in us-central1, with 96vCPUs
and any amount of memory on any machine type.
nodeTypeFlexibility:
cpus: "96"
memory: any
region: us-central1
resourceID: computenodetemplate-${uniqueId}
status:
conditions:
- lastTransitionTime: "1970-01-01T00:00:00Z"
message: The resource is up to date
reason: UpToDate
status: "True"
type: Ready
creationTimestamp: "1970-01-01T00:00:00Z"
observedGeneration: 2
selfLink: https://compute.googleapis.com/compute/v1/projects/${projectId}/regions/us-central1/nodeTemplates/computenodetemplate-${uniqueId}
33 changes: 33 additions & 0 deletions tests/e2e/golden/object/computesubnetwork.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
apiVersion: compute.cnrm.cloud.google.com/v1beta1
kind: ComputeSubnetwork
metadata:
annotations:
cnrm.cloud.google.com/management-conflict-prevention-policy: none
cnrm.cloud.google.com/project-id: ${projectId}
cnrm.cloud.google.com/state-into-spec: merge
finalizers:
- cnrm.cloud.google.com/finalizer
- cnrm.cloud.google.com/deletion-defender
generation: 3
labels:
cnrm-test: "true"
label-one: value-one
name: computesubnetwork-${uniqueId}
namespace: ${uniqueId}
spec:
ipCidrRange: 10.2.0.0/16
networkRef:
name: computenetwork-${uniqueId}
privateIpGoogleAccess: true
region: us-central1
resourceID: computesubnetwork-${uniqueId}
status:
conditions:
- lastTransitionTime: "1970-01-01T00:00:00Z"
message: The resource is up to date
reason: UpToDate
status: "True"
type: Ready
creationTimestamp: "1970-01-01T00:00:00Z"
observedGeneration: 3
selfLink: https://compute.googleapis.com/compute/v1/projects/${projectId}/regions/us-central1/subnetworks/computesubnetwork-${uniqueId}
38 changes: 38 additions & 0 deletions tests/e2e/golden/object/containerattachedcluster.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
apiVersion: containerattached.cnrm.cloud.google.com/v1beta1
kind: ContainerAttachedCluster
metadata:
annotations:
cnrm.cloud.google.com/management-conflict-prevention-policy: none
cnrm.cloud.google.com/mutable-but-unreadable-fields: '{"spec":{"deletionPolicy":"DELETE_IGNORE_ERRORS"}}'
cnrm.cloud.google.com/state-into-spec: merge
finalizers:
- cnrm.cloud.google.com/finalizer
- cnrm.cloud.google.com/deletion-defender
generation: 2
labels:
cnrm-test: "true"
name: containerattachedcluster-${uniqueId}
namespace: ${uniqueId}
spec:
deletionPolicy: DELETE_IGNORE_ERRORS
description: Test attached cluster update
distribution: eks
fleet:
projectRef:
name: project-${uniqueId}
location: us-west1
oidcConfig:
issuerUrl: https://oidc.eks.us-west-2.amazonaws.com/id/A115FE1C770C2452C75219524036FC0F
platformVersion: 1.27.0-gke.2
projectRef:
external: ${projectId}
resourceID: kcc-attached-cluster-127
status:
conditions:
- lastTransitionTime: "1970-01-01T00:00:00Z"
message: The resource is up to date
reason: UpToDate
status: "True"
type: Ready
observedGeneration: 2
state: STATE_UNSPECIFIED
41 changes: 41 additions & 0 deletions tests/e2e/golden/object/edgecontainercluster.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
apiVersion: edgecontainer.cnrm.cloud.google.com/v1beta1
kind: EdgeContainerCluster
metadata:
annotations:
cnrm.cloud.google.com/management-conflict-prevention-policy: none
cnrm.cloud.google.com/state-into-spec: merge
finalizers:
- cnrm.cloud.google.com/finalizer
- cnrm.cloud.google.com/deletion-defender
generation: 2
labels:
cnrm-test: "true"
label-one: value-one
label-two: value-two
name: edgecontainercluster-${uniqueId}
namespace: ${uniqueId}
spec:
authorization:
adminUsers:
usernameRef:
name: gsa-${uniqueId}
fleet:
projectRef:
name: project-${uniqueId}
location: us-central1
networking:
clusterIpv4CidrBlocks:
- 10.0.0.0/16
servicesIpv4CidrBlocks:
- 10.1.0.0/16
projectRef:
external: ${projectId}
resourceID: edgecontainercluster-${uniqueId}
status:
conditions:
- lastTransitionTime: "1970-01-01T00:00:00Z"
message: The resource is up to date
reason: UpToDate
status: "True"
type: Ready
observedGeneration: 2
32 changes: 32 additions & 0 deletions tests/e2e/golden/object/edgecontainernodepool.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
apiVersion: edgecontainer.cnrm.cloud.google.com/v1beta1
kind: EdgeContainerNodePool
metadata:
annotations:
cnrm.cloud.google.com/management-conflict-prevention-policy: none
cnrm.cloud.google.com/state-into-spec: merge
finalizers:
- cnrm.cloud.google.com/finalizer
- cnrm.cloud.google.com/deletion-defender
generation: 2
labels:
cnrm-test: "true"
label-one: value-one
name: edgecontainernodepools-${uniqueId}
namespace: ${uniqueId}
spec:
clusterRef:
name: edgecontainercluster-${uniqueId}
location: us-central1
nodeCount: 1
nodeLocation: edge-site-node-123
projectRef:
external: ${projectId}
resourceID: edgecontainernodepools-${uniqueId}
status:
conditions:
- lastTransitionTime: "1970-01-01T00:00:00Z"
message: The resource is up to date
reason: UpToDate
status: "True"
type: Ready
observedGeneration: 2
32 changes: 32 additions & 0 deletions tests/e2e/golden/object/edgenetworknetwork.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
apiVersion: edgenetwork.cnrm.cloud.google.com/v1beta1
kind: EdgeNetworkNetwork
metadata:
annotations:
cnrm.cloud.google.com/management-conflict-prevention-policy: none
cnrm.cloud.google.com/state-into-spec: merge
finalizers:
- cnrm.cloud.google.com/finalizer
- cnrm.cloud.google.com/deletion-defender
generation: 2
labels:
cnrm-test: "true"
label-one: value-one
name: edgenetworknetwork-${uniqueId}
namespace: ${uniqueId}
spec:
description: Basic Network
location: us-central1
mtu: 9000
projectRef:
external: ${projectId}
resourceID: edgenetworknetwork-${uniqueId}
zone: us-central1-test-zone
status:
conditions:
- lastTransitionTime: "1970-01-01T00:00:00Z"
message: The resource is up to date
reason: UpToDate
status: "True"
type: Ready
name: projects/${projectId}/locations/us-central1/zones/us-central1-test-zone/networks/edgenetworknetwork-${uniqueId}
observedGeneration: 2
Loading

0 comments on commit 6b98185

Please sign in to comment.