test/integration: adapt numbers in TestAPIServerTransportMetrics with less rest client creations

Signed-off-by: Dr. Stefan Schimanski <stefan.schimanski@gmail.com>
This commit is contained in:
Dr. Stefan Schimanski
2024-07-21 17:41:50 +02:00
parent 834cd7ca4a
commit b27142852f

View File

@@ -57,11 +57,11 @@ func TestAPIServerTransportMetrics(t *testing.T) {
// IMPORTANT: reflect the current values if the test changes // IMPORTANT: reflect the current values if the test changes
// client_test.go:1407: metric rest_client_transport_cache_entries 3 // client_test.go:1407: metric rest_client_transport_cache_entries 3
// client_test.go:1407: metric rest_client_transport_create_calls_total{result="hit"} 61 // client_test.go:1407: metric rest_client_transport_create_calls_total{result="hit"} 20
// client_test.go:1407: metric rest_client_transport_create_calls_total{result="miss"} 3 // client_test.go:1407: metric rest_client_transport_create_calls_total{result="miss"} 3
hits1, misses1, entries1 := checkTransportMetrics(t, client) hits1, misses1, entries1 := checkTransportMetrics(t, client)
// hit ratio at startup depends on multiple factors // hit ratio at startup depends on multiple factors
if (hits1*100)/(hits1+misses1) < 90 { if (hits1*100)/(hits1+misses1) < 85 {
t.Fatalf("transport cache hit ratio %d lower than 90 percent", (hits1*100)/(hits1+misses1)) t.Fatalf("transport cache hit ratio %d lower than 90 percent", (hits1*100)/(hits1+misses1))
} }
@@ -114,7 +114,7 @@ func TestAPIServerTransportMetrics(t *testing.T) {
} }
// hit ratio after startup should grow since no new transports are expected // hit ratio after startup should grow since no new transports are expected
if (hits2*100)/(hits2+misses2) < 95 { if (hits2*100)/(hits2+misses2) < 85 {
t.Fatalf("transport cache hit ratio %d lower than 95 percent", (hits2*100)/(hits2+misses2)) t.Fatalf("transport cache hit ratio %d lower than 95 percent", (hits2*100)/(hits2+misses2))
} }
} }