Skip to content

Commit

Permalink
Merge pull request #96874 from MikeSpreitzer/flaky/apnf-e2e-drown-test
Browse files Browse the repository at this point in the history
Tweak up flaking end-to-end tests of API Priority and Fairness
  • Loading branch information
k8s-ci-robot committed Dec 4, 2020
2 parents c4cf0d4 + e7b0f58 commit e1c617a
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions test/e2e/apimachinery/flowcontrol.go
Expand Up @@ -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")
Expand All @@ -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()))
Expand All @@ -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 {
Expand Down Expand Up @@ -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")
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit e1c617a

Please sign in to comment.