Skip to content

Commit

Permalink
Make resource count dynamic in monitoring tests (#1330)
Browse files Browse the repository at this point in the history
* make resource count dynamic

* explain more counts in monitoring test
  • Loading branch information
skonto authored Jan 11, 2022
1 parent 72f7ed8 commit 0bc14e7
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,15 @@ func TestLoadPlatformEventingMonitoringManifests(t *testing.T) {
t.Errorf("Got %d, want %d", len(manifests), 1)
}
resources := manifests[0].Resources()
if len(resources) != 28 {
t.Errorf("Got %d, want %d", len(resources), 28)

// We create a service monitor and a service monitor service per deployment: len(eventingDeployments)*2 resources.
// One clusterrolebinding (except for mt-broker-controller) per deployment for allowing tokenreviews, subjectaccessreviews
// to be used by kube proxy. All but one deployments have a different sa: len(eventingDeployments) -1 resources.
// RBAC resources from rbac-proxy.yaml: 5 resources that don't depend on the deployments number.
expectedEventingMonitoringResources := len(eventingDeployments)*2 + len(eventingDeployments) - 1 + 5

if len(resources) != expectedEventingMonitoringResources {
t.Errorf("Got %d, want %d", len(resources), expectedEventingMonitoringResources)
}
for _, u := range resources {
kind := strings.ToLower(u.GetKind())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,15 @@ func TestLoadPlatformServingMonitoringManifests(t *testing.T) {
t.Errorf("Got %d, want %d", len(manifests), 1)
}
resources := manifests[0].Resources()
if len(resources) != 20 {
t.Errorf("Got %d, want %d", len(resources), 20)

// We create a service monitor and a service monitor service per deployment: len(servingDeployments)*2 resources.
// One clusterrolebinding for allowing tokenreviews, subjectaccessreviews
// to be used by kube proxy. All deployments share the same sa: 1 resource.
// RBAC resources from rbac-proxy.yaml: 5 resources that don't depend on the deployments number.
expectedServingMonitoringResources := len(servingDeployments)*2 + 5 + 1

if len(resources) != expectedServingMonitoringResources {
t.Errorf("Got %d, want %d", len(resources), expectedServingMonitoringResources)
}
for _, u := range resources {
kind := strings.ToLower(u.GetKind())
Expand Down

0 comments on commit 0bc14e7

Please sign in to comment.