Skip to content

Commit

Permalink
add networking api tests
Browse files Browse the repository at this point in the history
Signed-off-by: Patryk Diak <pdiak@redhat.com>
  • Loading branch information
deads2k authored and kyrtapz committed Nov 24, 2023
1 parent 4e6142d commit e1277bb
Show file tree
Hide file tree
Showing 6 changed files with 132 additions and 1 deletion.
28 changes: 28 additions & 0 deletions config/v1/custom.network.testsuite.yaml
@@ -0,0 +1,28 @@
apiVersion: apiextensions.k8s.io/v1 # Hack because controller-gen complains if we don't have this
name: "[CustomNoUpgrade] Network"
crd: 0000_10_config-operator_01_network-CustomNoUpgrade.crd.yaml
tests:
onCreate:
- name: Should be able to set status conditions
initial: |
apiVersion: config.openshift.io/v1
kind: Network
spec: {} # No spec is required for a Network
status:
conditions:
- type: NetworkTypeMigrationInProgress
status: "False"
reason: "Reason"
message: "Message"
lastTransitionTime: "2023-10-25T12:00:00Z"
expected: |
apiVersion: config.openshift.io/v1
kind: Network
spec: {}
status:
conditions:
- type: NetworkTypeMigrationInProgress
status: "False"
reason: "Reason"
message: "Message"
lastTransitionTime: "2023-10-25T12:00:00Z"
17 changes: 17 additions & 0 deletions config/v1/stable.network.testsuite.yaml
Expand Up @@ -12,3 +12,20 @@ tests:
apiVersion: config.openshift.io/v1
kind: Network
spec: {}
- name: Should not be able to set status conditions
initial: |
apiVersion: config.openshift.io/v1
kind: Network
spec: {} # No spec is required for a Network
status:
conditions:
- type: NetworkTypeMigrationInProgress
status: "False"
reason: "Reason"
message: "Message"
lastTransitionTime: "2023-10-25T12:00:00Z"
expected: |
apiVersion: config.openshift.io/v1
kind: Network
spec: {}
status: {}
28 changes: 28 additions & 0 deletions config/v1/techpreview.network.testsuite.yaml
@@ -0,0 +1,28 @@
apiVersion: apiextensions.k8s.io/v1 # Hack because controller-gen complains if we don't have this
name: "[TechPreviewNoUpgrade] Network"
crd: 0000_10_config-operator_01_network-TechPreviewNoUpgrade.crd.yaml
tests:
onCreate:
- name: Should be able to set status conditions
initial: |
apiVersion: config.openshift.io/v1
kind: Network
spec: {} # No spec is required for a Network
status:
conditions:
- type: NetworkTypeMigrationInProgress
status: "False"
reason: "Reason"
message: "Message"
lastTransitionTime: "2023-10-25T12:00:00Z"
expected: |
apiVersion: config.openshift.io/v1
kind: Network
spec: {}
status:
conditions:
- type: NetworkTypeMigrationInProgress
status: "False"
reason: "Reason"
message: "Message"
lastTransitionTime: "2023-10-25T12:00:00Z"
22 changes: 22 additions & 0 deletions operator/v1/custom.network.testsuite.yaml
@@ -0,0 +1,22 @@
apiVersion: apiextensions.k8s.io/v1 # Hack because controller-gen complains if we don't have this
name: "[CustomNoUpgrade] Network"
crd: 0000_70_cluster-network-operator_01-CustomNoUpgrade.crd.yaml
tests:
onCreate:
- name: Should be able to create migration mode
initial: |
apiVersion: operator.openshift.io/v1
kind: Network
spec:
migration:
mode: Live
expected: |
apiVersion: operator.openshift.io/v1
kind: Network
spec:
disableNetworkDiagnostics: false
logLevel: Normal
operatorLogLevel: Normal
migration:
mode: Live
16 changes: 15 additions & 1 deletion operator/v1/stable.network.testsuite.yaml
Expand Up @@ -249,4 +249,18 @@ tests:
ipv6:
internalMasqueradeSubnet: "abcd:eff01:2345:6789::2345:6789/20"
expectedError: "Invalid value: \"string\": each segment of an IPv6 address must be a hexadecimal number between 0 and FFFF, failed on segment 2"

- name: Should not be able to create migration mode
initial: |
apiVersion: operator.openshift.io/v1
kind: Network
spec:
migration:
mode: Live
expected: |
apiVersion: operator.openshift.io/v1
kind: Network
spec:
disableNetworkDiagnostics: false
logLevel: Normal
operatorLogLevel: Normal
migration: {}
22 changes: 22 additions & 0 deletions operator/v1/techpreview.network.testsuite.yaml
@@ -0,0 +1,22 @@
apiVersion: apiextensions.k8s.io/v1 # Hack because controller-gen complains if we don't have this
name: "[TechPreviewNoUpgrade] Network"
crd: 0000_70_cluster-network-operator_01-TechPreviewNoUpgrade.crd.yaml
tests:
onCreate:
- name: Should be able to create migration mode
initial: |
apiVersion: operator.openshift.io/v1
kind: Network
spec:
migration:
mode: Live
expected: |
apiVersion: operator.openshift.io/v1
kind: Network
spec:
disableNetworkDiagnostics: false
logLevel: Normal
operatorLogLevel: Normal
migration:
mode: Live

0 comments on commit e1277bb

Please sign in to comment.