douyin-release-gate / verify (push) Failing after 18m54s
Add Douyin notification polling, event details, and manual multi-account private messaging. Refine environment memory settings, account operations, login collection recovery, and message UI; update tests and documentation.
40 lines
1.7 KiB
Go
40 lines
1.7 KiB
Go
package api
|
|
|
|
import (
|
|
"context"
|
|
"testing"
|
|
|
|
hub "git.ipao.vip/rogee/creator-hub/internal/environment"
|
|
)
|
|
|
|
func TestGatewayMemoryLimitPayload(t *testing.T) {
|
|
env := hub.EnvironmentContext{Env: hub.Env{Alias: "memory-env", MemoryLimitMB: 8192}}
|
|
for _, payload := range []map[string]any{gatewayCreatePayload(env, "", gatewayNetworkExit{}), gatewayCreatePayloadForAccount(env, "", gatewayNetworkExit{})} {
|
|
if payload["memory_limit_mb"] != 8192 {
|
|
t.Fatalf("memory not passed: %+v", payload)
|
|
}
|
|
}
|
|
}
|
|
|
|
func TestRunningEnvironmentMemoryOnlyDoesNotRestart(t *testing.T) {
|
|
s := newMemoryStore()
|
|
env := hub.EnvironmentContext{Env: hub.Env{Alias: "memory-env", Gateway: "missing-gateway", MemoryLimitMB: 2048, Fingerprint: hub.Fingerprint{Seed: 1001, Timezone: "Asia/Shanghai"}}, AccountID: "memory-owner", ProfileID: "same-profile", RuntimeID: "same-runtime", BindingVersion: 3}
|
|
s.bindings[env.Alias] = env
|
|
limit := 4096
|
|
view, err := updateAccountEnvironmentSettings(context.Background(), s, env.AccountID, nil, &limit)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
if view["memory_limit_mb"] != limit {
|
|
t.Fatalf("view: %+v", view)
|
|
}
|
|
limit = 8192
|
|
if _, err := updateAccountEnvironmentSettings(context.Background(), s, env.AccountID, &env.Fingerprint, &limit); err != nil {
|
|
t.Fatalf("unchanged fingerprint with memory must not restart: %v", err)
|
|
}
|
|
after, err := s.GetEnvironmentContextForAccount(context.Background(), env.AccountID)
|
|
if err != nil || after.MemoryLimitMB != limit || after.RuntimeID != env.RuntimeID || after.ProfileID != env.ProfileID || after.Fingerprint != env.Fingerprint || after.BindingVersion != env.BindingVersion {
|
|
t.Fatalf("identity changed: %+v %v", after, err)
|
|
}
|
|
}
|