mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 11:50:44 +00:00
Merge pull request #96874 from MikeSpreitzer/flaky/apnf-e2e-drown-test
Tweak up flaking end-to-end tests of API Priority and Fairness
This commit is contained in:
commit
e1c617a88e
@ -100,8 +100,8 @@ var _ = SIGDescribe("API priority and fairness", func() {
|
||||
// In contrast, "lowqps" stays under its concurrency shares.
|
||||
// Additionally, the "highqps" client also has a higher matching
|
||||
// precedence for its flow schema.
|
||||
{username: highQPSClientName, qps: 100.0, concurrencyMultiplier: 2.0, matchingPrecedence: 999, expectedCompletedPercentage: 0.75},
|
||||
{username: lowQPSClientName, qps: 5.0, concurrencyMultiplier: 0.5, matchingPrecedence: 1000, expectedCompletedPercentage: 0.75},
|
||||
{username: highQPSClientName, qps: 90, concurrencyMultiplier: 2.0, matchingPrecedence: 999, expectedCompletedPercentage: 0.90},
|
||||
{username: lowQPSClientName, qps: 4, concurrencyMultiplier: 0.5, matchingPrecedence: 1000, expectedCompletedPercentage: 0.90},
|
||||
}
|
||||
|
||||
ginkgo.By("creating test priority levels and flow schemas")
|
||||
@ -124,7 +124,7 @@ var _ = SIGDescribe("API priority and fairness", func() {
|
||||
if clients[i].concurrency < 1 {
|
||||
clients[i].concurrency = 1
|
||||
}
|
||||
framework.Logf("request concurrency for %q will be %d (concurrency share = %d)", clients[i].username, clients[i].concurrency, realConcurrency)
|
||||
framework.Logf("request concurrency for %q will be %d (that is %d times client multiplier)", clients[i].username, clients[i].concurrency, realConcurrency)
|
||||
}
|
||||
|
||||
ginkgo.By(fmt.Sprintf("starting uniform QPS load for %s", loadDuration.String()))
|
||||
@ -142,7 +142,7 @@ var _ = SIGDescribe("API priority and fairness", func() {
|
||||
ginkgo.By("checking completed requests with expected values")
|
||||
for _, client := range clients {
|
||||
// Each client should have 95% of its ideal number of completed requests.
|
||||
maxCompletedRequests := float64(client.concurrency) * client.qps * float64(loadDuration/time.Second)
|
||||
maxCompletedRequests := float64(client.concurrency) * client.qps * loadDuration.Seconds()
|
||||
fractionCompleted := float64(client.completedRequests) / maxCompletedRequests
|
||||
framework.Logf("client %q completed %d/%d requests (%.1f%%)", client.username, client.completedRequests, int32(maxCompletedRequests), 100*fractionCompleted)
|
||||
if fractionCompleted < client.expectedCompletedPercentage {
|
||||
@ -183,8 +183,8 @@ var _ = SIGDescribe("API priority and fairness", func() {
|
||||
expectedCompletedPercentage float64 //lint:ignore U1000 field is actually used
|
||||
}
|
||||
clients := []client{
|
||||
{username: highQPSClientName, qps: 100.0, concurrencyMultiplier: 2.0, expectedCompletedPercentage: 0.75},
|
||||
{username: lowQPSClientName, qps: 5.0, concurrencyMultiplier: 0.5, expectedCompletedPercentage: 0.90},
|
||||
{username: highQPSClientName, qps: 90, concurrencyMultiplier: 2.0, expectedCompletedPercentage: 0.90},
|
||||
{username: lowQPSClientName, qps: 4, concurrencyMultiplier: 0.5, expectedCompletedPercentage: 0.90},
|
||||
}
|
||||
|
||||
framework.Logf("getting real concurrency")
|
||||
@ -358,7 +358,7 @@ func testResponseHeaderMatches(f *framework.Framework, impersonatingUser, plUID,
|
||||
func uniformQPSLoadSingle(f *framework.Framework, username string, qps float64, loadDuration time.Duration) int32 {
|
||||
var completed int32
|
||||
var wg sync.WaitGroup
|
||||
ticker := time.NewTicker(time.Duration(1e9/qps) * time.Nanosecond)
|
||||
ticker := time.NewTicker(time.Duration(float64(time.Second) / qps))
|
||||
defer ticker.Stop()
|
||||
timer := time.NewTimer(loadDuration)
|
||||
for {
|
||||
|
Loading…
Reference in New Issue
Block a user