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 Oct 31, 2023
1 parent d7d5e38 commit aaa98f3
Show file tree
Hide file tree
Showing 6 changed files with 143 additions and 1 deletion.
32 changes: 32 additions & 0 deletions config/v1/custom.network.testsuite.yaml
@@ -0,0 +1,32 @@
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:
onUpdate:
- name: Should be able to set status conditions
initial: |
apiVersion: config.openshift.io/v1
kind: Network
spec: {} # No spec is required for a Network
updated: |
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 config/v1/stable.network.testsuite.yaml
Expand Up @@ -12,3 +12,25 @@ tests:
apiVersion: config.openshift.io/v1
kind: Network
spec: {}
onUpdate:
- 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
updated: |
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: {}
32 changes: 32 additions & 0 deletions config/v1/techpreview.network.testsuite.yaml
@@ -0,0 +1,32 @@
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:
onUpdate:
- name: Should be able to set status conditions
initial: |
apiVersion: config.openshift.io/v1
kind: Network
spec: {} # No spec is required for a Network
updated: |
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"
21 changes: 21 additions & 0 deletions operator/v1/custom.network.testsuite.yaml
@@ -0,0 +1,21 @@
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 @@ -227,4 +227,18 @@ tests:
ipv6:
internalMasqueradeSubnet: "abcd:ef01:2345:6789:abcd:ef01:2345::/125"
expectedError: "Invalid value: \"string\": a valid IPv6 address must contain 8 segments unless elided (::), in which case it must contain at most 6 non-empty segments"

- 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: {}
21 changes: 21 additions & 0 deletions operator/v1/techpreview.network.testsuite.yaml
@@ -0,0 +1,21 @@
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 aaa98f3

Please sign in to comment.