|
9 | 9 | "github.com/bpineau/katafygio/pkg/controller"
|
10 | 10 | "github.com/bpineau/katafygio/pkg/event"
|
11 | 11 |
|
12 |
| - appsv1beta2 "k8s.io/api/apps/v1beta2" |
| 12 | + appsv1 "k8s.io/api/apps/v1" |
13 | 13 | corev1 "k8s.io/api/core/v1"
|
14 | 14 | extv1beta1 "k8s.io/api/extensions/v1beta1"
|
15 | 15 | metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
@@ -92,7 +92,7 @@ var resourcesTests = []resTest{
|
92 | 92 | expect: []string{"deployment"},
|
93 | 93 | resources: []*metav1.APIResourceList{
|
94 | 94 | {
|
95 |
| - GroupVersion: appsv1beta2.SchemeGroupVersion.String(), |
| 95 | + GroupVersion: appsv1.SchemeGroupVersion.String(), |
96 | 96 | APIResources: []metav1.APIResource{
|
97 | 97 | {Name: "deployments", Namespaced: true, Kind: "Deployment", Verbs: stdVerbs},
|
98 | 98 | },
|
@@ -262,3 +262,27 @@ func TestObserverRecoverFromDicoveryFailure(t *testing.T) {
|
262 | 262 | t.Errorf("%s failed: expected %v actual %v", "Recover from failure", expected, factory.names)
|
263 | 263 | }
|
264 | 264 | }
|
| 265 | + |
| 266 | +func TestExclusion(t *testing.T) { |
| 267 | + excluded := []string{"rs", "poD", "endpoints"} // short, singular, plural forms |
| 268 | + |
| 269 | + if isExcluded(excluded, |
| 270 | + metav1.APIResource{Name: "Foos", Kind: "Foo", SingularName: "Foo", ShortNames: []string{}}) { |
| 271 | + t.Error("exclusions shouldn't filter more than specified") |
| 272 | + } |
| 273 | + |
| 274 | + if !isExcluded(excluded, |
| 275 | + metav1.APIResource{Name: "Endpoints", Kind: "Endpoints", SingularName: "Endpoint", ShortNames: []string{"ep"}}) { |
| 276 | + t.Error("exclusions should work on plural resource names") |
| 277 | + } |
| 278 | + |
| 279 | + if !isExcluded(excluded, |
| 280 | + metav1.APIResource{Name: "Pods", Kind: "Pod", SingularName: "Pod", ShortNames: []string{"po"}}) { |
| 281 | + t.Error("exclusions should ignore objects case") |
| 282 | + } |
| 283 | + |
| 284 | + if !isExcluded(excluded, |
| 285 | + metav1.APIResource{Name: "Replicasets", Kind: "ReplicaSet", SingularName: "replicaset", ShortNames: []string{"rs"}}) { |
| 286 | + t.Error("exclusions should support resources shortnames") |
| 287 | + } |
| 288 | +} |
0 commit comments