Created
February 5, 2025 19:52
-
-
Save aaron-prindle/bf06660a18587651427c7bb68ba01cc2 to your computer and use it in GitHub Desktop.
ReplicationController.Replicas invalid.yaml file re-prompted for no `detail` field
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 | |
--- | |
#Test Case 2: Replicas are a string not a number | |
name: invalid replicas - string | |
replace: | |
"spec.replicas": "foo" | |
expectedErrors: | |
- field: spec.replicas | |
type: FieldValueInvalid | |
--- | |
# Test Case 3: Replicas = -5 (applyConfiguration) | |
name: invalid replicas - -5 (applyConfiguration) | |
applyConfiguration: | |
spec: | |
replicas: -5 # Invalid: negative value | |
expectedErrors: | |
- field: spec.replicas | |
type: FieldValueInvalid | |
--- | |
# 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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment