fix linting for disabled batch test

Signed-off-by: Christian Goll <cgoll@suse.de>
This commit is contained in:
Christian Goll
2023-03-24 09:52:38 +01:00
parent daaf41ffad
commit 4582a1f59e

View File

@@ -1,34 +1,36 @@
// package batch package batch
// import ( import (
// "testing" "testing"
// "time" )
// "github.com/stretchr/testify/assert" /*
// ) Submits 10 jobs into a pool that supports 2 simultaneous jobs, and
// /* Submits 10 jobs into a pool that supports 2 simultaneous jobs, and tests that only two of the jobs ran at a time by capturing the time
// tests that only two of the jobs ran at a time by capturing the time that they ran and comparing against the start time.
// that they ran and comparing against the start time. */ */
// func TestBatchPool (t *testing.T) { func TestBatchPool(t *testing.T) {
// pool := New(2) /*
// var times []time.Time pool := New(2)
// for i := 0; i <= 10; i++ { var times []time.Time
// pool.Submit(func() { for i := 0; i <= 10; i++ {
// times = append(times, time.Now()) pool.Submit(func() {
// time.Sleep(1 * time.Second) times = append(times, time.Now())
// }) time.Sleep(1 * time.Second)
// } })
// startTime := time.Now() }
// pool.Run() startTime := time.Now()
// assert.Equal(t, 0 * time.Second, times[0].Sub(startTime).Round(time.Second)) pool.Run()
// assert.Equal(t, 0 * time.Second, times[1].Sub(startTime).Round(time.Second)) assert.Equal(t, 0 * time.Second, times[0].Sub(startTime).Round(time.Second))
// assert.Equal(t, 1 * time.Second, times[2].Sub(startTime).Round(time.Second)) assert.Equal(t, 0 * time.Second, times[1].Sub(startTime).Round(time.Second))
// assert.Equal(t, 1 * time.Second, times[3].Sub(startTime).Round(time.Second)) assert.Equal(t, 1 * time.Second, times[2].Sub(startTime).Round(time.Second))
// assert.Equal(t, 2 * time.Second, times[4].Sub(startTime).Round(time.Second)) assert.Equal(t, 1 * time.Second, times[3].Sub(startTime).Round(time.Second))
// assert.Equal(t, 2 * time.Second, times[5].Sub(startTime).Round(time.Second)) assert.Equal(t, 2 * time.Second, times[4].Sub(startTime).Round(time.Second))
// assert.Equal(t, 3 * time.Second, times[6].Sub(startTime).Round(time.Second)) assert.Equal(t, 2 * time.Second, times[5].Sub(startTime).Round(time.Second))
// assert.Equal(t, 3 * time.Second, times[7].Sub(startTime).Round(time.Second)) assert.Equal(t, 3 * time.Second, times[6].Sub(startTime).Round(time.Second))
// assert.Equal(t, 4 * time.Second, times[8].Sub(startTime).Round(time.Second)) assert.Equal(t, 3 * time.Second, times[7].Sub(startTime).Round(time.Second))
// assert.Equal(t, 4 * time.Second, times[9].Sub(startTime).Round(time.Second)) assert.Equal(t, 4 * time.Second, times[8].Sub(startTime).Round(time.Second))
// } assert.Equal(t, 4 * time.Second, times[9].Sub(startTime).Round(time.Second))
*/
}