Skip to content

Commit

Permalink
test: Only check declared_resources metric
Browse files Browse the repository at this point in the history
The fix GoogleContainerTools#1232 only affects declared_resources from Config Sync.

The metric from RG controller may take longer to be ready. Skip checking for those target values for now.
  • Loading branch information
tiffanny29631 committed Jun 11, 2024
1 parent cd74253 commit a8608c3
Showing 1 changed file with 6 additions and 19 deletions.
25 changes: 6 additions & 19 deletions e2e/testcases/otel_collector_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -280,19 +280,10 @@ func TestGCMMetrics(t *testing.T) {
}

nt.T.Log("Checking resource related metrics after adding test resource")
resourceMetrics := []string{
csmetrics.DeclaredResourcesName,
rgmetrics.ResourceCountName,
rgmetrics.ReadyResourceCountName,
}
_, err = retry.Retry(nt.DefaultWaitTimeout, func() error {
var err error
for _, metricType := range resourceMetrics {
descriptor := fmt.Sprintf("%s/%s", GCMMetricPrefix, metricType)
it := listMetricInGCM(ctx, nt, client, startTime, descriptor)
err = multierr.Append(err, validateMetricInGCM(nt, it, descriptor, nt.ClusterName, metricHasValue(3)))
}
return err
descriptor := fmt.Sprintf("%s/%s", GCMMetricPrefix, csmetrics.DeclaredResourcesName)
it := listMetricInGCM(ctx, nt, client, startTime, descriptor)
return validateMetricInGCM(nt, it, descriptor, nt.ClusterName, metricHasLatestValue(3))
})
if err != nil {
nt.T.Fatal(err)
Expand All @@ -307,13 +298,9 @@ func TestGCMMetrics(t *testing.T) {

nt.T.Log("Checking resource related metrics after removing test resource")
_, err = retry.Retry(nt.DefaultWaitTimeout, func() error {
var err error
for _, metricType := range resourceMetrics {
descriptor := fmt.Sprintf("%s/%s", GCMMetricPrefix, metricType)
it := listMetricInGCM(ctx, nt, client, startTime, descriptor)
err = multierr.Append(err, validateMetricInGCM(nt, it, descriptor, nt.ClusterName, metricHasLatestValue(2)))
}
return err
descriptor := fmt.Sprintf("%s/%s", GCMMetricPrefix, csmetrics.DeclaredResourcesName)
it := listMetricInGCM(ctx, nt, client, startTime, descriptor)
return validateMetricInGCM(nt, it, descriptor, nt.ClusterName, metricHasLatestValue(2))
})
if err != nil {
nt.T.Fatal(err)
Expand Down

0 comments on commit a8608c3

Please sign in to comment.