Skip to content

Commit

Permalink
test: Add tests for new deprecations
Browse files Browse the repository at this point in the history
  • Loading branch information
david-ortiz-saez committed Aug 23, 2023
1 parent dd9b4d0 commit 025e291
Show file tree
Hide file tree
Showing 8 changed files with 122 additions and 0 deletions.
5 changes: 5 additions & 0 deletions fixtures/csistoragecapacity-v1beta1.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
kind: CSIStorageCapacity
apiVersion: storage.k8s.io/v1beta1
metadata:
name: my-csi-capacity
storageClassName: gp2
30 changes: 30 additions & 0 deletions fixtures/flowschema-v1beta1.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
apiVersion: flowcontrol.apiserver.k8s.io/v1beta1
kind: FlowSchema
metadata:
name: service-accounts-test
spec:
distinguisherMethod:
type: ByUser
matchingPrecedence: 9000
priorityLevelConfiguration:
name: workload-medium
rules:
- nonResourceRules:
- nonResourceURLs:
- '*'
verbs:
- '*'
resourceRules:
- apiGroups:
- '*'
clusterScope: true
namespaces:
- '*'
resources:
- '*'
verbs:
- '*'
subjects:
- group:
name: system:serviceaccounts
kind: Group
30 changes: 30 additions & 0 deletions fixtures/flowschema-v1beta2.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
apiVersion: flowcontrol.apiserver.k8s.io/v1beta2
kind: FlowSchema
metadata:
name: service-accounts-test
spec:
distinguisherMethod:
type: ByUser
matchingPrecedence: 9000
priorityLevelConfiguration:
name: workload-medium
rules:
- nonResourceRules:
- nonResourceURLs:
- '*'
verbs:
- '*'
resourceRules:
- apiGroups:
- '*'
clusterScope: true
namespaces:
- '*'
resources:
- '*'
verbs:
- '*'
subjects:
- group:
name: system:serviceaccounts
kind: Group
14 changes: 14 additions & 0 deletions fixtures/prioritylevelconfiguration-v1beta1.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
apiVersion: flowcontrol.apiserver.k8s.io/v1beta1
kind: PriorityLevelConfiguration
metadata:
name: workload-medium
spec:
limited:
assuredConcurrencyShares: 70
limitResponse:
queuing:
handSize: 6
queueLengthLimit: 50
queues: 128
type: Queue
type: Limited
14 changes: 14 additions & 0 deletions fixtures/prioritylevelconfiguration-v1beta2.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
apiVersion: flowcontrol.apiserver.k8s.io/v1beta2
kind: PriorityLevelConfiguration
metadata:
name: workload-medium
spec:
limited:
assuredConcurrencyShares: 70
limitResponse:
queuing:
handSize: 6
queueLengthLimit: 50
queues: 128
type: Queue
type: Limited
2 changes: 2 additions & 0 deletions test/rules_126_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import (
func TestRego126(t *testing.T) {
testCases := []resourceFixtureTestCase{
{"AutoScaler", []string{"../fixtures/autoscaler-v2beta2.yaml"}, []string{"HorizontalPodAutoscaler"}},
{"FlowSchema", []string{"../fixtures/flowschema-v1beta1.yaml"}, []string{"FlowSchema"}},
{"PriorityLevelConfiguration", []string{"../fixtures/prioritylevelconfiguration-v1beta1.yaml"}, []string{"PriorityLevelConfiguration"}},
}

testResourcesUsingFixtures(t, testCases)
Expand Down
13 changes: 13 additions & 0 deletions test/rules_127_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package test

import (
"testing"
)

func TestRego127(t *testing.T) {
testCases := []resourceFixtureTestCase{
{"CSIStorageCapacity", []string{"../fixtures/csistoragecapacity-v1beta1.yaml"}, []string{"CSIStorageCapacity"}},
}

testResourcesUsingFixtures(t, testCases)
}
14 changes: 14 additions & 0 deletions test/rules_129_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package test

import (
"testing"
)

func TestRego129(t *testing.T) {
testCases := []resourceFixtureTestCase{
{"FlowSchema", []string{"../fixtures/flowschema-v1beta2.yaml"}, []string{"FlowSchema"}},
{"PriorityLevelConfiguration", []string{"../fixtures/prioritylevelconfiguration-v1beta2.yaml"}, []string{"PriorityLevelConfiguration"}},
}

testResourcesUsingFixtures(t, testCases)
}

0 comments on commit 025e291

Please sign in to comment.