change test for PDB disruptions (#620)

This commit is contained in:
Robert Brennan
2021-08-31 11:40:36 -04:00
committed by GitHub
parent 9ae4f774e9
commit 19bf91e13b
9 changed files with 59 additions and 14 deletions
+13 -9
View File
@@ -1,18 +1,22 @@
successMessage: disruptionsAllowed is greater than zero
failureMessage: disruptionsAllowed is not greater than zero
successMessage: Voluntary evictions are possible
failureMessage: Voluntary evictions are not possible
category: Reliability
target: policy/PodDisruptionBudget
schema:
'$schema': http://json-schema.org/draft-07/schema
type: object
required:
- status
- spec
properties:
status:
spec:
type: object
required:
- disruptionsAllowed
properties:
disruptionsAllowed:
type: integer
minimum: 1
minAvailable:
not:
const: '100%'
maxUnavailable:
allOf:
- not:
const: 0
- not:
const: '0%'
+1 -1
View File
@@ -45,7 +45,7 @@ func TestValidatePDB(t *testing.T) {
assert.False(t, results.Success)
assert.Equal(t, conf.SeverityWarning, results.Severity)
assert.Equal(t, "Reliability", results.Category)
assert.EqualValues(t, "disruptionsAllowed is not greater than zero", results.Message)
assert.EqualValues(t, "Voluntary evictions are not possible", results.Message)
}
func TestValidateIngress(t *testing.T) {
@@ -0,0 +1,9 @@
apiVersion: v1
kind: PodDisruptionBudget
metadata:
name: nginx
labels:
env: test
spec:
minAvailable: 100%
maxUnavailable: 5
@@ -4,5 +4,5 @@ metadata:
name: nginx
labels:
env: test
status:
disruptionsAllowed: 0
spec:
maxUnavailable: 0
@@ -4,5 +4,5 @@ metadata:
name: nginx
labels:
env: test
status:
disruptionsAllowed: 1
spec:
minAvailable: 100%
@@ -0,0 +1,9 @@
apiVersion: v1
kind: PodDisruptionBudget
metadata:
name: nginx
labels:
env: test
spec:
minAvaiable: 5
maxUnavailable: 10%
@@ -0,0 +1,8 @@
apiVersion: v1
kind: PodDisruptionBudget
metadata:
name: nginx
labels:
env: test
spec:
maxUnavailable: 5%
@@ -0,0 +1,8 @@
apiVersion: v1
kind: PodDisruptionBudget
metadata:
name: nginx
labels:
env: test
spec:
minAvaiable: 5
@@ -0,0 +1,7 @@
apiVersion: v1
kind: PodDisruptionBudget
metadata:
name: nginx
labels:
env: test
spec: {}