461 lines
19 KiB
Go
461 lines
19 KiB
Go
package httpapi
|
|
|
|
import (
|
|
"bytes"
|
|
"context"
|
|
"encoding/json"
|
|
"errors"
|
|
"net/http"
|
|
"net/http/httptest"
|
|
"os"
|
|
"strconv"
|
|
"strings"
|
|
"sync"
|
|
"testing"
|
|
"time"
|
|
|
|
"github.com/go-sql-driver/mysql"
|
|
"sea-vhost/internal/auth"
|
|
"sea-vhost/internal/config"
|
|
"sea-vhost/internal/isolation"
|
|
"sea-vhost/internal/panel"
|
|
"sea-vhost/internal/service"
|
|
"sea-vhost/internal/store"
|
|
)
|
|
|
|
type ownershipTestPanel struct {
|
|
*panel.Mock
|
|
mu sync.Mutex
|
|
failDatabase bool
|
|
ftpPasswords []string
|
|
}
|
|
|
|
func (p *ownershipTestPanel) SetFTPPassword(ctx context.Context, id int64, name, password string) error {
|
|
p.mu.Lock()
|
|
defer p.mu.Unlock()
|
|
p.ftpPasswords = append(p.ftpPasswords, password)
|
|
return nil
|
|
}
|
|
func (p *ownershipTestPanel) SetDatabasePassword(ctx context.Context, id int64, name, password string) error {
|
|
p.mu.Lock()
|
|
defer p.mu.Unlock()
|
|
if p.failDatabase {
|
|
p.failDatabase = false
|
|
return errors.New("injected native database failure")
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func TestAdminBatchOwnershipMySQL(t *testing.T) {
|
|
dsn := os.Getenv("SEA_TEST_MYSQL_DSN")
|
|
if dsn == "" {
|
|
t.Skip("disposable MySQL schema not supplied")
|
|
}
|
|
parsed, err := mysql.ParseDSN(dsn)
|
|
if err != nil || !strings.HasPrefix(parsed.DBName, "svh_cluster_test_") {
|
|
t.Fatal("refusing a non-test schema")
|
|
}
|
|
db, err := store.Open(dsn)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
defer db.Close()
|
|
ctx := context.Background()
|
|
if err = db.Migrate(ctx); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
if err = db.BootstrapAdmin(ctx, "batch-admin@example.invalid", "批量测试管理员", "batch-admin-password-123"); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
root := t.TempDir()
|
|
if err = db.InitializeLocalNode(ctx, "hosts.example.invalid", root, "control.example.invalid"); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
admin, err := db.UserByLogin(ctx, "batch-admin@example.invalid")
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
secret := "batch-test-session-secret-at-least-thirty-two-characters"
|
|
native := &ownershipTestPanel{Mock: panel.NewMock()}
|
|
projectService := service.NewProjects(db, native, isolation.Mock{Root: root}, "hosts.example.invalid", root, true, secret, "control.example.invalid")
|
|
api := New(config.Config{SessionSecret: secret, ManagementDomain: "control.example.invalid", CookieSecure: true, SessionTTL: time.Hour}, db, projectService)
|
|
handler := api.Handler()
|
|
token, err := auth.NewSessionToken(secret)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
if err = db.CreateSession(ctx, admin.ID, token, time.Now().Add(time.Hour)); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
call := func(method, path string, body any, session string) *httptest.ResponseRecorder {
|
|
var buffer bytes.Buffer
|
|
if body != nil {
|
|
_ = json.NewEncoder(&buffer).Encode(body)
|
|
}
|
|
request := httptest.NewRequest(method, "https://control.example.invalid"+path, &buffer)
|
|
request.Header.Set("Origin", "https://control.example.invalid")
|
|
request.Header.Set("Content-Type", "application/json")
|
|
if session != "" {
|
|
request.AddCookie(&http.Cookie{Name: "sea_session", Value: session})
|
|
}
|
|
response := httptest.NewRecorder()
|
|
handler.ServeHTTP(response, request)
|
|
return response
|
|
}
|
|
expect := func(response *httptest.ResponseRecorder, status int) {
|
|
t.Helper()
|
|
if response.Code != status {
|
|
t.Fatalf("HTTP %d, want %d: %s", response.Code, status, response.Body.String())
|
|
}
|
|
}
|
|
path := func(id uint64) string { return "/api/v1/admin/batches/" + strconv.FormatUint(id, 10) }
|
|
requestKey := func() string {
|
|
key, e := randomBatchKey()
|
|
if e != nil {
|
|
t.Fatal(e)
|
|
}
|
|
return key
|
|
}
|
|
submit := func(input batchRequest) uint64 {
|
|
t.Helper()
|
|
response := call("POST", "/api/v1/admin/batches", input, token)
|
|
expect(response, 202)
|
|
var result struct {
|
|
Batch store.AdminBatch `json:"batch"`
|
|
}
|
|
if e := json.Unmarshal(response.Body.Bytes(), &result); e != nil {
|
|
t.Fatal(e)
|
|
}
|
|
return result.Batch.ID
|
|
}
|
|
var stop context.CancelFunc
|
|
var done chan struct{}
|
|
startWorker := func() {
|
|
worker, cancel := context.WithCancel(ctx)
|
|
stop = cancel
|
|
done = make(chan struct{})
|
|
go func() { defer close(done); api.RunAdminBatches(worker) }()
|
|
}
|
|
stopWorker := func() {
|
|
if stop != nil {
|
|
stop()
|
|
select {
|
|
case <-done:
|
|
case <-time.After(20 * time.Second):
|
|
t.Fatal("worker did not stop")
|
|
}
|
|
stop = nil
|
|
}
|
|
}
|
|
defer stopWorker()
|
|
wait := func(id uint64) store.AdminBatch {
|
|
t.Helper()
|
|
deadline := time.Now().Add(90 * time.Second)
|
|
for time.Now().Before(deadline) {
|
|
job, e := db.AdminBatch(ctx, id, false)
|
|
if e != nil {
|
|
t.Fatal(e)
|
|
}
|
|
if job.Pending == 0 && (job.State == "completed" || job.State == "partial") {
|
|
return job
|
|
}
|
|
time.Sleep(25 * time.Millisecond)
|
|
}
|
|
t.Fatal("batch did not finish")
|
|
return store.AdminBatch{}
|
|
}
|
|
download := func(id uint64) [][]string {
|
|
t.Helper()
|
|
response := call("GET", path(id)+"/download", nil, token)
|
|
expect(response, 200)
|
|
var export struct {
|
|
Format string `json:"format"`
|
|
Version int `json:"version"`
|
|
Items []struct {
|
|
Row int `json:"row"`
|
|
State string `json:"state"`
|
|
Label string `json:"label"`
|
|
ResourceID *uint64 `json:"resourceId"`
|
|
Detail string `json:"detail"`
|
|
Result batchResult `json:"result"`
|
|
} `json:"items"`
|
|
}
|
|
if err := json.Unmarshal(response.Body.Bytes(), &export); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
if export.Format != "sea-vhost.batch-result" || export.Version != 1 || !strings.Contains(response.Header().Get("Content-Disposition"), ".json") {
|
|
t.Fatal("JSON download format mismatch")
|
|
}
|
|
records := [][]string{{"batch", "row", "state", "label", "resource", "login", "password", "ftpHost", "ftpUser", "ftpPassword", "database", "databaseUser", "databasePassword", "detail"}}
|
|
for _, item := range export.Items {
|
|
r := item.Result
|
|
login := r.Login
|
|
if login == "" {
|
|
login = r.HostLogin
|
|
}
|
|
resource := ""
|
|
if item.ResourceID != nil {
|
|
resource = strconv.FormatUint(*item.ResourceID, 10)
|
|
}
|
|
records = append(records, []string{strconv.FormatUint(id, 10), strconv.Itoa(item.Row), item.State, item.Label, resource, login, r.Password, r.FTPHost, r.FTPUsername, r.FTPPassword, r.DatabaseName, r.DatabaseUsername, r.DatabasePassword, item.Detail})
|
|
}
|
|
return records
|
|
}
|
|
login := func(identifier, password string) string {
|
|
t.Helper()
|
|
response := call("POST", "/api/v1/auth/login", map[string]string{"identifier": identifier, "password": password}, "")
|
|
expect(response, 200)
|
|
for _, cookie := range response.Result().Cookies() {
|
|
if cookie.Name == "sea_session" {
|
|
return cookie.Value
|
|
}
|
|
}
|
|
t.Fatal("no session cookie")
|
|
return ""
|
|
}
|
|
expect(call("POST", "/api/v1/admin/batches/preview", batchRequest{Operation: "create_users", Rows: []batchRow{{}}}, ""), 401)
|
|
users := batchRequest{RequestKey: requestKey(), Operation: "create_users", Rows: []batchRow{{Slug: "batch-user-a", Name: "批量用户甲", Email: "batch-a@example.invalid", DisplayName: "批量用户甲"}, {Slug: "batch-user-b", Name: "批量用户乙", Email: "batch-b@example.invalid", DisplayName: "批量用户乙"}, {Slug: "batch-user-a", Name: "重复用户甲", Email: "batch-a@example.invalid", DisplayName: "重复用户甲"}}}
|
|
preview := call("POST", "/api/v1/admin/batches/preview", users, token)
|
|
expect(preview, 200)
|
|
if !strings.Contains(preview.Body.String(), "同批邮箱或用户标识重复") {
|
|
t.Fatal("duplicate import did not fail preview")
|
|
}
|
|
batchID := submit(users)
|
|
startWorker()
|
|
job := wait(batchID)
|
|
if job.Succeeded != 2 || job.Failed != 1 {
|
|
t.Fatalf("partial user batch: %+v", job)
|
|
}
|
|
records := download(batchID)
|
|
if len(records) != 4 || records[1][6] == "" || records[1][6] == records[2][6] {
|
|
t.Fatal("missing independent random passwords")
|
|
}
|
|
aToken, bToken := login(records[1][5], records[1][6]), login(records[2][5], records[2][6])
|
|
userA, err := db.UserByLogin(ctx, records[1][5])
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
userB, err := db.UserByLogin(ctx, records[2][5])
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
if userB.TenantID == nil || *userB.TenantID == *userA.TenantID {
|
|
t.Fatal("batch accounts share an identity")
|
|
}
|
|
if retry := submit(users); retry != batchID {
|
|
t.Fatal("same request duplicated the batch")
|
|
}
|
|
changed := users
|
|
changed.Rows = append([]batchRow(nil), users.Rows...)
|
|
changed.Rows[0].Name = "不同请求"
|
|
expect(call("POST", "/api/v1/admin/batches", changed, token), 409)
|
|
for _, endpoint := range []string{"/api/v1/admin/batches", path(batchID), path(batchID) + "/download"} {
|
|
expect(call("GET", endpoint, nil, aToken), 403)
|
|
}
|
|
expect(call("POST", "/api/v1/admin/batches", users, bToken), 403)
|
|
stored, err := db.AdminBatch(ctx, batchID, true)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
for _, item := range stored.Items {
|
|
if bytes.Contains(item.ResultCipher, []byte(records[1][6])) {
|
|
t.Fatal("plaintext password persisted")
|
|
}
|
|
}
|
|
plans, err := db.ListPlans(ctx)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
hostsInput := batchRequest{RequestKey: requestKey(), Operation: "create_hosts", Rows: []batchRow{{Name: "batch-host-a", TenantID: *userA.TenantID, NodeID: 1, PlanID: plans[0].ID, Runtime: "PHP", Version: "8.4", RunPath: "/public"}, {Name: "batch-host-independent", NodeID: 1, PlanID: plans[0].ID, Runtime: "PHP", Version: "8.4", RunPath: "/public"}}}
|
|
hostBatch := submit(hostsInput)
|
|
job = wait(hostBatch)
|
|
if job.Succeeded != 2 {
|
|
t.Fatalf("host batch: %+v", job)
|
|
}
|
|
hostRows := download(hostBatch)
|
|
var aHost, independent uint64
|
|
aHost, _ = strconv.ParseUint(hostRows[1][4], 10, 64)
|
|
independent, _ = strconv.ParseUint(hostRows[2][4], 10, 64)
|
|
hostToken := login(hostRows[1][5], hostRows[1][6])
|
|
independentToken := login(hostRows[2][5], hostRows[2][6])
|
|
resetBatch := submit(batchRequest{RequestKey: requestKey(), Operation: "host_password_reset", Rows: []batchRow{{HostID: independent}}})
|
|
if wait(resetBatch).Succeeded != 1 {
|
|
t.Fatal("administrator could not reset independent host login")
|
|
}
|
|
resetRows := download(resetBatch)
|
|
expect(call("GET", "/api/v1/me", nil, independentToken), 401)
|
|
independentToken = login(resetRows[1][5], resetRows[1][6])
|
|
dashboard := call("GET", "/api/v1/dashboard", nil, aToken)
|
|
expect(dashboard, 200)
|
|
var view struct {
|
|
Projects []store.Project `json:"projects"`
|
|
}
|
|
if err = json.Unmarshal(dashboard.Body.Bytes(), &view); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
if len(view.Projects) != 1 || view.Projects[0].ID != aHost {
|
|
t.Fatal("account view leaked independent host")
|
|
}
|
|
expect(call("GET", "/api/v1/resources", nil, aToken), 200)
|
|
expect(call("GET", "/api/v1/projects/"+strconv.FormatUint(aHost, 10)+"/credentials", nil, aToken), 200)
|
|
for _, session := range []string{aToken, bToken, hostToken} {
|
|
expect(call("GET", "/api/v1/projects/"+strconv.FormatUint(independent, 10)+"/credentials", nil, session), 404)
|
|
}
|
|
expect(call("GET", "/api/v1/projects/"+strconv.FormatUint(independent, 10)+"/credentials", nil, independentToken), 200)
|
|
independentUser, e := db.UserByLogin(ctx, hostRows[2][5])
|
|
if e != nil {
|
|
t.Fatal(e)
|
|
}
|
|
namespaceBefore := *independentUser.TenantID
|
|
bound := submit(batchRequest{RequestKey: requestKey(), Operation: "assign_hosts", Rows: []batchRow{{HostID: independent, TenantID: *userB.TenantID}}})
|
|
if wait(bound).Succeeded != 1 {
|
|
t.Fatal("initial optional binding failed")
|
|
}
|
|
expect(call("GET", "/api/v1/projects/"+strconv.FormatUint(independent, 10)+"/credentials", nil, bToken), 200)
|
|
expect(call("GET", "/api/v1/projects/"+strconv.FormatUint(independent, 10)+"/credentials", nil, aToken), 404)
|
|
independentUser, e = db.UserByLogin(ctx, hostRows[2][5])
|
|
if e != nil || *independentUser.TenantID != namespaceBefore || independentUser.TenantName != "批量用户乙" {
|
|
t.Fatal("initial binding changed resource identity or failed to update displayed owner")
|
|
}
|
|
stale := batchRequest{RequestKey: requestKey(), Operation: "assign_hosts", Rows: []batchRow{{HostID: independent, TenantID: *userB.TenantID, OwnershipVersion: 1}}}
|
|
expect(call("POST", "/api/v1/admin/batches", stale, token), 422)
|
|
expect(call("GET", "/api/v1/me", nil, independentToken), 401)
|
|
independentToken = login(resetRows[1][5], resetRows[1][6])
|
|
started := submit(batchRequest{RequestKey: requestKey(), Operation: "host_start", Rows: []batchRow{{HostID: independent}}})
|
|
if wait(started).Succeeded != 1 {
|
|
t.Fatal("cannot start bound host")
|
|
}
|
|
keepRunning := false
|
|
transferred := submit(batchRequest{RequestKey: requestKey(), Operation: "assign_hosts", Rows: []batchRow{{HostID: independent, TenantID: *userA.TenantID, CredentialMode: "preserve", StopServices: &keepRunning}}})
|
|
if wait(transferred).Succeeded != 1 {
|
|
t.Fatal("preserve credentials transfer failed")
|
|
}
|
|
expect(call("GET", "/api/v1/projects/"+strconv.FormatUint(independent, 10)+"/credentials", nil, bToken), 404)
|
|
expect(call("GET", "/api/v1/projects/"+strconv.FormatUint(independent, 10)+"/credentials", nil, aToken), 200)
|
|
expect(call("GET", "/api/v1/me", nil, independentToken), 401)
|
|
independentToken = login(resetRows[1][5], resetRows[1][6])
|
|
current, e := db.Project(ctx, namespaceBefore, independent)
|
|
if e != nil || current.Status != "running" {
|
|
t.Fatal("keep-running transfer stopped the website")
|
|
}
|
|
native.mu.Lock()
|
|
native.failDatabase = true
|
|
native.mu.Unlock()
|
|
interrupted := submit(batchRequest{RequestKey: requestKey(), Operation: "assign_hosts", Rows: []batchRow{{HostID: independent, CredentialMode: "reset"}}})
|
|
if wait(interrupted).Failed != 1 {
|
|
t.Fatal("injected native failure did not stop transfer")
|
|
}
|
|
pending, e := db.OwnershipChange(ctx, independent)
|
|
if e != nil || pending.State != "pending" || len(pending.CredentialsCipher) == 0 {
|
|
t.Fatal("failed transition not staged for recovery")
|
|
}
|
|
expect(call("GET", "/api/v1/projects/"+strconv.FormatUint(independent, 10)+"/credentials", nil, aToken), 423)
|
|
expect(call("GET", "/api/v1/me", nil, independentToken), 401)
|
|
expect(call("POST", "/api/v1/admin/batches", batchRequest{RequestKey: requestKey(), Operation: "assign_hosts", Rows: []batchRow{{HostID: independent, CredentialMode: "preserve", ResumeOwnership: true}}}, token), 422)
|
|
recoveredBatch := submit(batchRequest{RequestKey: requestKey(), Operation: "assign_hosts", Rows: []batchRow{{HostID: independent, CredentialMode: "reset", ResumeOwnership: true}}})
|
|
if wait(recoveredBatch).Succeeded != 1 {
|
|
t.Fatal("explicit ownership recovery failed")
|
|
}
|
|
native.mu.Lock()
|
|
sameStagedPassword := len(native.ftpPasswords) == 2 && native.ftpPasswords[0] == native.ftpPasswords[1]
|
|
native.mu.Unlock()
|
|
if !sameStagedPassword {
|
|
t.Fatal("recovery generated different native credentials")
|
|
}
|
|
rotated := download(recoveredBatch)
|
|
if rotated[1][6] == "" || rotated[1][9] == "" || rotated[1][12] == "" {
|
|
t.Fatal("reset result missing credentials")
|
|
}
|
|
expect(call("POST", "/api/v1/auth/login", map[string]string{"identifier": resetRows[1][5], "password": resetRows[1][6]}, ""), 401)
|
|
independentToken = login(rotated[1][5], rotated[1][6])
|
|
expect(call("GET", "/api/v1/projects/"+strconv.FormatUint(independent, 10)+"/credentials", nil, independentToken), 200)
|
|
current, e = db.Project(ctx, namespaceBefore, independent)
|
|
if e != nil || current.Status != "stopped" {
|
|
t.Fatal("default ownership stop was not applied")
|
|
}
|
|
pending, e = db.OwnershipChange(ctx, independent)
|
|
if e != nil || pending.State != "completed" || len(pending.CredentialsCipher) != 0 || pending.TargetOwnerID != nil {
|
|
t.Fatal("completed unbind retained staged secrets or owner")
|
|
}
|
|
filePath := "/api/v1/projects/" + strconv.FormatUint(aHost, 10) + "/files"
|
|
expect(call("PUT", filePath, map[string]any{"path": "../must-not-write", "content": "ignored"}, aToken), 400)
|
|
for _, session := range []string{aToken, hostToken} {
|
|
response := call("GET", "/api/v1/activities?projectId="+strconv.FormatUint(aHost, 10), nil, session)
|
|
expect(response, 200)
|
|
var logs struct {
|
|
Activities []store.Activity `json:"activities"`
|
|
}
|
|
if e = json.Unmarshal(response.Body.Bytes(), &logs); e != nil {
|
|
t.Fatal(e)
|
|
}
|
|
found := false
|
|
for _, event := range logs.Activities {
|
|
if event.Actor == "管理员" {
|
|
t.Fatal("administrator batch event leaked to customer logs")
|
|
}
|
|
if event.ResourceType == "file" && event.ProjectID != nil && *event.ProjectID == aHost {
|
|
found = true
|
|
}
|
|
}
|
|
if !found {
|
|
t.Fatal("resource namespace detached customer host logs")
|
|
}
|
|
}
|
|
expect(call("GET", "/api/v1/activities?projectId="+strconv.FormatUint(aHost, 10), nil, bToken), 404)
|
|
summaries, err := db.ListTenants(ctx)
|
|
if err != nil || len(summaries) != 2 {
|
|
t.Fatalf("resource namespaces leaked into user list: %d %v", len(summaries), err)
|
|
}
|
|
expiry := time.Now().Add(time.Hour)
|
|
sub := submit(batchRequest{RequestKey: requestKey(), Operation: "host_subscription", Rows: []batchRow{{HostID: aHost, PlanID: plans[0].ID, SetExpiry: true, ExpiresAt: &expiry}}})
|
|
if wait(sub).Succeeded != 1 {
|
|
t.Fatal("subscription batch failed")
|
|
}
|
|
disabled := submit(batchRequest{RequestKey: requestKey(), Operation: "user_disable", Rows: []batchRow{{AccountID: *userA.TenantID}}})
|
|
if wait(disabled).Succeeded != 1 {
|
|
t.Fatal("disable batch failed")
|
|
}
|
|
expect(call("GET", "/api/v1/me", nil, aToken), 401)
|
|
expect(call("GET", "/api/v1/me", nil, hostToken), 200)
|
|
enabled := submit(batchRequest{RequestKey: requestKey(), Operation: "user_enable", Rows: []batchRow{{Account: records[1][5]}}})
|
|
if wait(enabled).Succeeded != 1 {
|
|
t.Fatal("enable disabled account by JSON email failed")
|
|
}
|
|
aToken = login(records[1][5], records[1][6])
|
|
expect(call("GET", "/api/v1/dashboard", nil, aToken), 200)
|
|
for _, operation := range []string{"host_stop", "host_start"} {
|
|
id := submit(batchRequest{RequestKey: requestKey(), Operation: operation, Rows: []batchRow{{HostID: aHost}}})
|
|
if wait(id).Succeeded != 1 {
|
|
t.Fatalf("%s batch failed", operation)
|
|
}
|
|
}
|
|
stopWorker()
|
|
cancelInput := batchRequest{RequestKey: requestKey(), Operation: "create_users", Rows: []batchRow{{Slug: "batch-cancelled", Name: "应取消用户", Email: "cancelled@example.invalid", DisplayName: "应取消用户"}}}
|
|
cancelled := submit(cancelInput)
|
|
expect(call("POST", path(cancelled)+"/cancel", map[string]string{}, token), 204)
|
|
if job, e := db.AdminBatch(ctx, cancelled, false); e != nil || job.Pending != 0 || job.Failed != 1 {
|
|
t.Fatal("cancel did not stop pending row")
|
|
}
|
|
recoveryInput := cancelInput
|
|
recoveryInput.RequestKey = requestKey()
|
|
recoverID := submit(recoveryInput)
|
|
_, item, err := db.NextAdminBatchItem(ctx)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
if err = db.RecoverAdminBatches(ctx); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
if err = db.RefreshAdminBatches(ctx); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
recovered, err := db.AdminBatch(ctx, recoverID, false)
|
|
if err != nil || recovered.Uncertain != 1 || recovered.Pending != 0 || recovered.Items[0].ID != item.ID {
|
|
t.Fatal("restart did not preserve uncertain state")
|
|
}
|
|
if _, err = db.UserByLogin(ctx, "cancelled@example.invalid"); err == nil {
|
|
t.Fatal("cancelled/uncertain operation executed")
|
|
}
|
|
t.Log("real MySQL batch queue, random credentials, idempotency, JSON access, optional owners, account aggregation, enable/disable, subscription, start/stop, cancellation and restart uncertainty passed")
|
|
}
|