apiVersion: apiextensions.k8s.io/v1 # Hack because controller-gen complains if we don't have this name: "[Stable] ClusterVersion" crd: 0000_00_cluster-version-operator_01_clusterversion.crd.yaml tests: onCreate: - name: Should be able to create a minimal ClusterVersion initial: | apiVersion: config.openshift.io/v1 kind: ClusterVersion spec: clusterID: foo expected: | apiVersion: config.openshift.io/v1 kind: ClusterVersion spec: clusterID: foo - name: Should allow image to be set initial: | apiVersion: config.openshift.io/v1 kind: ClusterVersion spec: clusterID: foo desiredUpdate: image: bar expected: | apiVersion: config.openshift.io/v1 kind: ClusterVersion spec: clusterID: foo desiredUpdate: image: bar - name: Should allow version to be set initial: | apiVersion: config.openshift.io/v1 kind: ClusterVersion spec: clusterID: foo desiredUpdate: version: 4.11.1 expected: | apiVersion: config.openshift.io/v1 kind: ClusterVersion spec: clusterID: foo desiredUpdate: version: 4.11.1 - name: Should allow architecture to be empty initial: | apiVersion: config.openshift.io/v1 kind: ClusterVersion spec: clusterID: foo desiredUpdate: architecture: "" version: 4.11.1 expected: | apiVersion: config.openshift.io/v1 kind: ClusterVersion spec: clusterID: foo desiredUpdate: architecture: "" version: 4.11.1 - name: Should allow architecture and version to be set initial: | apiVersion: config.openshift.io/v1 kind: ClusterVersion spec: clusterID: foo desiredUpdate: architecture: Multi version: 4.11.1 expected: | apiVersion: config.openshift.io/v1 kind: ClusterVersion spec: clusterID: foo desiredUpdate: architecture: Multi version: 4.11.1 - name: Version must be set if architecture is set initial: | apiVersion: config.openshift.io/v1 kind: ClusterVersion spec: clusterID: foo desiredUpdate: architecture: Multi expectedError: "Version must be set if Architecture is set" - name: Should not allow image and architecture to be set initial: | apiVersion: config.openshift.io/v1 kind: ClusterVersion spec: clusterID: foo desiredUpdate: architecture: Multi version: 4.11.1 image: bar expectedError: "cannot set both Architecture and Image" onUpdate: - name: Should not allow image to be set if architecture set initial: | apiVersion: config.openshift.io/v1 kind: ClusterVersion spec: clusterID: foo desiredUpdate: architecture: Multi version: 4.11.1 updated: | apiVersion: config.openshift.io/v1 kind: ClusterVersion spec: clusterID: foo desiredUpdate: architecture: Multi version: 4.11.1 image: bar expectedError: "cannot set both Architecture and Image" - name: Should not allow architecture to be set if image set initial: | apiVersion: config.openshift.io/v1 kind: ClusterVersion spec: clusterID: foo desiredUpdate: image: bar updated: | apiVersion: config.openshift.io/v1 kind: ClusterVersion spec: clusterID: foo desiredUpdate: architecture: Multi version: 4.11.1 image: bar expectedError: "cannot set both Architecture and Image"