test(tenant): cover desktop task platform id dedup and target count
Assert uniqueMonitorDesktopTaskPlatformIDs trims and collapses duplicate account specs, and tighten the healthier-candidate case with a target length check. Apply gofmt alignment fixes. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -121,12 +121,24 @@ func TestSelectMonitorDesktopTaskTargetsPrefersHealthierOnlineCandidate(t *testi
|
||||
0,
|
||||
)
|
||||
|
||||
require.Len(t, targets, 1)
|
||||
assert.Equal(t, monitorDesktopTaskTarget{
|
||||
AccountID: liveAccountID,
|
||||
ClientID: liveClientID,
|
||||
}, targets["qwen"])
|
||||
}
|
||||
|
||||
func TestUniqueMonitorDesktopTaskPlatformIDsCollapsesDuplicateAccountSpecs(t *testing.T) {
|
||||
platformIDs := uniqueMonitorDesktopTaskPlatformIDs([]monitorDesktopTaskSpec{
|
||||
{PlatformID: "doubao"},
|
||||
{PlatformID: " doubao "},
|
||||
{PlatformID: "qwen"},
|
||||
{PlatformID: ""},
|
||||
})
|
||||
|
||||
assert.Equal(t, []string{"doubao", "qwen"}, platformIDs)
|
||||
}
|
||||
|
||||
func TestSelectMonitorDesktopTaskTargetsPrefersEarlierOnlineClientForSameAccount(t *testing.T) {
|
||||
accountID := mustParseDailyMonitoringUUID(t, "00000000-0000-0000-0000-000000000501")
|
||||
earlierClientID := mustParseDailyMonitoringUUID(t, "00000000-0000-0000-0000-000000000601")
|
||||
@@ -259,7 +271,7 @@ func TestSelectMonitorDesktopTaskTargetsRequireIdleSkipsAnyActiveBacklog(t *test
|
||||
clientID: 1,
|
||||
},
|
||||
monitorDesktopTaskTargetOptions{
|
||||
MaxClientBacklog: 12,
|
||||
MaxClientBacklog: 12,
|
||||
RequireIdleClient: true,
|
||||
},
|
||||
)
|
||||
@@ -291,7 +303,7 @@ func TestSelectMonitorDesktopTaskTargetsRequireIdleKeepsMultiplePlatformsOnSameI
|
||||
},
|
||||
map[uuid.UUID]int{},
|
||||
monitorDesktopTaskTargetOptions{
|
||||
MaxClientBacklog: 12,
|
||||
MaxClientBacklog: 12,
|
||||
RequireIdleClient: true,
|
||||
},
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user