From aaa98f3c73da585501dfeacb2423e96ef0fc5744 Mon Sep 17 00:00:00 2001 From: David Eads Date: Mon, 21 Aug 2023 17:58:55 -0400 Subject: [PATCH] add networking api tests Signed-off-by: Patryk Diak --- config/v1/custom.network.testsuite.yaml | 32 +++++++++++++++++++ config/v1/stable.network.testsuite.yaml | 22 +++++++++++++ config/v1/techpreview.network.testsuite.yaml | 32 +++++++++++++++++++ operator/v1/custom.network.testsuite.yaml | 21 ++++++++++++ operator/v1/stable.network.testsuite.yaml | 16 +++++++++- .../v1/techpreview.network.testsuite.yaml | 21 ++++++++++++ 6 files changed, 143 insertions(+), 1 deletion(-) create mode 100644 config/v1/custom.network.testsuite.yaml create mode 100644 config/v1/techpreview.network.testsuite.yaml create mode 100644 operator/v1/custom.network.testsuite.yaml create mode 100644 operator/v1/techpreview.network.testsuite.yaml diff --git a/config/v1/custom.network.testsuite.yaml b/config/v1/custom.network.testsuite.yaml new file mode 100644 index 00000000000..1568609b77c --- /dev/null +++ b/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" diff --git a/config/v1/stable.network.testsuite.yaml b/config/v1/stable.network.testsuite.yaml index 822228fc11d..b9e917494d5 100644 --- a/config/v1/stable.network.testsuite.yaml +++ b/config/v1/stable.network.testsuite.yaml @@ -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: {} \ No newline at end of file diff --git a/config/v1/techpreview.network.testsuite.yaml b/config/v1/techpreview.network.testsuite.yaml new file mode 100644 index 00000000000..87c91678ba6 --- /dev/null +++ b/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" diff --git a/operator/v1/custom.network.testsuite.yaml b/operator/v1/custom.network.testsuite.yaml new file mode 100644 index 00000000000..64812a3f53c --- /dev/null +++ b/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 \ No newline at end of file diff --git a/operator/v1/stable.network.testsuite.yaml b/operator/v1/stable.network.testsuite.yaml index c9dd8acf2d5..bcca2b42bdf 100644 --- a/operator/v1/stable.network.testsuite.yaml +++ b/operator/v1/stable.network.testsuite.yaml @@ -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" - \ No newline at end of file + - 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: {} \ No newline at end of file diff --git a/operator/v1/techpreview.network.testsuite.yaml b/operator/v1/techpreview.network.testsuite.yaml new file mode 100644 index 00000000000..96291e47ba6 --- /dev/null +++ b/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 \ No newline at end of file