Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions lib/executor/ramping_vus_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,7 @@ func TestRampingVUsRampDownNoWobble(t *testing.T) {
}

// Sample ramp-down at a higher rate
for i := len(sampleTimes); i < rampDownSamples; i++ {
for i := len(sampleTimes); i < len(result); i++ {
time.Sleep(rampDownSampleTime)
result[i] = test.state.GetCurrentlyActiveVUsCount()
}
Expand All @@ -431,12 +431,18 @@ func TestRampingVUsRampDownNoWobble(t *testing.T) {

vuChanges := []int64{result[2]}
// Check ramp-down consistency
for i := 3; i < len(result[2:]); i++ {
for i := 3; i < len(result); i++ {
if result[i] != result[i-1] {
vuChanges = append(vuChanges, result[i])
}
}
assert.Equal(t, []int64{10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0}, vuChanges)
assert.Equal(t, int64(0), vuChanges[len(vuChanges)-1], "ramp-down must end at 0 active VUs")
for i := 1; i < len(vuChanges); i++ {
assert.Lessf(t, vuChanges[i], vuChanges[i-1],
"active VUs increased during ramp-down: %d -> %d (full sample: %v)",
vuChanges[i-1], vuChanges[i], result,
)
}
}

func TestRampingVUsConfigExecutionPlanExample(t *testing.T) {
Expand Down
8 changes: 4 additions & 4 deletions lib/executor/vu_handle_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ func TestVUHandleStartStopRace(t *testing.T) {

var vuID uint64
testIterations := 10000
const returnTimeout = 500 * time.Millisecond
returned := make(chan struct{})

getVU := func() (lib.InitializedVU, error) {
Expand Down Expand Up @@ -159,15 +160,14 @@ func TestVUHandleStartStopRace(t *testing.T) {

vuHandle := newStoppedVUHandle(ctx, getVU, returnVU, mockNextIterations, &BaseConfig{}, logEntry)
go vuHandle.runLoopsIfPossible(runIter)
for range testIterations {
for i := range testIterations {
err := vuHandle.start()
vuHandle.gracefulStop()
require.NoError(t, err)
select {
case <-returned:
case <-time.After(100 * time.Millisecond):
go panic("returning took too long")
time.Sleep(time.Second)
case <-time.After(returnTimeout):
t.Fatalf("VU was not returned within %s after iteration %d", returnTimeout, i)
}
}

Expand Down
Loading