kubernetes/staging/src/k8s.io/apiserver/pkg/util/flowcontrol/fairqueuing/queueset/queueset_test.go

// fairAlloc computes the max-min fair allocation of the given
// capacity to the given demands (which slice is not side-effected).
func fairAlloc(demands []float64, capacity float64) []float64 {}

func TestFairAlloc(t *testing.T) {}

type uniformClient

func newUniformClient(hash uint64, nThreads, nCalls int, execDuration, thinkDuration time.Duration) uniformClient {}

func (uc uniformClient) setSplit() uniformClient {}

func (uc uniformClient) setInitWidth(seats uint64) uniformClient {}

func (uc uniformClient) pad(finalSeats int, duration time.Duration) uniformClient {}

type uniformScenario

func (us uniformScenario) exercise(t *testing.T) {}

type uniformScenarioState

func (uss *uniformScenarioState) exercise() {}

type uniformScenarioThread

func (ust *uniformScenarioThread) start() {}

// generates an EventFunc that does call k
func (ust *uniformScenarioThread) genCallK(k int) func(time.Time) {}

func (ust *uniformScenarioThread) callK(k int) {}

func insistRequestFromUser(t *testing.T, qs fq.QueueSet, username string) {}

func (uss *uniformScenarioState) evalTo(lim time.Time, last, expectFair bool, margin float64) {}

func (uss *uniformScenarioState) finalReview() {}

func TestMain(m *testing.M) {}

// TestNoRestraint tests whether the no-restraint factory gives every client what it asks for
// even though that is unfair.
// Expects fairness when there is no competition, unfairness when there is competition.
func TestNoRestraint(t *testing.T) {}

func TestBaseline(t *testing.T) {}

func TestExampt(t *testing.T) {}

func TestSeparations(t *testing.T) {}

func TestUniformFlowsHandSize1(t *testing.T) {}

func TestUniformFlowsHandSize3(t *testing.T) {}

func TestDifferentFlowsExpectEqual(t *testing.T) {}

// TestSeatSecondsRollover checks that there is not a problem with SeatSeconds overflow.
func TestSeatSecondsRollover(t *testing.T) {}

func TestDifferentFlowsExpectUnequal(t *testing.T) {}

func TestDifferentWidths(t *testing.T) {}

func TestTooWide(t *testing.T) {}

// TestWindup exercises a scenario with the windup problem.
// That is, a flow that can not use all the seats that it is allocated
// for a while.  During that time, the queues that serve that flow
// advance their `virtualStart` (that is, R(next dispatch in virtual world))
// more slowly than the other queues (which are using more seats than they
// are allocated).  The implementation has a hack that addresses part of
// this imbalance but not all of it.  In this test, flow 1 can not use all
// of its allocation during the first half, and *can* (and does) use all of
// its allocation and more during the second half.
// Thus we expect the fair (not equal) result
// in the first half and an unfair result in the second half.
// This func has two test cases, bounding the amount of unfairness
// in the second half.
func TestWindup(t *testing.T) {}

func TestDifferentFlowsWithoutQueuing(t *testing.T) {}

// TestContextCancel tests cancellation of a request's context.
// The outline is:
//  1. Use a concurrency limit of 1.
//  2. Start request 1.
//  3. Use a fake clock for the following logic, to insulate from scheduler noise.
//  4. The exec fn of request 1 starts request 2, which should wait
//     in its queue.
//  5. The exec fn of request 1 also forks a goroutine that waits 1 second
//     and then cancels the context of request 2.
//  6. The exec fn of request 1, if StartRequest 2 returns a req2 (which is the normal case),
//     calls `req2.Finish`, which is expected to return after the context cancel.
//  7. The queueset interface allows StartRequest 2 to return `nil` in this situation,
//     if the scheduler gets the cancel done before StartRequest finishes;
//     the test handles this without regard to whether the implementation will ever do that.
//  8. Check that the above took exactly 1 second.
func TestContextCancel(t *testing.T) {}

func countingPromiseFactoryFactory(activeCounter counter.GoRoutineCounter) promiseFactoryFactory {}

func TestTotalRequestsExecutingWithPanic(t *testing.T) {}

func TestFindDispatchQueueLocked(t *testing.T) {}

func TestFinishRequestLocked(t *testing.T) {}

func TestRequestSeats(t *testing.T) {}

func TestRequestWork(t *testing.T) {}

func newFIFO(requests ...*request) fifo {}

func newGaugePair(clk clock.PassiveClock) metrics.RatioedGaugePair {}

func newExecSeatsGauge(clk clock.PassiveClock) metrics.RatioedGauge {}

func float64close(x, y float64) bool {}

func uint64max(a, b uint64) uint64 {}

func float64NaNTo0(x float64) float64 {}

func qsComplete(qsc fq.QueueSetCompleter, concurrencyLimit int) fq.QueueSet {}