Created
February 5, 2025 19:47
-
-
Save aaron-prindle/c1909649867068495dc07033cd1ba6d5 to your computer and use it in GitHub Desktop.
ReplicationController.Replicas invalid.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Base valid ReplicationController object (must be the SAME as in valid.yaml) | |
apiVersion: v1 | |
kind: ReplicationController | |
metadata: | |
name: valid-rc | |
spec: | |
replicas: 1 | |
selector: | |
app: my-app | |
template: | |
metadata: | |
labels: | |
app: my-app | |
spec: | |
containers: | |
- name: my-container | |
image: nginx:latest | |
--- | |
# Test Case 1: Replicas = -1 (replace) | |
name: invalid replicas - -1 (replace) | |
replace: | |
"spec.replicas": -1 # Invalid: negative value | |
expectedErrors: | |
- field: spec.replicas | |
type: FieldValueInvalid | |
detail: must be greater than or equal to 0 | |
--- | |
#Test Case 2: Replicas are a string not a number | |
name: invalid replicas - string | |
replace: | |
"spec.replicas": "foo" | |
expectedErrors: | |
- field: spec.replicas | |
type: FieldValueInvalid | |
detail: "invalid type" | |
--- | |
# Test Case 3: Replicas = -5 (applyConfiguration) | |
name: invalid replicas - -5 (applyConfiguration) | |
applyConfiguration: | |
spec: | |
replicas: -5 # Invalid: negative value | |
expectedErrors: | |
- field: spec.replicas | |
type: FieldValueInvalid | |
detail: must be greater than or equal to 0 | |
--- | |
# Test Case 4: Replicas = -2 (jsonPatch) | |
name: invalid replicas - -2 (jsonPatch) | |
jsonPatch: | |
- { "op": "replace", "path": "/spec/replicas", "value": -2 } # Invalid: negative value | |
expectedErrors: | |
- field: spec.replicas | |
type: FieldValueInvalid | |
detail: must be greater than or equal to 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment