mirror of
https://github.com/lejianwen/rustdesk-api.git
synced 2025-12-01 17:43:16 +00:00
feat: Add SysInfoVer endpoint and AppService for version retrieval
This commit is contained in:
33
service/app_test.go
Normal file
33
service/app_test.go
Normal file
@@ -0,0 +1,33 @@
|
||||
package service
|
||||
|
||||
import (
|
||||
"sync"
|
||||
"testing"
|
||||
)
|
||||
|
||||
// TestGetAppVersion
|
||||
func TestGetAppVersion(t *testing.T) {
|
||||
s := &AppService{}
|
||||
v := s.GetAppVersion()
|
||||
// 打印结果
|
||||
t.Logf("App Version: %s", v)
|
||||
}
|
||||
|
||||
func TestMultipleGetAppVersion(t *testing.T) {
|
||||
s := &AppService{}
|
||||
//并发测试
|
||||
// 使用 WaitGroup 等待所有 goroutine 完成
|
||||
wg := sync.WaitGroup{}
|
||||
wg.Add(10) // 启动 10 个 goroutine
|
||||
// 启动 10 个 goroutine
|
||||
for i := 0; i < 10; i++ {
|
||||
go func() {
|
||||
defer wg.Done() // 完成后减少计数
|
||||
v := s.GetAppVersion()
|
||||
// 打印结果
|
||||
t.Logf("App Version: %s", v)
|
||||
}()
|
||||
}
|
||||
// 等待所有 goroutine 完成
|
||||
wg.Wait()
|
||||
}
|
||||
Reference in New Issue
Block a user