refactor: move task, error and testing utils to separte repo; apply gofumpt

This commit is contained in:
yusing
2025-09-27 13:41:50 +08:00
parent 5043ef778f
commit 6776f20332
203 changed files with 696 additions and 2800 deletions

View File

@@ -4,7 +4,7 @@ import (
"testing"
"github.com/yusing/godoxy/internal/types"
. "github.com/yusing/godoxy/internal/utils/testing"
expect "github.com/yusing/goutils/testing"
)
func TestRebalance(t *testing.T) {
@@ -15,7 +15,7 @@ func TestRebalance(t *testing.T) {
lb.AddServer(TestNewServer(0))
}
lb.rebalance()
ExpectEqual(t, lb.sumWeight, maxWeight)
expect.Equal(t, lb.sumWeight, maxWeight)
})
t.Run("less", func(t *testing.T) {
lb := New(new(types.LoadBalancerConfig))
@@ -26,7 +26,7 @@ func TestRebalance(t *testing.T) {
lb.AddServer(TestNewServer(float64(maxWeight) * .1))
lb.rebalance()
// t.Logf("%s", U.Must(json.MarshalIndent(lb.pool, "", " ")))
ExpectEqual(t, lb.sumWeight, maxWeight)
expect.Equal(t, lb.sumWeight, maxWeight)
})
t.Run("more", func(t *testing.T) {
lb := New(new(types.LoadBalancerConfig))
@@ -39,6 +39,6 @@ func TestRebalance(t *testing.T) {
lb.AddServer(TestNewServer(float64(maxWeight) * .1))
lb.rebalance()
// t.Logf("%s", U.Must(json.MarshalIndent(lb.pool, "", " ")))
ExpectEqual(t, lb.sumWeight, maxWeight)
expect.Equal(t, lb.sumWeight, maxWeight)
})
}