mirror of
https://github.com/daeuniverse/dae.git
synced 2024-12-22 21:14:59 +07:00
32 lines
620 B
Go
32 lines
620 B
Go
|
/*
|
||
|
* SPDX-License-Identifier: AGPL-3.0-only
|
||
|
* Copyright (c) 2022-2024, daeuniverse Organization <dae@v2raya.org>
|
||
|
*/
|
||
|
|
||
|
package control
|
||
|
|
||
|
import (
|
||
|
"testing"
|
||
|
"time"
|
||
|
|
||
|
"github.com/shirou/gopsutil/v4/cpu"
|
||
|
"github.com/stretchr/testify/require"
|
||
|
)
|
||
|
|
||
|
func TestUdpTaskPool(t *testing.T) {
|
||
|
isTest = true
|
||
|
c, err := cpu.Times(false)
|
||
|
require.NoError(t, err)
|
||
|
t.Log(c)
|
||
|
DefaultNatTimeout = 1000 * time.Microsecond
|
||
|
for i := 0; i < 100; i++ {
|
||
|
DefaultUdpTaskPool.EmitTask("testkey", func() {
|
||
|
})
|
||
|
time.Sleep(99 * time.Microsecond)
|
||
|
}
|
||
|
time.Sleep(5 * time.Second)
|
||
|
c, err = cpu.Times(false)
|
||
|
require.NoError(t, err)
|
||
|
t.Log(c)
|
||
|
}
|