/cmd/bd: final tests
This commit is contained in:
parent
529586be2a
commit
65d4c95496
13 changed files with 614 additions and 370 deletions
|
|
@ -197,11 +197,13 @@ func readDoltLogCountSince(t *testing.T, db *sql.DB, sinceHash string) int {
|
|||
}
|
||||
|
||||
func TestProxiedServerClose(t *testing.T) {
|
||||
requireProxiedServerEnv(t)
|
||||
requireSharedProxiedServer(t)
|
||||
t.Parallel()
|
||||
bd := buildEmbeddedBD(t)
|
||||
|
||||
t.Run("basic_close", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "cb")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "cb")
|
||||
issue := bdProxiedCreate(t, bd, p.dir, "Close me")
|
||||
bdProxiedClose(t, bd, p.dir, issue.ID)
|
||||
got := bdProxiedShow(t, bd, p.dir, issue.ID)
|
||||
|
|
@ -214,7 +216,8 @@ func TestProxiedServerClose(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("close_default_reason", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "cdr")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "cdr")
|
||||
issue := bdProxiedCreate(t, bd, p.dir, "Default reason")
|
||||
bdProxiedClose(t, bd, p.dir, issue.ID)
|
||||
db := openProxiedDB(t, p)
|
||||
|
|
@ -224,7 +227,8 @@ func TestProxiedServerClose(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("close_with_reason", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "cwr")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "cwr")
|
||||
issue := bdProxiedCreate(t, bd, p.dir, "Reason test")
|
||||
bdProxiedClose(t, bd, p.dir, issue.ID, "--reason", "done")
|
||||
db := openProxiedDB(t, p)
|
||||
|
|
@ -234,7 +238,8 @@ func TestProxiedServerClose(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("close_with_reason_short", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "cwrs")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "cwrs")
|
||||
issue := bdProxiedCreate(t, bd, p.dir, "Short reason")
|
||||
bdProxiedClose(t, bd, p.dir, issue.ID, "-r", "fixed")
|
||||
db := openProxiedDB(t, p)
|
||||
|
|
@ -244,7 +249,8 @@ func TestProxiedServerClose(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("close_with_message_alias", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "cwma")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "cwma")
|
||||
issue := bdProxiedCreate(t, bd, p.dir, "Message alias")
|
||||
bdProxiedClose(t, bd, p.dir, issue.ID, "-m", "via message")
|
||||
db := openProxiedDB(t, p)
|
||||
|
|
@ -254,7 +260,8 @@ func TestProxiedServerClose(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("close_with_resolution_alias", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "cwra")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "cwra")
|
||||
issue := bdProxiedCreate(t, bd, p.dir, "Resolution alias")
|
||||
bdProxiedClose(t, bd, p.dir, issue.ID, "--resolution", "wontfix")
|
||||
db := openProxiedDB(t, p)
|
||||
|
|
@ -264,7 +271,8 @@ func TestProxiedServerClose(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("close_with_comment_alias", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "cwca")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "cwca")
|
||||
issue := bdProxiedCreate(t, bd, p.dir, "Comment alias")
|
||||
bdProxiedClose(t, bd, p.dir, issue.ID, "--comment", "duplicate")
|
||||
db := openProxiedDB(t, p)
|
||||
|
|
@ -274,7 +282,8 @@ func TestProxiedServerClose(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("close_multiple_ids", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "cmi")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "cmi")
|
||||
a := bdProxiedCreate(t, bd, p.dir, "Multi A")
|
||||
b := bdProxiedCreate(t, bd, p.dir, "Multi B")
|
||||
bdProxiedClose(t, bd, p.dir, a.ID, b.ID)
|
||||
|
|
@ -288,7 +297,8 @@ func TestProxiedServerClose(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("close_multiple_ids_with_per_id_reasons", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "cmpr")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "cmpr")
|
||||
a := bdProxiedCreate(t, bd, p.dir, "Multi reason A")
|
||||
b := bdProxiedCreate(t, bd, p.dir, "Multi reason B")
|
||||
bdProxiedClose(t, bd, p.dir, a.ID, "--reason", "fixed A", b.ID, "--reason", "fixed B")
|
||||
|
|
@ -302,7 +312,8 @@ func TestProxiedServerClose(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("close_already_closed", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "cac")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "cac")
|
||||
issue := bdProxiedCreate(t, bd, p.dir, "Double close")
|
||||
bdProxiedClose(t, bd, p.dir, issue.ID, "--reason", "first")
|
||||
stdout, stderr, err := bdProxiedRunBuffers(t, bd, p.dir, "close", issue.ID, "--reason", "second")
|
||||
|
|
@ -316,7 +327,8 @@ func TestProxiedServerClose(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("close_nonexistent_id", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "cni")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "cni")
|
||||
out := bdProxiedCloseFail(t, bd, p.dir, "cni-does-not-exist")
|
||||
if !strings.Contains(out, "not found") {
|
||||
t.Errorf("expected 'not found' error, got: %s", out)
|
||||
|
|
@ -324,7 +336,8 @@ func TestProxiedServerClose(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("close_blocked_refuses_without_force", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "cbr")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "cbr")
|
||||
blocker := bdProxiedCreate(t, bd, p.dir, "Blocker")
|
||||
blocked := bdProxiedCreate(t, bd, p.dir, "Blocked", "--deps", "depends-on:"+blocker.ID)
|
||||
out := bdProxiedCloseFail(t, bd, p.dir, blocked.ID)
|
||||
|
|
@ -338,7 +351,8 @@ func TestProxiedServerClose(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("close_blocked_with_force", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "cbf")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "cbf")
|
||||
blocker := bdProxiedCreate(t, bd, p.dir, "Blocker force")
|
||||
blocked := bdProxiedCreate(t, bd, p.dir, "Blocked force", "--deps", "depends-on:"+blocker.ID)
|
||||
bdProxiedClose(t, bd, p.dir, blocked.ID, "--force")
|
||||
|
|
@ -349,7 +363,8 @@ func TestProxiedServerClose(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("close_pinned_refuses_without_force", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "cpr")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "cpr")
|
||||
issue := bdProxiedCreate(t, bd, p.dir, "Pinned")
|
||||
bdProxiedUpdateOne(t, bd, p.dir, issue.ID, "-s", "pinned")
|
||||
bdProxiedCloseFail(t, bd, p.dir, issue.ID)
|
||||
|
|
@ -360,7 +375,8 @@ func TestProxiedServerClose(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("close_pinned_with_force", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "cpf")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "cpf")
|
||||
issue := bdProxiedCreate(t, bd, p.dir, "Pinned force")
|
||||
bdProxiedUpdateOne(t, bd, p.dir, issue.ID, "-s", "pinned")
|
||||
bdProxiedClose(t, bd, p.dir, issue.ID, "--force")
|
||||
|
|
@ -371,7 +387,8 @@ func TestProxiedServerClose(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("close_epic_open_children_refuses", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "ceor")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "ceor")
|
||||
epic := bdProxiedCreate(t, bd, p.dir, "Epic", "-t", "epic")
|
||||
_ = bdProxiedCreate(t, bd, p.dir, "Child", "--parent", epic.ID)
|
||||
out := bdProxiedCloseFail(t, bd, p.dir, epic.ID)
|
||||
|
|
@ -381,7 +398,8 @@ func TestProxiedServerClose(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("close_epic_open_children_force", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "ceof")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "ceof")
|
||||
epic := bdProxiedCreate(t, bd, p.dir, "Epic force", "-t", "epic")
|
||||
_ = bdProxiedCreate(t, bd, p.dir, "Child force", "--parent", epic.ID)
|
||||
bdProxiedClose(t, bd, p.dir, epic.ID, "--force")
|
||||
|
|
@ -392,7 +410,8 @@ func TestProxiedServerClose(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("close_last_child_keeps_regular_epic_open", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "clce")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "clce")
|
||||
epic := bdProxiedCreate(t, bd, p.dir, "Regular epic", "-t", "epic")
|
||||
child := bdProxiedCreate(t, bd, p.dir, "Last child", "--parent", epic.ID)
|
||||
bdProxiedClose(t, bd, p.dir, child.ID)
|
||||
|
|
@ -403,7 +422,8 @@ func TestProxiedServerClose(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("close_unblocks_dependent", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "cud")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "cud")
|
||||
blocker := bdProxiedCreate(t, bd, p.dir, "Unblock blocker")
|
||||
blocked := bdProxiedCreate(t, bd, p.dir, "Unblock blocked", "--deps", "depends-on:"+blocker.ID)
|
||||
db := openProxiedDB(t, p)
|
||||
|
|
@ -417,7 +437,8 @@ func TestProxiedServerClose(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("close_suggest_next", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "csn")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "csn")
|
||||
blocker := bdProxiedCreate(t, bd, p.dir, "Suggest blocker")
|
||||
blocked := bdProxiedCreate(t, bd, p.dir, "Suggest blocked", "--deps", "depends-on:"+blocker.ID)
|
||||
out := bdProxiedClose(t, bd, p.dir, blocker.ID, "--suggest-next")
|
||||
|
|
@ -427,7 +448,8 @@ func TestProxiedServerClose(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("close_suggest_next_json", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "csnj")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "csnj")
|
||||
blocker := bdProxiedCreate(t, bd, p.dir, "Suggest JSON blocker")
|
||||
blocked := bdProxiedCreate(t, bd, p.dir, "Suggest JSON blocked", "--deps", "depends-on:"+blocker.ID)
|
||||
env := bdProxiedCloseJSONEnvelope(t, bd, p.dir, blocker.ID, "--suggest-next")
|
||||
|
|
@ -445,7 +467,8 @@ func TestProxiedServerClose(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("close_claim_next", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "ccn")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "ccn")
|
||||
toClose := bdProxiedCreate(t, bd, p.dir, "Claim next close")
|
||||
nextIssue := bdProxiedCreate(t, bd, p.dir, "Claim next target")
|
||||
bdProxiedClose(t, bd, p.dir, toClose.ID, "--claim-next")
|
||||
|
|
@ -459,7 +482,8 @@ func TestProxiedServerClose(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("close_claim_next_no_ready", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "ccnr")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "ccnr")
|
||||
issue := bdProxiedCreate(t, bd, p.dir, "Only issue")
|
||||
out := bdProxiedClose(t, bd, p.dir, issue.ID, "--claim-next")
|
||||
if !strings.Contains(out, "No ready issues") {
|
||||
|
|
@ -468,7 +492,8 @@ func TestProxiedServerClose(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("close_claim_next_json", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "ccnj")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "ccnj")
|
||||
toClose := bdProxiedCreate(t, bd, p.dir, "Claim JSON close")
|
||||
_ = bdProxiedCreate(t, bd, p.dir, "Claim JSON target")
|
||||
env := bdProxiedCloseJSONEnvelope(t, bd, p.dir, toClose.ID, "--claim-next")
|
||||
|
|
@ -481,7 +506,8 @@ func TestProxiedServerClose(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("close_with_session", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "cws")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "cws")
|
||||
issue := bdProxiedCreate(t, bd, p.dir, "Session flag")
|
||||
bdProxiedClose(t, bd, p.dir, issue.ID, "--session", "sess-456")
|
||||
db := openProxiedDB(t, p)
|
||||
|
|
@ -491,10 +517,12 @@ func TestProxiedServerClose(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("close_session_from_env", func(t *testing.T) {
|
||||
t.Setenv("CLAUDE_SESSION_ID", "sess-env")
|
||||
p := bdProxiedInit(t, bd, "cse")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "cse")
|
||||
issue := bdProxiedCreate(t, bd, p.dir, "Session env")
|
||||
bdProxiedClose(t, bd, p.dir, issue.ID)
|
||||
if _, stderr, err := bdProxiedRunEnv(t, bd, p.dir, []string{"CLAUDE_SESSION_ID=sess-env"}, "close", issue.ID); err != nil {
|
||||
t.Fatalf("close failed: %v\n%s", err, stderr)
|
||||
}
|
||||
db := openProxiedDB(t, p)
|
||||
if got := readClosedBySession(t, db, issue.ID); got != "sess-env" {
|
||||
t.Errorf("closed_by_session: got %q, want %q", got, "sess-env")
|
||||
|
|
@ -502,7 +530,8 @@ func TestProxiedServerClose(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("close_json_output", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "cjo")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "cjo")
|
||||
issue := bdProxiedCreate(t, bd, p.dir, "JSON close")
|
||||
issues := bdProxiedCloseJSON(t, bd, p.dir, issue.ID)
|
||||
if len(issues) != 1 || issues[0].ID != issue.ID {
|
||||
|
|
@ -514,7 +543,8 @@ func TestProxiedServerClose(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("done_alias", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "da")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "da")
|
||||
issue := bdProxiedCreate(t, bd, p.dir, "Done alias")
|
||||
stdout, stderr, err := bdProxiedRunBuffers(t, bd, p.dir, "done", issue.ID)
|
||||
if err != nil {
|
||||
|
|
@ -527,7 +557,8 @@ func TestProxiedServerClose(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("done_positional_reason", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "dpr")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "dpr")
|
||||
issue := bdProxiedCreate(t, bd, p.dir, "Done reason")
|
||||
stdout, stderr, err := bdProxiedRunBuffers(t, bd, p.dir, "done", issue.ID, "the reason")
|
||||
if err != nil {
|
||||
|
|
@ -540,7 +571,8 @@ func TestProxiedServerClose(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("close_continue_multiple_ids_fails", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "ccmi")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "ccmi")
|
||||
a := bdProxiedCreate(t, bd, p.dir, "Continue multi A")
|
||||
b := bdProxiedCreate(t, bd, p.dir, "Continue multi B")
|
||||
out := bdProxiedCloseFail(t, bd, p.dir, a.ID, b.ID, "--continue")
|
||||
|
|
@ -550,7 +582,8 @@ func TestProxiedServerClose(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("close_suggest_next_multiple_ids_fails", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "csmi")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "csmi")
|
||||
a := bdProxiedCreate(t, bd, p.dir, "Suggest multi A")
|
||||
b := bdProxiedCreate(t, bd, p.dir, "Suggest multi B")
|
||||
out := bdProxiedCloseFail(t, bd, p.dir, a.ID, b.ID, "--suggest-next")
|
||||
|
|
@ -560,7 +593,8 @@ func TestProxiedServerClose(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("single_transaction_dolt_commit", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "stdc")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "stdc")
|
||||
a := bdProxiedCreate(t, bd, p.dir, "Tx A")
|
||||
b := bdProxiedCreate(t, bd, p.dir, "Tx B")
|
||||
c := bdProxiedCreate(t, bd, p.dir, "Tx C")
|
||||
|
|
@ -583,7 +617,8 @@ func TestProxiedServerClose(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("no_ids_errors", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "nie")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "nie")
|
||||
out := bdProxiedCloseFail(t, bd, p.dir)
|
||||
if !strings.Contains(out, "no issue ID provided") {
|
||||
t.Errorf("expected 'no issue ID provided', got: %s", out)
|
||||
|
|
@ -591,7 +626,8 @@ func TestProxiedServerClose(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("last_touched_not_supported", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "ltns")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "ltns")
|
||||
_ = bdProxiedCreate(t, bd, p.dir, "Recent create")
|
||||
out := bdProxiedCloseFail(t, bd, p.dir)
|
||||
if !strings.Contains(out, "no issue ID provided") {
|
||||
|
|
@ -600,7 +636,8 @@ func TestProxiedServerClose(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("close_wisp_issue", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "cwi")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "cwi")
|
||||
wisp := bdProxiedCreate(t, bd, p.dir, "Wisp close", "--ephemeral")
|
||||
bdProxiedClose(t, bd, p.dir, wisp.ID)
|
||||
db := openProxiedDB(t, p)
|
||||
|
|
@ -615,7 +652,8 @@ func TestProxiedServerClose(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("close_wisp_epic_open_children", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "cweoc")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "cweoc")
|
||||
wispEpic := bdProxiedCreate(t, bd, p.dir, "Wisp epic", "-t", "epic", "--ephemeral")
|
||||
_ = bdProxiedCreate(t, bd, p.dir, "Wisp child", "--ephemeral", "--parent", wispEpic.ID)
|
||||
out := bdProxiedCloseFail(t, bd, p.dir, wispEpic.ID)
|
||||
|
|
@ -625,7 +663,8 @@ func TestProxiedServerClose(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("close_wisp_blocked_refuses", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "cwbr")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "cwbr")
|
||||
blocker := bdProxiedCreate(t, bd, p.dir, "Blocker for wisp")
|
||||
wisp := bdProxiedCreate(t, bd, p.dir, "Blocked wisp", "--ephemeral", "--deps", "depends-on:"+blocker.ID)
|
||||
out := bdProxiedCloseFail(t, bd, p.dir, wisp.ID)
|
||||
|
|
@ -635,7 +674,8 @@ func TestProxiedServerClose(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("continue_advances_to_next_ready_step", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "cantrs")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "cantrs")
|
||||
root := bdProxiedCreate(t, bd, p.dir, "Molecule root", "-t", "epic", "--labels", "template")
|
||||
step1 := bdProxiedCreate(t, bd, p.dir, "Step 1", "--parent", root.ID)
|
||||
step2 := bdProxiedCreate(t, bd, p.dir, "Step 2", "--parent", root.ID, "--deps", "depends-on:"+step1.ID)
|
||||
|
|
@ -651,7 +691,8 @@ func TestProxiedServerClose(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("continue_no_auto_does_not_claim", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "cnac")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "cnac")
|
||||
root := bdProxiedCreate(t, bd, p.dir, "Molecule root", "-t", "epic", "--labels", "template")
|
||||
step1 := bdProxiedCreate(t, bd, p.dir, "Step 1", "--parent", root.ID)
|
||||
step2 := bdProxiedCreate(t, bd, p.dir, "Step 2", "--parent", root.ID, "--deps", "depends-on:"+step1.ID)
|
||||
|
|
@ -666,7 +707,8 @@ func TestProxiedServerClose(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("auto_close_completed_molecule", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "accm")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "accm")
|
||||
root := bdProxiedCreate(t, bd, p.dir, "Molecule root", "-t", "epic", "--labels", "template")
|
||||
s1 := bdProxiedCreate(t, bd, p.dir, "Step 1", "--parent", root.ID)
|
||||
s2 := bdProxiedCreate(t, bd, p.dir, "Step 2", "--parent", root.ID)
|
||||
|
|
@ -681,12 +723,13 @@ func TestProxiedServerClose(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("hooks_fire_on_close", func(t *testing.T) {
|
||||
t.Parallel()
|
||||
marker := filepath.Join(t.TempDir(), "on_close_marker")
|
||||
script := "#!/bin/sh\nprintf '%s\\n' \"$1\" > " + shellQuote(marker) + "\n"
|
||||
if runtime.GOOS == "windows" {
|
||||
t.Skip("hook script form is POSIX shell")
|
||||
}
|
||||
p := bdProxiedInitWithHooks(t, bd, "hfc", map[string]string{"on_close": script})
|
||||
p := newSharedProxiedProjectWithHooks(t, bd, "hfc", map[string]string{"on_close": script})
|
||||
issue := bdProxiedCreate(t, bd, p.dir, "Hook fire")
|
||||
bdProxiedClose(t, bd, p.dir, issue.ID)
|
||||
data, err := os.ReadFile(marker)
|
||||
|
|
@ -704,10 +747,11 @@ func shellQuote(s string) string {
|
|||
}
|
||||
|
||||
func TestProxiedServerCloseConcurrent(t *testing.T) {
|
||||
requireProxiedServerEnv(t)
|
||||
requireSharedProxiedServer(t)
|
||||
t.Parallel()
|
||||
bd := buildEmbeddedBD(t)
|
||||
|
||||
p := bdProxiedInit(t, bd, "cxc")
|
||||
p := newSharedProxiedProject(t, bd, "cxc")
|
||||
|
||||
const (
|
||||
numWorkers = 10
|
||||
|
|
|
|||
|
|
@ -81,11 +81,13 @@ func proxiedDoltCommitCountSince(t *testing.T, db *sql.DB, sinceHash string) int
|
|||
}
|
||||
|
||||
func TestProxiedServerConfig(t *testing.T) {
|
||||
requireProxiedServerEnv(t)
|
||||
requireSharedProxiedServer(t)
|
||||
t.Parallel()
|
||||
bd := buildEmbeddedBD(t)
|
||||
|
||||
t.Run("config_set_and_get", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "pcs")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "pcs")
|
||||
bdProxiedConfig(t, bd, p.dir, "set", "test.key1", "hello")
|
||||
out := bdProxiedConfig(t, bd, p.dir, "get", "test.key1")
|
||||
if !strings.Contains(out, "hello") {
|
||||
|
|
@ -94,7 +96,8 @@ func TestProxiedServerConfig(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("config_set_overwrite", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "pco")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "pco")
|
||||
bdProxiedConfig(t, bd, p.dir, "set", "test.overwrite", "first")
|
||||
bdProxiedConfig(t, bd, p.dir, "set", "test.overwrite", "second")
|
||||
out := bdProxiedConfig(t, bd, p.dir, "get", "test.overwrite")
|
||||
|
|
@ -104,7 +107,8 @@ func TestProxiedServerConfig(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("config_set_namespaced", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "pcn")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "pcn")
|
||||
bdProxiedConfig(t, bd, p.dir, "set", "jira.url", "https://example.atlassian.net")
|
||||
out := bdProxiedConfig(t, bd, p.dir, "get", "jira.url")
|
||||
if !strings.Contains(out, "https://example.atlassian.net") {
|
||||
|
|
@ -113,7 +117,8 @@ func TestProxiedServerConfig(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("config_set_and_get_linear_state_map_dotted_key", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "pcd")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "pcd")
|
||||
bdProxiedConfig(t, bd, p.dir, "set", "linear.state_map.closed", "Done")
|
||||
out := bdProxiedConfig(t, bd, p.dir, "get", "linear.state_map.closed")
|
||||
if strings.TrimSpace(out) != "Done" {
|
||||
|
|
@ -122,7 +127,8 @@ func TestProxiedServerConfig(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("config_list", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "pcl")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "pcl")
|
||||
out := bdProxiedConfig(t, bd, p.dir, "list")
|
||||
if !strings.Contains(out, "issue_prefix") {
|
||||
t.Errorf("expected issue_prefix in list output: %s", out)
|
||||
|
|
@ -130,7 +136,8 @@ func TestProxiedServerConfig(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("config_list_json", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "pcj")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "pcj")
|
||||
bdProxiedConfig(t, bd, p.dir, "set", "test.key1", "hello")
|
||||
m := bdProxiedConfigListJSON(t, bd, p.dir)
|
||||
if _, ok := m["issue_prefix"]; !ok {
|
||||
|
|
@ -142,7 +149,8 @@ func TestProxiedServerConfig(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("config_unset", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "pcu")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "pcu")
|
||||
bdProxiedConfig(t, bd, p.dir, "set", "test.removeme", "temp")
|
||||
out := bdProxiedConfig(t, bd, p.dir, "get", "test.removeme")
|
||||
if !strings.Contains(out, "temp") {
|
||||
|
|
@ -160,7 +168,8 @@ func TestProxiedServerConfig(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("config_get_missing_key", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "pcm")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "pcm")
|
||||
out := bdProxiedConfig(t, bd, p.dir, "get", "nonexistent.key.xyz")
|
||||
if !strings.Contains(out, "not set") {
|
||||
t.Errorf("expected 'not set' for missing key: %s", out)
|
||||
|
|
@ -168,17 +177,20 @@ func TestProxiedServerConfig(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("config_set_no_args", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "pcsna")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "pcsna")
|
||||
bdProxiedConfigFail(t, bd, p.dir, "set")
|
||||
})
|
||||
|
||||
t.Run("config_unset_no_args", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "pcuna")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "pcuna")
|
||||
bdProxiedConfigFail(t, bd, p.dir, "unset")
|
||||
})
|
||||
|
||||
t.Run("config_set_creates_dolt_commit", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "pcsc")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "pcsc")
|
||||
db := openProxiedDB(t, p)
|
||||
before := proxiedDoltHead(t, db)
|
||||
|
||||
|
|
@ -191,7 +203,8 @@ func TestProxiedServerConfig(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("config_unset_creates_dolt_commit", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "pcuc")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "pcuc")
|
||||
bdProxiedConfig(t, bd, p.dir, "set", "test.commit", "v1")
|
||||
|
||||
db := openProxiedDB(t, p)
|
||||
|
|
@ -206,7 +219,8 @@ func TestProxiedServerConfig(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("config_yaml_only_key_skips_dolt_commit", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "pcy")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "pcy")
|
||||
db := openProxiedDB(t, p)
|
||||
before := proxiedDoltHead(t, db)
|
||||
|
||||
|
|
@ -240,7 +254,8 @@ func TestProxiedServerConfig(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("config_beads_role_skips_dolt_commit", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "pcr")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "pcr")
|
||||
db := openProxiedDB(t, p)
|
||||
before := proxiedDoltHead(t, db)
|
||||
|
||||
|
|
@ -271,11 +286,13 @@ func TestProxiedServerConfig(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestProxiedServerConfigSetMany(t *testing.T) {
|
||||
requireProxiedServerEnv(t)
|
||||
requireSharedProxiedServer(t)
|
||||
t.Parallel()
|
||||
bd := buildEmbeddedBD(t)
|
||||
|
||||
t.Run("set_many_single_dolt_commit", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "pcsm")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "pcsm")
|
||||
db := openProxiedDB(t, p)
|
||||
before := proxiedDoltHead(t, db)
|
||||
|
||||
|
|
@ -296,7 +313,8 @@ func TestProxiedServerConfigSetMany(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("set_many_cli_round_trip", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "pcsmr")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "pcsmr")
|
||||
bdProxiedConfig(t, bd, p.dir, "set-many",
|
||||
"jira.url=https://example.atlassian.net",
|
||||
"jira.project=PROJ",
|
||||
|
|
@ -325,10 +343,11 @@ func TestProxiedServerConfigSetMany(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestProxiedServerConfigConcurrent(t *testing.T) {
|
||||
requireProxiedServerEnv(t)
|
||||
requireSharedProxiedServer(t)
|
||||
t.Parallel()
|
||||
bd := buildEmbeddedBD(t)
|
||||
|
||||
p := bdProxiedInit(t, bd, "pcc")
|
||||
p := newSharedProxiedProject(t, bd, "pcc")
|
||||
|
||||
const numWorkers = 8
|
||||
|
||||
|
|
|
|||
|
|
@ -14,11 +14,13 @@ import (
|
|||
)
|
||||
|
||||
func TestProxiedServerDelete(t *testing.T) {
|
||||
requireProxiedServerEnv(t)
|
||||
requireSharedProxiedServer(t)
|
||||
t.Parallel()
|
||||
bd := buildEmbeddedBD(t)
|
||||
|
||||
t.Run("delete_single_issue", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "dsi")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "dsi")
|
||||
issue := bdProxiedCreate(t, bd, p.dir, "Delete me", "-t", "task")
|
||||
bdProxiedDelete(t, bd, p.dir, issue.ID, "--force")
|
||||
db := openProxiedDB(t, p)
|
||||
|
|
@ -26,7 +28,8 @@ func TestProxiedServerDelete(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("delete_without_force_shows_preview", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "dwf")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "dwf")
|
||||
issue := bdProxiedCreate(t, bd, p.dir, "Preview only", "-t", "task")
|
||||
|
||||
out := bdProxiedDelete(t, bd, p.dir, issue.ID)
|
||||
|
|
@ -39,7 +42,8 @@ func TestProxiedServerDelete(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("delete_clears_aux_tables", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "dcat")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "dcat")
|
||||
neighbor := bdProxiedCreate(t, bd, p.dir, "Neighbor", "-t", "task")
|
||||
issue := bdProxiedCreate(t, bd, p.dir, "Aux cleanup", "-t", "task",
|
||||
"--label", "alpha",
|
||||
|
|
@ -74,7 +78,8 @@ func TestProxiedServerDelete(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("delete_json_returns_result_shape", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "djs")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "djs")
|
||||
issue := bdProxiedCreate(t, bd, p.dir, "JSON shape", "-t", "task")
|
||||
|
||||
got := bdProxiedDeleteJSON(t, bd, p.dir, "--json", issue.ID, "--force")
|
||||
|
|
@ -97,7 +102,8 @@ func TestProxiedServerDelete(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("delete_leaf_clears_outbound_dep_rows", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "dlc")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "dlc")
|
||||
a := bdProxiedCreate(t, bd, p.dir, "Survivor A", "-t", "task")
|
||||
b := bdProxiedCreate(t, bd, p.dir, "Will be deleted", "-t", "task",
|
||||
"--deps", "depends-on:"+a.ID)
|
||||
|
|
@ -120,7 +126,8 @@ func TestProxiedServerDelete(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("delete_creates_dolt_commit", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "ddc")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "ddc")
|
||||
issue := bdProxiedCreate(t, bd, p.dir, "Dolt commit test", "-t", "task")
|
||||
|
||||
db := openProxiedDB(t, p)
|
||||
|
|
@ -144,7 +151,8 @@ func TestProxiedServerDelete(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("delete_bulk_no_resurrection", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "dbr")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "dbr")
|
||||
|
||||
const total = 20
|
||||
const toDelete = 10
|
||||
|
|
@ -177,7 +185,8 @@ func TestProxiedServerDelete(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("delete_nonexistent", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "dne")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "dne")
|
||||
out := bdProxiedDeleteFail(t, bd, p.dir, "dne-doesnotexist", "--force")
|
||||
if !strings.Contains(strings.ToLower(out), "not found") &&
|
||||
!strings.Contains(strings.ToLower(out), "error") {
|
||||
|
|
@ -186,7 +195,8 @@ func TestProxiedServerDelete(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("delete_batch", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "dbt")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "dbt")
|
||||
a := bdProxiedCreate(t, bd, p.dir, "Batch 1", "-t", "task")
|
||||
b := bdProxiedCreate(t, bd, p.dir, "Batch 2", "-t", "task")
|
||||
c := bdProxiedCreate(t, bd, p.dir, "Batch 3", "-t", "task")
|
||||
|
|
@ -200,7 +210,8 @@ func TestProxiedServerDelete(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("delete_force_cascades_dependents", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "dfc")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "dfc")
|
||||
parent := bdProxiedCreate(t, bd, p.dir, "Force parent", "-t", "task")
|
||||
child := bdProxiedCreate(t, bd, p.dir, "Force child", "-t", "task",
|
||||
"--deps", "depends-on:"+parent.ID)
|
||||
|
|
@ -213,7 +224,8 @@ func TestProxiedServerDelete(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("delete_cleans_up_dependencies", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "dcd")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "dcd")
|
||||
parent := bdProxiedCreate(t, bd, p.dir, "Parent", "-t", "task")
|
||||
child := bdProxiedCreate(t, bd, p.dir, "Child", "-t", "task",
|
||||
"--deps", "depends-on:"+parent.ID)
|
||||
|
|
@ -235,7 +247,8 @@ func TestProxiedServerDelete(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("delete_always_cascades_dependents", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "dac")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "dac")
|
||||
parent := bdProxiedCreate(t, bd, p.dir, "Parent", "-t", "epic")
|
||||
child := bdProxiedCreate(t, bd, p.dir, "Child", "-t", "task",
|
||||
"--parent", parent.ID)
|
||||
|
|
@ -248,7 +261,8 @@ func TestProxiedServerDelete(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("delete_cascade_spans_all_dep_types", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "dcs")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "dcs")
|
||||
a := bdProxiedCreate(t, bd, p.dir, "A", "-t", "task")
|
||||
b := bdProxiedCreate(t, bd, p.dir, "B", "-t", "task",
|
||||
"--deps", "depends-on:"+a.ID)
|
||||
|
|
@ -264,7 +278,8 @@ func TestProxiedServerDelete(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("delete_json_counts_match_cascade", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "djc")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "djc")
|
||||
a := bdProxiedCreate(t, bd, p.dir, "Chain A", "-t", "task")
|
||||
b := bdProxiedCreate(t, bd, p.dir, "Chain B", "-t", "task",
|
||||
"--deps", "depends-on:"+a.ID)
|
||||
|
|
@ -288,7 +303,8 @@ func TestProxiedServerDelete(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("delete_dry_run_does_not_mutate", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "ddr")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "ddr")
|
||||
issue := bdProxiedCreate(t, bd, p.dir, "Dry run target", "-t", "task")
|
||||
|
||||
got := bdProxiedDeleteJSON(t, bd, p.dir, "--json", issue.ID, "--dry-run")
|
||||
|
|
@ -301,7 +317,8 @@ func TestProxiedServerDelete(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("delete_preview_lists_not_found", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "dpn")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "dpn")
|
||||
issue := bdProxiedCreate(t, bd, p.dir, "Preview NotFound", "-t", "task")
|
||||
|
||||
out := bdProxiedDeleteFail(t, bd, p.dir, issue.ID, "dpn-bogus")
|
||||
|
|
@ -317,7 +334,8 @@ func TestProxiedServerDelete(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("delete_preview_lists_connected", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "dpc")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "dpc")
|
||||
neighbor := bdProxiedCreate(t, bd, p.dir, "Preview neighbor", "-t", "task")
|
||||
target := bdProxiedCreate(t, bd, p.dir, "Preview target", "-t", "task",
|
||||
"--deps", "depends-on:"+neighbor.ID)
|
||||
|
|
@ -345,7 +363,8 @@ func TestProxiedServerDelete(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("delete_rewrites_text_references", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "drt")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "drt")
|
||||
neighbor := bdProxiedCreate(t, bd, p.dir, "Rewrite neighbor", "-t", "task")
|
||||
target := bdProxiedCreate(t, bd, p.dir, "Rewrite target", "-t", "task",
|
||||
"--deps", "depends-on:"+neighbor.ID)
|
||||
|
|
@ -369,7 +388,8 @@ func TestProxiedServerDelete(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("delete_references_updated_count_reported", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "dru")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "dru")
|
||||
neighbor := bdProxiedCreate(t, bd, p.dir, "Refs neighbor", "-t", "task")
|
||||
target := bdProxiedCreate(t, bd, p.dir, "Refs target", "-t", "task",
|
||||
"--deps", "depends-on:"+neighbor.ID)
|
||||
|
|
@ -387,7 +407,8 @@ func TestProxiedServerDelete(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("delete_zero_aux_rows_after", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "dza")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "dza")
|
||||
outbound := bdProxiedCreate(t, bd, p.dir, "Outbound dependee", "-t", "task")
|
||||
issue := bdProxiedCreate(t, bd, p.dir, "Zero aux target", "-t", "task",
|
||||
"--label", "alpha",
|
||||
|
|
@ -426,7 +447,8 @@ func TestProxiedServerDelete(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("delete_from_file", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "dff")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "dff")
|
||||
a := bdProxiedCreate(t, bd, p.dir, "From-file 1", "-t", "task")
|
||||
b := bdProxiedCreate(t, bd, p.dir, "From-file 2", "-t", "task")
|
||||
c := bdProxiedCreate(t, bd, p.dir, "From-file 3", "-t", "task")
|
||||
|
|
@ -446,7 +468,8 @@ func TestProxiedServerDelete(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("delete_cascade_flag_is_error", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "dcn")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "dcn")
|
||||
issue := bdProxiedCreate(t, bd, p.dir, "Cascade flag", "-t", "task")
|
||||
|
||||
out := bdProxiedDeleteFail(t, bd, p.dir, issue.ID, "--force", "--cascade")
|
||||
|
|
@ -460,11 +483,13 @@ func TestProxiedServerDelete(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestProxiedServerDeleteWisp(t *testing.T) {
|
||||
requireProxiedServerEnv(t)
|
||||
requireSharedProxiedServer(t)
|
||||
t.Parallel()
|
||||
bd := buildEmbeddedBD(t)
|
||||
|
||||
t.Run("delete_mixed_wisp_and_issue_partition", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "dmp")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "dmp")
|
||||
issue := bdProxiedCreate(t, bd, p.dir, "Regular target", "-t", "task")
|
||||
wisp := bdProxiedCreate(t, bd, p.dir, "Wisp target", "--ephemeral")
|
||||
|
||||
|
|
@ -479,7 +504,8 @@ func TestProxiedServerDeleteWisp(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("delete_wisp_clears_wisp_aux_tables", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "dwc")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "dwc")
|
||||
a := bdProxiedCreate(t, bd, p.dir, "Wisp aux A", "--ephemeral")
|
||||
_ = bdProxiedCreate(t, bd, p.dir, "Wisp aux B", "--ephemeral",
|
||||
"--deps", "depends-on:"+a.ID)
|
||||
|
|
@ -514,7 +540,8 @@ func TestProxiedServerDeleteWisp(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("delete_wisp_routes_to_wisps_table", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "dwr")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "dwr")
|
||||
wisp := bdProxiedCreate(t, bd, p.dir, "Wisp delete routing", "--ephemeral")
|
||||
|
||||
db := openProxiedDB(t, p)
|
||||
|
|
@ -535,7 +562,8 @@ func TestProxiedServerDeleteWisp(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("delete_wisp_batch", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "dwb")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "dwb")
|
||||
a := bdProxiedCreate(t, bd, p.dir, "Wisp batch 1", "--ephemeral")
|
||||
b := bdProxiedCreate(t, bd, p.dir, "Wisp batch 2", "--ephemeral")
|
||||
c := bdProxiedCreate(t, bd, p.dir, "Wisp batch 3", "--ephemeral")
|
||||
|
|
@ -549,7 +577,8 @@ func TestProxiedServerDeleteWisp(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("delete_wisp_cascades_dependents", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "dwc")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "dwc")
|
||||
parent := bdProxiedCreate(t, bd, p.dir, "Wisp parent", "--ephemeral")
|
||||
child := bdProxiedCreate(t, bd, p.dir, "Wisp child", "--ephemeral",
|
||||
"--deps", "depends-on:"+parent.ID)
|
||||
|
|
@ -562,7 +591,8 @@ func TestProxiedServerDeleteWisp(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("delete_wisp_cascade_spans_all_dep_types", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "dws")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "dws")
|
||||
a := bdProxiedCreate(t, bd, p.dir, "Wisp A", "--ephemeral")
|
||||
b := bdProxiedCreate(t, bd, p.dir, "Wisp B", "--ephemeral",
|
||||
"--deps", "depends-on:"+a.ID)
|
||||
|
|
@ -578,7 +608,8 @@ func TestProxiedServerDeleteWisp(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("delete_wisp_skips_dolt_commit", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "dwdc")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "dwdc")
|
||||
wisp := bdProxiedCreate(t, bd, p.dir, "Wisp commit skip", "--ephemeral")
|
||||
|
||||
db := openProxiedDB(t, p)
|
||||
|
|
@ -602,7 +633,8 @@ func TestProxiedServerDeleteWisp(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("delete_wisp_dry_run_does_not_mutate", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "dwdr")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "dwdr")
|
||||
wisp := bdProxiedCreate(t, bd, p.dir, "Wisp dry-run target", "--ephemeral")
|
||||
|
||||
got := bdProxiedDeleteJSON(t, bd, p.dir, "--json", wisp.ID, "--dry-run")
|
||||
|
|
@ -615,7 +647,8 @@ func TestProxiedServerDeleteWisp(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("delete_wisp_rewrites_text_references", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "dwrt")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "dwrt")
|
||||
neighbor := bdProxiedCreate(t, bd, p.dir, "Wisp neighbor", "--ephemeral")
|
||||
target := bdProxiedCreate(t, bd, p.dir, "Wisp target", "--ephemeral",
|
||||
"--deps", "depends-on:"+neighbor.ID)
|
||||
|
|
@ -639,7 +672,8 @@ func TestProxiedServerDeleteWisp(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("delete_wisp_nonexistent", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "dwn")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "dwn")
|
||||
out := bdProxiedDeleteFail(t, bd, p.dir, "dwn-doesnotexist", "--force")
|
||||
if !strings.Contains(strings.ToLower(out), "not found") {
|
||||
t.Errorf("expected `not found` error for bogus wisp id, got: %s", out)
|
||||
|
|
@ -648,10 +682,11 @@ func TestProxiedServerDeleteWisp(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestProxiedServerDeleteConcurrent(t *testing.T) {
|
||||
requireProxiedServerEnv(t)
|
||||
requireSharedProxiedServer(t)
|
||||
t.Parallel()
|
||||
bd := buildEmbeddedBD(t)
|
||||
|
||||
p := bdProxiedInit(t, bd, "ddc")
|
||||
p := newSharedProxiedProject(t, bd, "ddc")
|
||||
issue := bdProxiedCreate(t, bd, p.dir, "Concurrent delete contest", "-t", "task")
|
||||
|
||||
const n = 5
|
||||
|
|
|
|||
|
|
@ -121,12 +121,15 @@ func bdProxiedDepWithInputFail(t *testing.T, bd, dir, input string, args ...stri
|
|||
}
|
||||
|
||||
func TestProxiedServerDep(t *testing.T) {
|
||||
requireProxiedServerEnv(t)
|
||||
requireSharedProxiedServer(t)
|
||||
t.Parallel()
|
||||
bd := buildEmbeddedBD(t)
|
||||
|
||||
t.Run("Blocks", func(t *testing.T) {
|
||||
t.Parallel()
|
||||
t.Run("happy_path", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "dpb1")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "dpb1")
|
||||
a := bdProxiedCreate(t, bd, p.dir, "Block A", "--type", "task")
|
||||
b := bdProxiedCreate(t, bd, p.dir, "Block B", "--type", "task")
|
||||
out := bdProxiedDep(t, bd, p.dir, a.ID, "--blocks", b.ID)
|
||||
|
|
@ -137,8 +140,10 @@ func TestProxiedServerDep(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("Add", func(t *testing.T) {
|
||||
t.Parallel()
|
||||
t.Run("positional_args", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "dpa1")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "dpa1")
|
||||
a := bdProxiedCreate(t, bd, p.dir, "Pos A", "--type", "task")
|
||||
b := bdProxiedCreate(t, bd, p.dir, "Pos B", "--type", "task")
|
||||
out := bdProxiedDep(t, bd, p.dir, "add", a.ID, b.ID)
|
||||
|
|
@ -148,7 +153,8 @@ func TestProxiedServerDep(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("type_parent_child", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "dpa2")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "dpa2")
|
||||
epic := bdProxiedCreate(t, bd, p.dir, "Epic", "--type", "epic")
|
||||
c1 := bdProxiedCreate(t, bd, p.dir, "Child 1", "--type", "task")
|
||||
c2 := bdProxiedCreate(t, bd, p.dir, "Child 2", "--type", "task")
|
||||
|
|
@ -161,7 +167,8 @@ func TestProxiedServerDep(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("type_tracks", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "dpa3")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "dpa3")
|
||||
tracker := bdProxiedCreate(t, bd, p.dir, "Tracker", "--type", "task")
|
||||
tracked := bdProxiedCreate(t, bd, p.dir, "Tracked", "--type", "task")
|
||||
bdProxiedDep(t, bd, p.dir, "add", tracker.ID, tracked.ID, "--type", "tracks")
|
||||
|
|
@ -172,7 +179,8 @@ func TestProxiedServerDep(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("type_related", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "dpa4")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "dpa4")
|
||||
r1 := bdProxiedCreate(t, bd, p.dir, "Related 1", "--type", "task")
|
||||
r2 := bdProxiedCreate(t, bd, p.dir, "Related 2", "--type", "task")
|
||||
out := bdProxiedDep(t, bd, p.dir, "add", r1.ID, r2.ID, "--type", "related")
|
||||
|
|
@ -182,7 +190,8 @@ func TestProxiedServerDep(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("blocked_by_flag", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "dpa5")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "dpa5")
|
||||
x := bdProxiedCreate(t, bd, p.dir, "Blocked", "--type", "task")
|
||||
y := bdProxiedCreate(t, bd, p.dir, "Blocker", "--type", "task")
|
||||
bdProxiedDep(t, bd, p.dir, "add", x.ID, "--blocked-by", y.ID)
|
||||
|
|
@ -193,7 +202,8 @@ func TestProxiedServerDep(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("depends_on_flag", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "dpa6")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "dpa6")
|
||||
x := bdProxiedCreate(t, bd, p.dir, "Dependent", "--type", "task")
|
||||
y := bdProxiedCreate(t, bd, p.dir, "Dependency", "--type", "task")
|
||||
bdProxiedDep(t, bd, p.dir, "add", x.ID, "--depends-on", y.ID)
|
||||
|
|
@ -204,7 +214,8 @@ func TestProxiedServerDep(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("cycle_rejected", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "dpa7")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "dpa7")
|
||||
a := bdProxiedCreate(t, bd, p.dir, "Cyc A", "--type", "task")
|
||||
b := bdProxiedCreate(t, bd, p.dir, "Cyc B", "--type", "task")
|
||||
bdProxiedDep(t, bd, p.dir, "add", a.ID, b.ID)
|
||||
|
|
@ -215,7 +226,8 @@ func TestProxiedServerDep(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("child_parent_antipattern", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "dpa8")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "dpa8")
|
||||
parent := bdProxiedCreate(t, bd, p.dir, "AP Parent", "--type", "epic")
|
||||
child := bdProxiedCreate(t, bd, p.dir, "AP Child", "--type", "task", "--parent", parent.ID)
|
||||
out := bdProxiedDepFail(t, bd, p.dir, "add", child.ID, parent.ID)
|
||||
|
|
@ -225,7 +237,8 @@ func TestProxiedServerDep(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("json_output", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "dpa9")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "dpa9")
|
||||
j1 := bdProxiedCreate(t, bd, p.dir, "JSON A", "--type", "task")
|
||||
j2 := bdProxiedCreate(t, bd, p.dir, "JSON B", "--type", "task")
|
||||
m := bdProxiedDepJSON(t, bd, p.dir, "add", j1.ID, j2.ID)
|
||||
|
|
@ -238,7 +251,8 @@ func TestProxiedServerDep(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("bulk_file_jsonl", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "dpa10")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "dpa10")
|
||||
b1 := bdProxiedCreate(t, bd, p.dir, "Bulk A", "--type", "task")
|
||||
b2 := bdProxiedCreate(t, bd, p.dir, "Bulk B", "--type", "task")
|
||||
b3 := bdProxiedCreate(t, bd, p.dir, "Bulk C", "--type", "task")
|
||||
|
|
@ -263,7 +277,8 @@ func TestProxiedServerDep(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("bulk_file_validation_atomic", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "dpa11")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "dpa11")
|
||||
v1 := bdProxiedCreate(t, bd, p.dir, "Valid A", "--type", "task")
|
||||
v2 := bdProxiedCreate(t, bd, p.dir, "Valid B", "--type", "task")
|
||||
path := filepath.Join(t.TempDir(), "bad-deps.jsonl")
|
||||
|
|
@ -283,7 +298,8 @@ func TestProxiedServerDep(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("no_cycle_check_chain", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "dpa12")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "dpa12")
|
||||
const n = 10
|
||||
ids := make([]string, n)
|
||||
for i := 0; i < n; i++ {
|
||||
|
|
@ -305,7 +321,8 @@ func TestProxiedServerDep(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("bulk_no_cycle_check_whole_graph_gate", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "dpa13")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "dpa13")
|
||||
a := bdProxiedCreate(t, bd, p.dir, "Gate A", "--type", "task")
|
||||
b := bdProxiedCreate(t, bd, p.dir, "Gate B", "--type", "task")
|
||||
c := bdProxiedCreate(t, bd, p.dir, "Gate C", "--type", "task")
|
||||
|
|
@ -330,7 +347,8 @@ func TestProxiedServerDep(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("commit_visible_to_subsequent_invocation", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "dpa14")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "dpa14")
|
||||
a := bdProxiedCreate(t, bd, p.dir, "Commit A", "--type", "task")
|
||||
b := bdProxiedCreate(t, bd, p.dir, "Commit B", "--type", "task")
|
||||
bdProxiedDep(t, bd, p.dir, "add", a.ID, b.ID)
|
||||
|
|
@ -341,7 +359,8 @@ func TestProxiedServerDep(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("bulk_external_ref_passthrough", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "dpa15")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "dpa15")
|
||||
src := bdProxiedCreate(t, bd, p.dir, "Ext src", "--type", "task")
|
||||
input := fmt.Sprintf("{\"from\":%q,\"to\":\"external:other:capability\"}\n", src.ID)
|
||||
cmd := exec.Command(bd, "dep", "add", "--file", "-")
|
||||
|
|
@ -362,8 +381,10 @@ func TestProxiedServerDep(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("Remove", func(t *testing.T) {
|
||||
t.Parallel()
|
||||
t.Run("basic", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "dpr1")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "dpr1")
|
||||
a := bdProxiedCreate(t, bd, p.dir, "Rm A", "--type", "task")
|
||||
b := bdProxiedCreate(t, bd, p.dir, "Rm B", "--type", "task")
|
||||
bdProxiedDep(t, bd, p.dir, "add", a.ID, b.ID)
|
||||
|
|
@ -374,7 +395,8 @@ func TestProxiedServerDep(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("rm_alias", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "dpr2")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "dpr2")
|
||||
a := bdProxiedCreate(t, bd, p.dir, "Rm A", "--type", "task")
|
||||
b := bdProxiedCreate(t, bd, p.dir, "Rm B", "--type", "task")
|
||||
bdProxiedDep(t, bd, p.dir, "add", a.ID, b.ID)
|
||||
|
|
@ -385,7 +407,8 @@ func TestProxiedServerDep(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("json_output", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "dpr3")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "dpr3")
|
||||
a := bdProxiedCreate(t, bd, p.dir, "Rm JSON A", "--type", "task")
|
||||
b := bdProxiedCreate(t, bd, p.dir, "Rm JSON B", "--type", "task")
|
||||
bdProxiedDep(t, bd, p.dir, "add", a.ID, b.ID)
|
||||
|
|
@ -397,8 +420,10 @@ func TestProxiedServerDep(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("List", func(t *testing.T) {
|
||||
t.Parallel()
|
||||
t.Run("default_direction_down", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "dpl1")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "dpl1")
|
||||
a := bdProxiedCreate(t, bd, p.dir, "L A", "--type", "task")
|
||||
b := bdProxiedCreate(t, bd, p.dir, "L B", "--type", "task")
|
||||
bdProxiedDep(t, bd, p.dir, "add", a.ID, b.ID)
|
||||
|
|
@ -409,7 +434,8 @@ func TestProxiedServerDep(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("direction_up", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "dpl2")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "dpl2")
|
||||
a := bdProxiedCreate(t, bd, p.dir, "Up A", "--type", "task")
|
||||
b := bdProxiedCreate(t, bd, p.dir, "Up B", "--type", "task")
|
||||
bdProxiedDep(t, bd, p.dir, "add", a.ID, b.ID)
|
||||
|
|
@ -420,7 +446,8 @@ func TestProxiedServerDep(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("type_filter", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "dpl3")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "dpl3")
|
||||
epic := bdProxiedCreate(t, bd, p.dir, "TF epic", "--type", "epic")
|
||||
c1 := bdProxiedCreate(t, bd, p.dir, "TF c1", "--type", "task")
|
||||
c2 := bdProxiedCreate(t, bd, p.dir, "TF c2", "--type", "task")
|
||||
|
|
@ -433,7 +460,8 @@ func TestProxiedServerDep(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("json_output", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "dpl4")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "dpl4")
|
||||
a := bdProxiedCreate(t, bd, p.dir, "LJ A", "--type", "task")
|
||||
b := bdProxiedCreate(t, bd, p.dir, "LJ B", "--type", "task")
|
||||
bdProxiedDep(t, bd, p.dir, "add", a.ID, b.ID)
|
||||
|
|
@ -448,7 +476,8 @@ func TestProxiedServerDep(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("batch_multi_arg", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "dpl5")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "dpl5")
|
||||
a := bdProxiedCreate(t, bd, p.dir, "B A", "--type", "task")
|
||||
b := bdProxiedCreate(t, bd, p.dir, "B B", "--type", "task")
|
||||
c := bdProxiedCreate(t, bd, p.dir, "B C", "--type", "task")
|
||||
|
|
@ -466,7 +495,8 @@ func TestProxiedServerDep(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("batch_partitions_wisp_and_issue_ids", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "dpl6")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "dpl6")
|
||||
issueSrc := bdProxiedCreate(t, bd, p.dir, "WP issue src", "--type", "task")
|
||||
issueTgt := bdProxiedCreate(t, bd, p.dir, "WP issue tgt", "--type", "task")
|
||||
bdProxiedDep(t, bd, p.dir, "add", issueSrc.ID, issueTgt.ID)
|
||||
|
|
@ -497,8 +527,10 @@ func TestProxiedServerDep(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("Tree", func(t *testing.T) {
|
||||
t.Parallel()
|
||||
t.Run("basic", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "dpt1")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "dpt1")
|
||||
root := bdProxiedCreate(t, bd, p.dir, "Tree root", "--type", "task")
|
||||
child := bdProxiedCreate(t, bd, p.dir, "Tree child", "--type", "task")
|
||||
bdProxiedDep(t, bd, p.dir, "add", root.ID, child.ID)
|
||||
|
|
@ -509,7 +541,8 @@ func TestProxiedServerDep(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("direction_up", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "dpt2")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "dpt2")
|
||||
root := bdProxiedCreate(t, bd, p.dir, "Up tree root", "--type", "task")
|
||||
dep := bdProxiedCreate(t, bd, p.dir, "Up tree dep", "--type", "task")
|
||||
bdProxiedDep(t, bd, p.dir, "add", root.ID, dep.ID)
|
||||
|
|
@ -520,7 +553,8 @@ func TestProxiedServerDep(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("direction_both", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "dpt3")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "dpt3")
|
||||
root := bdProxiedCreate(t, bd, p.dir, "Both root", "--type", "task")
|
||||
dep := bdProxiedCreate(t, bd, p.dir, "Both dep", "--type", "task")
|
||||
bdProxiedDep(t, bd, p.dir, "add", root.ID, dep.ID)
|
||||
|
|
@ -531,7 +565,8 @@ func TestProxiedServerDep(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("both_does_not_duplicate_root", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "dpt4")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "dpt4")
|
||||
root := bdProxiedCreate(t, bd, p.dir, "Dedup root", "--type", "task")
|
||||
depDown := bdProxiedCreate(t, bd, p.dir, "Dedup down", "--type", "task")
|
||||
depUp := bdProxiedCreate(t, bd, p.dir, "Dedup up", "--type", "task")
|
||||
|
|
@ -554,7 +589,8 @@ func TestProxiedServerDep(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("max_depth", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "dpt5")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "dpt5")
|
||||
a := bdProxiedCreate(t, bd, p.dir, "MD A", "--type", "task")
|
||||
b := bdProxiedCreate(t, bd, p.dir, "MD B", "--type", "task")
|
||||
c := bdProxiedCreate(t, bd, p.dir, "MD C", "--type", "task")
|
||||
|
|
@ -567,7 +603,8 @@ func TestProxiedServerDep(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("status_filter", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "dpt6")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "dpt6")
|
||||
root := bdProxiedCreate(t, bd, p.dir, "SF root", "--type", "task")
|
||||
dep := bdProxiedCreate(t, bd, p.dir, "SF dep", "--type", "task")
|
||||
bdProxiedDep(t, bd, p.dir, "add", root.ID, dep.ID)
|
||||
|
|
@ -575,7 +612,8 @@ func TestProxiedServerDep(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("format_mermaid", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "dpt7")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "dpt7")
|
||||
root := bdProxiedCreate(t, bd, p.dir, "Mer root", "--type", "task")
|
||||
dep := bdProxiedCreate(t, bd, p.dir, "Mer dep", "--type", "task")
|
||||
bdProxiedDep(t, bd, p.dir, "add", root.ID, dep.ID)
|
||||
|
|
@ -586,7 +624,8 @@ func TestProxiedServerDep(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("json_output", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "dpt8")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "dpt8")
|
||||
root := bdProxiedCreate(t, bd, p.dir, "JT root", "--type", "task")
|
||||
dep := bdProxiedCreate(t, bd, p.dir, "JT dep", "--type", "task")
|
||||
bdProxiedDep(t, bd, p.dir, "add", root.ID, dep.ID)
|
||||
|
|
@ -598,7 +637,8 @@ func TestProxiedServerDep(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("ignores_relates_to", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "dpt9")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "dpt9")
|
||||
root := bdProxiedCreate(t, bd, p.dir, "Rel root", "--type", "task")
|
||||
blocker := bdProxiedCreate(t, bd, p.dir, "Real blocker", "--type", "task")
|
||||
related := bdProxiedCreate(t, bd, p.dir, "Loose relation", "--type", "task")
|
||||
|
|
@ -627,8 +667,10 @@ func TestProxiedServerDep(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("Cycles", func(t *testing.T) {
|
||||
t.Parallel()
|
||||
t.Run("detect", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "dpc1")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "dpc1")
|
||||
a := bdProxiedCreate(t, bd, p.dir, "C A", "--type", "task")
|
||||
b := bdProxiedCreate(t, bd, p.dir, "C B", "--type", "task")
|
||||
bdProxiedDep(t, bd, p.dir, "add", a.ID, b.ID)
|
||||
|
|
@ -647,7 +689,8 @@ func TestProxiedServerDep(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("none", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "dpc2")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "dpc2")
|
||||
a := bdProxiedCreate(t, bd, p.dir, "NC A", "--type", "task")
|
||||
b := bdProxiedCreate(t, bd, p.dir, "NC B", "--type", "task")
|
||||
bdProxiedDep(t, bd, p.dir, "add", a.ID, b.ID)
|
||||
|
|
@ -660,9 +703,10 @@ func TestProxiedServerDep(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestProxiedServerDepConcurrent(t *testing.T) {
|
||||
requireProxiedServerEnv(t)
|
||||
requireSharedProxiedServer(t)
|
||||
t.Parallel()
|
||||
bd := buildEmbeddedBD(t)
|
||||
p := bdProxiedInit(t, bd, "dpcon")
|
||||
p := newSharedProxiedProject(t, bd, "dpcon")
|
||||
|
||||
var ids []string
|
||||
for i := 0; i < 16; i++ {
|
||||
|
|
|
|||
|
|
@ -24,11 +24,13 @@ func bdProxiedRunEnv(t *testing.T, bd, dir string, extraEnv []string, args ...st
|
|||
}
|
||||
|
||||
func TestProxiedServerAssign(t *testing.T) {
|
||||
requireProxiedServerEnv(t)
|
||||
requireSharedProxiedServer(t)
|
||||
t.Parallel()
|
||||
bd := buildEmbeddedBD(t)
|
||||
|
||||
t.Run("assign_then_unassign", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "as")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "as")
|
||||
issue := bdProxiedCreate(t, bd, p.dir, "Assign target")
|
||||
|
||||
out, stderr, err := bdProxiedRunBuffers(t, bd, p.dir, "assign", issue.ID, "alice")
|
||||
|
|
@ -55,7 +57,8 @@ func TestProxiedServerAssign(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("assign_missing_issue_fails", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "am")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "am")
|
||||
_, _, err := bdProxiedRunBuffers(t, bd, p.dir, "assign", "as-nope99", "alice")
|
||||
if err == nil {
|
||||
t.Error("expected assign of missing issue to fail")
|
||||
|
|
@ -64,10 +67,11 @@ func TestProxiedServerAssign(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestProxiedServerPriority(t *testing.T) {
|
||||
requireProxiedServerEnv(t)
|
||||
requireSharedProxiedServer(t)
|
||||
t.Parallel()
|
||||
bd := buildEmbeddedBD(t)
|
||||
|
||||
p := bdProxiedInit(t, bd, "pr")
|
||||
p := newSharedProxiedProject(t, bd, "pr")
|
||||
issue := bdProxiedCreate(t, bd, p.dir, "Priority target", "--priority", "3")
|
||||
|
||||
out, stderr, err := bdProxiedRunBuffers(t, bd, p.dir, "priority", issue.ID, "0")
|
||||
|
|
@ -83,10 +87,11 @@ func TestProxiedServerPriority(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestProxiedServerNote(t *testing.T) {
|
||||
requireProxiedServerEnv(t)
|
||||
requireSharedProxiedServer(t)
|
||||
t.Parallel()
|
||||
bd := buildEmbeddedBD(t)
|
||||
|
||||
p := bdProxiedInit(t, bd, "nt")
|
||||
p := newSharedProxiedProject(t, bd, "nt")
|
||||
issue := bdProxiedCreate(t, bd, p.dir, "Note target")
|
||||
|
||||
if _, stderr, err := bdProxiedRunBuffers(t, bd, p.dir, "note", issue.ID, "first note"); err != nil {
|
||||
|
|
@ -106,11 +111,13 @@ func TestProxiedServerNote(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestProxiedServerTag(t *testing.T) {
|
||||
requireProxiedServerEnv(t)
|
||||
requireSharedProxiedServer(t)
|
||||
t.Parallel()
|
||||
bd := buildEmbeddedBD(t)
|
||||
|
||||
t.Run("tag_issue", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "tg")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "tg")
|
||||
issue := bdProxiedCreate(t, bd, p.dir, "Tag target")
|
||||
|
||||
out, stderr, err := bdProxiedRunBuffers(t, bd, p.dir, "tag", issue.ID, "needs-review")
|
||||
|
|
@ -129,7 +136,8 @@ func TestProxiedServerTag(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("tag_wisp_routes_to_wisp_labels", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "tw")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "tw")
|
||||
wisp := bdProxiedCreate(t, bd, p.dir, "Tag wisp", "--ephemeral")
|
||||
|
||||
if _, _, err := bdProxiedRunBuffers(t, bd, p.dir, "tag", wisp.ID, "wtag"); err != nil {
|
||||
|
|
@ -151,10 +159,11 @@ func TestProxiedServerTag(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestProxiedServerEdit(t *testing.T) {
|
||||
requireProxiedServerEnv(t)
|
||||
requireSharedProxiedServer(t)
|
||||
t.Parallel()
|
||||
bd := buildEmbeddedBD(t)
|
||||
|
||||
p := bdProxiedInit(t, bd, "ed")
|
||||
p := newSharedProxiedProject(t, bd, "ed")
|
||||
issue := bdProxiedCreate(t, bd, p.dir, "Edit target", "--description", "original body")
|
||||
|
||||
editorScript := filepath.Join(p.dir, "editor.sh")
|
||||
|
|
|
|||
|
|
@ -1,65 +0,0 @@
|
|||
//go:build cgo
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
"strings"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestProxiedSharedHarnessSerial(t *testing.T) {
|
||||
bd := buildEmbeddedBD(t)
|
||||
|
||||
for _, prefix := range []string{"aa", "bb", "cc"} {
|
||||
t.Run(prefix, func(t *testing.T) {
|
||||
p := newSharedProxiedProject(t, bd, prefix)
|
||||
|
||||
created := bdProxiedCreate(t, bd, p.dir, "Issue in "+prefix)
|
||||
if !strings.HasPrefix(created.ID, prefix+"-") {
|
||||
t.Fatalf("ID %q should have prefix %q-", created.ID, prefix)
|
||||
}
|
||||
|
||||
shown := bdProxiedShow(t, bd, p.dir, created.ID)
|
||||
if shown.Title != "Issue in "+prefix {
|
||||
t.Errorf("title: got %q, want %q", shown.Title, "Issue in "+prefix)
|
||||
}
|
||||
|
||||
listed := bdProxiedListJSON(t, bd, p)
|
||||
if len(listed) != 1 {
|
||||
t.Errorf("database %s should hold exactly 1 issue, got %d", p.database, len(listed))
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestProxiedSharedHarnessParallel(t *testing.T) {
|
||||
t.Parallel()
|
||||
bd := buildEmbeddedBD(t)
|
||||
|
||||
prefixes := []string{
|
||||
"pa", "pb", "pc", "pd", "pe", "pf",
|
||||
"pg", "ph", "pi", "pj", "pk", "pl",
|
||||
}
|
||||
for _, prefix := range prefixes {
|
||||
prefix := prefix
|
||||
t.Run(prefix, func(t *testing.T) {
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, prefix)
|
||||
|
||||
created := bdProxiedCreate(t, bd, p.dir, "Issue in "+prefix)
|
||||
if !strings.HasPrefix(created.ID, prefix+"-") {
|
||||
t.Fatalf("ID %q should have prefix %q-", created.ID, prefix)
|
||||
}
|
||||
|
||||
shown := bdProxiedShow(t, bd, p.dir, created.ID)
|
||||
if shown.Title != "Issue in "+prefix {
|
||||
t.Errorf("title: got %q, want %q", shown.Title, "Issue in "+prefix)
|
||||
}
|
||||
|
||||
listed := bdProxiedListJSON(t, bd, p)
|
||||
if len(listed) != 1 {
|
||||
t.Errorf("database %s should hold exactly 1 issue, got %d", p.database, len(listed))
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
@ -52,7 +52,7 @@ func uniqueProxiedDatabase() string {
|
|||
return fmt.Sprintf("bdtest_%d", sharedProxiedDBSeq.Add(1))
|
||||
}
|
||||
|
||||
func newSharedProxiedProject(t *testing.T, bd, prefix string, extraInitArgs ...string) proxiedProject {
|
||||
func sharedProxiedInitArgs(t *testing.T, extraInitArgs ...string) (string, []string) {
|
||||
t.Helper()
|
||||
port := requireSharedProxiedServer(t)
|
||||
|
||||
|
|
@ -62,8 +62,21 @@ func newSharedProxiedProject(t *testing.T, bd, prefix string, extraInitArgs ...s
|
|||
"--proxied-server-external-host", "127.0.0.1",
|
||||
"--proxied-server-external-port", strconv.Itoa(port),
|
||||
}, extraInitArgs...)
|
||||
return database, args
|
||||
}
|
||||
|
||||
func newSharedProxiedProject(t *testing.T, bd, prefix string, extraInitArgs ...string) proxiedProject {
|
||||
t.Helper()
|
||||
database, args := sharedProxiedInitArgs(t, extraInitArgs...)
|
||||
p := bdProxiedInit(t, bd, prefix, args...)
|
||||
p.database = database
|
||||
return p
|
||||
}
|
||||
|
||||
func newSharedProxiedProjectWithHooks(t *testing.T, bd, prefix string, hooks map[string]string, extraInitArgs ...string) proxiedProject {
|
||||
t.Helper()
|
||||
database, args := sharedProxiedInitArgs(t, extraInitArgs...)
|
||||
p := bdProxiedInitWithHooks(t, bd, prefix, hooks, args...)
|
||||
p.database = database
|
||||
return p
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,11 +8,13 @@ import (
|
|||
)
|
||||
|
||||
func TestProxiedServerQuick(t *testing.T) {
|
||||
requireProxiedServerEnv(t)
|
||||
requireSharedProxiedServer(t)
|
||||
t.Parallel()
|
||||
bd := buildEmbeddedBD(t)
|
||||
|
||||
t.Run("q_creates_and_outputs_id", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "qk")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "qk")
|
||||
stdout, stderr, err := bdProxiedRunBuffers(t, bd, p.dir, "q", "Quick captured task")
|
||||
if err != nil {
|
||||
t.Fatalf("q failed: %v\nstderr:\n%s", err, stderr)
|
||||
|
|
@ -28,7 +30,8 @@ func TestProxiedServerQuick(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("q_with_parent_creates_child", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "qp")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "qp")
|
||||
parent := bdProxiedCreate(t, bd, p.dir, "Quick parent", "--type", "epic")
|
||||
bdProxiedLabel(t, bd, p.dir, "add", parent.ID, "inherited")
|
||||
|
||||
|
|
@ -58,11 +61,13 @@ func TestProxiedServerQuick(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestProxiedServerTodo(t *testing.T) {
|
||||
requireProxiedServerEnv(t)
|
||||
requireSharedProxiedServer(t)
|
||||
t.Parallel()
|
||||
bd := buildEmbeddedBD(t)
|
||||
|
||||
t.Run("add_list_done", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "td")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "td")
|
||||
|
||||
stdout, stderr, err := bdProxiedRunBuffers(t, bd, p.dir, "todo", "add", "Write the tests")
|
||||
if err != nil {
|
||||
|
|
@ -82,7 +87,8 @@ func TestProxiedServerTodo(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("add_json_and_done", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "tj")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "tj")
|
||||
created := bdProxiedCreate(t, bd, p.dir, "Task to finish", "--type", "task")
|
||||
|
||||
out, stderr, err := bdProxiedRunBuffers(t, bd, p.dir, "todo", "done", created.ID)
|
||||
|
|
@ -98,7 +104,8 @@ func TestProxiedServerTodo(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("bare_todo_lists_open_tasks", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "tb")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "tb")
|
||||
open := bdProxiedCreate(t, bd, p.dir, "Open todo", "--type", "task")
|
||||
done := bdProxiedCreate(t, bd, p.dir, "Done todo", "--type", "task")
|
||||
if _, _, err := bdProxiedRunBuffers(t, bd, p.dir, "todo", "done", done.ID); err != nil {
|
||||
|
|
|
|||
|
|
@ -68,11 +68,13 @@ func bdProxiedReadyFail(t *testing.T, bd string, p proxiedProject, args ...strin
|
|||
}
|
||||
|
||||
func TestProxiedServerReady(t *testing.T) {
|
||||
requireProxiedServerEnv(t)
|
||||
requireSharedProxiedServer(t)
|
||||
t.Parallel()
|
||||
bd := buildEmbeddedBD(t)
|
||||
|
||||
t.Run("json_round_trips_issue_with_counts", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "rdj1")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "rdj1")
|
||||
issue := bdProxiedCreate(t, bd, p.dir, "Zero deps", "--label", "rdj1-only")
|
||||
ready := bdProxiedReadyJSON(t, bd, p, "--label", "rdj1-only")
|
||||
if len(ready) != 1 {
|
||||
|
|
@ -87,7 +89,8 @@ func TestProxiedServerReady(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("default_text_output", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "rdt")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "rdt")
|
||||
bdProxiedCreate(t, bd, p.dir, "Ready title here")
|
||||
stdout, _ := bdProxiedReadyCapture(t, bd, p)
|
||||
if !strings.Contains(stdout, "Ready title here") {
|
||||
|
|
@ -96,7 +99,8 @@ func TestProxiedServerReady(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("json_validity", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "rdv")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "rdv")
|
||||
bdProxiedCreate(t, bd, p.dir, "JSON test")
|
||||
stdout, _, err := bdProxiedRunBuffers(t, bd, p.dir, "ready", "--json")
|
||||
if err != nil {
|
||||
|
|
@ -113,7 +117,8 @@ func TestProxiedServerReady(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("limit_zero_returns_full_set_and_suppresses_hint", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "rdl0")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "rdl0")
|
||||
const n = 4
|
||||
want := make(map[string]bool, n)
|
||||
for i := 0; i < n; i++ {
|
||||
|
|
@ -152,7 +157,8 @@ func TestProxiedServerReady(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("limit_truncation_hint_on_stderr", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "rdl")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "rdl")
|
||||
for i := 0; i < 4; i++ {
|
||||
bdProxiedCreate(t, bd, p.dir, fmt.Sprintf("Ready item %d", i))
|
||||
}
|
||||
|
|
@ -174,7 +180,8 @@ func TestProxiedServerReady(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("offset_with_large_finite_limit", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "rdofflz")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "rdofflz")
|
||||
for i := 0; i < 4; i++ {
|
||||
bdProxiedCreate(t, bd, p.dir,
|
||||
fmt.Sprintf("Lz item %d", i), "--label", "rdofflz")
|
||||
|
|
@ -187,7 +194,8 @@ func TestProxiedServerReady(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("offset_zero_equals_no_offset", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "rdoff0")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "rdoff0")
|
||||
for i := 0; i < 3; i++ {
|
||||
bdProxiedCreate(t, bd, p.dir,
|
||||
fmt.Sprintf("Eq item %d", i), "--label", "rdoff0")
|
||||
|
|
@ -207,7 +215,8 @@ func TestProxiedServerReady(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("offset_combo_guards", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "rdoffg")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "rdoffg")
|
||||
bdProxiedCreate(t, bd, p.dir, "Seed")
|
||||
cases := []struct {
|
||||
name string
|
||||
|
|
@ -229,7 +238,8 @@ func TestProxiedServerReady(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("offset_skips_leading_results", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "rdoff")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "rdoff")
|
||||
ids := make([]string, 4)
|
||||
for i := 0; i < 4; i++ {
|
||||
issue := bdProxiedCreate(t, bd, p.dir,
|
||||
|
|
@ -254,7 +264,8 @@ func TestProxiedServerReady(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("claim_json_no_match_returns_empty_array", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "rcn")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "rcn")
|
||||
bdProxiedCreate(t, bd, p.dir, "Has wrong label", "--label", "real")
|
||||
out, err := bdProxiedRun(t, bd, p.dir, "ready", "--claim", "--json", "--label", "missing-label")
|
||||
if err != nil {
|
||||
|
|
@ -270,7 +281,8 @@ func TestProxiedServerReady(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("claim_json_marks_in_progress_and_assignee", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "rcm")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "rcm")
|
||||
issue := bdProxiedCreate(t, bd, p.dir, "Claim me", "--label", "claim-me")
|
||||
out, err := bdProxiedRun(t, bd, p.dir, "ready", "--claim", "--json", "--label", "claim-me")
|
||||
if err != nil {
|
||||
|
|
@ -302,7 +314,8 @@ func TestProxiedServerReady(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("blocked_issues_excluded_from_default_output", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "rdb")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "rdb")
|
||||
blocker := bdProxiedCreate(t, bd, p.dir, "Blocker issue")
|
||||
bdProxiedCreate(t, bd, p.dir, "Should be hidden because blocked", "--deps", "depends-on:"+blocker.ID)
|
||||
stdout, _ := bdProxiedReadyCapture(t, bd, p)
|
||||
|
|
@ -312,7 +325,8 @@ func TestProxiedServerReady(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("exclude_label_filter", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "rdex")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "rdex")
|
||||
bdProxiedCreate(t, bd, p.dir, "Triage pending item", "--label", "triage:pending")
|
||||
bdProxiedCreate(t, bd, p.dir, "Normal ready item")
|
||||
stdout, _ := bdProxiedReadyCapture(t, bd, p, "--exclude-label", "triage:pending")
|
||||
|
|
@ -325,7 +339,8 @@ func TestProxiedServerReady(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("explain_json_round_trip", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "rde")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "rde")
|
||||
bdProxiedCreate(t, bd, p.dir, "Plain ready")
|
||||
blocker := bdProxiedCreate(t, bd, p.dir, "Live blocker")
|
||||
bdProxiedCreate(t, bd, p.dir, "Blocked dependent", "--deps", "depends-on:"+blocker.ID)
|
||||
|
|
@ -351,7 +366,8 @@ func TestProxiedServerReady(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("explain_text_header", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "rdet")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "rdet")
|
||||
bdProxiedCreate(t, bd, p.dir, "Smoke")
|
||||
stdout, _, err := bdProxiedRunBuffers(t, bd, p.dir, "ready", "--explain")
|
||||
if err != nil {
|
||||
|
|
@ -363,7 +379,8 @@ func TestProxiedServerReady(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("explain_detects_cycles", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "rdc")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "rdc")
|
||||
a := bdProxiedCreate(t, bd, p.dir, "Cycle node A")
|
||||
b := bdProxiedCreate(t, bd, p.dir, "Cycle node B")
|
||||
db := openProxiedDB(t, p)
|
||||
|
|
@ -397,7 +414,8 @@ func TestProxiedServerReady(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("gated_empty_case", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "rdge")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "rdge")
|
||||
bdProxiedCreate(t, bd, p.dir, "No gates anywhere")
|
||||
stdout, _, err := bdProxiedRunBuffers(t, bd, p.dir, "ready", "--gated", "--json")
|
||||
if err != nil {
|
||||
|
|
@ -423,7 +441,8 @@ func TestProxiedServerReady(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("gated_json_shape_with_open_gate", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "rdgw")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "rdgw")
|
||||
bdProxiedCreate(t, bd, p.dir, "Open gate", "--type", "gate")
|
||||
stdout, _, err := bdProxiedRunBuffers(t, bd, p.dir, "ready", "--gated", "--json")
|
||||
if err != nil {
|
||||
|
|
@ -444,7 +463,8 @@ func TestProxiedServerReady(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("mol_text_and_json", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "rdm")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "rdm")
|
||||
mol := bdProxiedCreate(t, bd, p.dir, "Mol parent", "--type", "molecule")
|
||||
s1 := bdProxiedCreate(t, bd, p.dir, "Step one", "--parent", mol.ID)
|
||||
bdProxiedCreate(t, bd, p.dir, "Step two", "--parent", mol.ID, "--deps", "depends-on:"+s1.ID)
|
||||
|
|
@ -475,7 +495,8 @@ func TestProxiedServerReady(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("empty_state_no_open_issues", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "rdei")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "rdei")
|
||||
stdout, _ := bdProxiedReadyCapture(t, bd, p)
|
||||
if !strings.Contains(stdout, "No open issues") {
|
||||
t.Errorf("expected 'No open issues', got: %s", stdout)
|
||||
|
|
@ -483,7 +504,8 @@ func TestProxiedServerReady(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("empty_state_no_ready_with_blockers", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "rdeb")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "rdeb")
|
||||
blocker := bdProxiedCreate(t, bd, p.dir, "Self-blocker")
|
||||
bdProxiedCreate(t, bd, p.dir, "Only issue, blocked", "--deps", "blocks:"+blocker.ID)
|
||||
if _, err := bdProxiedRun(t, bd, p.dir, "ready", "--claim", "--json"); err == nil {
|
||||
|
|
@ -498,7 +520,8 @@ func TestProxiedServerReady(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("filter_priority_pass_through", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "rfp")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "rfp")
|
||||
hi := bdProxiedCreate(t, bd, p.dir, "Hi pri", "-p", "0")
|
||||
lo := bdProxiedCreate(t, bd, p.dir, "Lo pri", "-p", "3")
|
||||
ready := bdProxiedReadyJSON(t, bd, p, "-p", "0")
|
||||
|
|
@ -515,7 +538,8 @@ func TestProxiedServerReady(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("filter_assignee_pass_through", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "rfa")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "rfa")
|
||||
mine := bdProxiedCreate(t, bd, p.dir, "Alice work", "--assignee", "alice")
|
||||
bdProxiedCreate(t, bd, p.dir, "Bob work", "--assignee", "bob")
|
||||
ready := bdProxiedReadyJSON(t, bd, p, "--assignee", "alice")
|
||||
|
|
@ -534,7 +558,8 @@ func TestProxiedServerReady(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("filter_unassigned_pass_through", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "rfu")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "rfu")
|
||||
un := bdProxiedCreate(t, bd, p.dir, "Free agent")
|
||||
bdProxiedCreate(t, bd, p.dir, "Taken", "--assignee", "alice")
|
||||
ready := bdProxiedReadyJSON(t, bd, p, "--unassigned")
|
||||
|
|
@ -553,7 +578,8 @@ func TestProxiedServerReady(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("filter_type_pass_through", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "rft")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "rft")
|
||||
bug := bdProxiedCreate(t, bd, p.dir, "A bug", "--type", "bug")
|
||||
bdProxiedCreate(t, bd, p.dir, "A task", "--type", "task")
|
||||
ready := bdProxiedReadyJSON(t, bd, p, "--type", "bug")
|
||||
|
|
@ -572,7 +598,8 @@ func TestProxiedServerReady(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("filter_parent_pass_through", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "rfpar")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "rfpar")
|
||||
epic := bdProxiedCreate(t, bd, p.dir, "Epic", "--type", "epic")
|
||||
child := bdProxiedCreate(t, bd, p.dir, "Inside", "--parent", epic.ID)
|
||||
outside := bdProxiedCreate(t, bd, p.dir, "Outside")
|
||||
|
|
@ -590,7 +617,8 @@ func TestProxiedServerReady(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("metadata_field_match", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "rmd1")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "rmd1")
|
||||
match := bdProxiedCreate(t, bd, p.dir, "Has team", "--metadata", `{"team":"platform"}`)
|
||||
bdProxiedCreate(t, bd, p.dir, "Other team", "--metadata", `{"team":"frontend"}`)
|
||||
ready := bdProxiedReadyJSON(t, bd, p, "--metadata-field", "team=platform")
|
||||
|
|
@ -604,7 +632,8 @@ func TestProxiedServerReady(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("metadata_has_key", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "rmd2")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "rmd2")
|
||||
withMeta := bdProxiedCreate(t, bd, p.dir, "With meta", "--metadata", `{"team":"x"}`)
|
||||
bdProxiedCreate(t, bd, p.dir, "No meta")
|
||||
ready := bdProxiedReadyJSON(t, bd, p, "--has-metadata-key", "team")
|
||||
|
|
@ -618,7 +647,8 @@ func TestProxiedServerReady(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("metadata_field_invalid_key_errors", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "rmd3")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "rmd3")
|
||||
out := bdProxiedReadyFail(t, bd, p, "--metadata-field", "bad$key=x")
|
||||
if !strings.Contains(out, "metadata-field") {
|
||||
t.Errorf("expected validation error about metadata-field, got: %s", out)
|
||||
|
|
@ -626,7 +656,8 @@ func TestProxiedServerReady(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("include_deferred_toggle", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "rdd")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "rdd")
|
||||
issue := bdProxiedCreate(t, bd, p.dir, "Will defer")
|
||||
db := openProxiedDB(t, p)
|
||||
if _, err := db.ExecContext(context.Background(),
|
||||
|
|
@ -653,7 +684,8 @@ func TestProxiedServerReady(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("include_ephemeral_surfaces_wisps", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "rdie")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "rdie")
|
||||
reg := bdProxiedCreate(t, bd, p.dir, "Regular")
|
||||
wisp := bdProxiedCreate(t, bd, p.dir, "Wispy", "--ephemeral")
|
||||
def := bdProxiedReadyJSON(t, bd, p)
|
||||
|
|
@ -678,7 +710,8 @@ func TestProxiedServerReady(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("mol_type_validation_rejects_invalid", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "rmtv")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "rmtv")
|
||||
out := bdProxiedReadyFail(t, bd, p, "--mol-type", "garbage")
|
||||
if !strings.Contains(out, "invalid mol-type") {
|
||||
t.Errorf("expected 'invalid mol-type' error, got: %s", out)
|
||||
|
|
@ -686,7 +719,8 @@ func TestProxiedServerReady(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("claim_combo_guards", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "rcc")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "rcc")
|
||||
bdProxiedCreate(t, bd, p.dir, "Seed")
|
||||
cases := []struct {
|
||||
name string
|
||||
|
|
@ -708,7 +742,8 @@ func TestProxiedServerReady(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("exclude_type_csv_and_repeated", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "rxt")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "rxt")
|
||||
task := bdProxiedCreate(t, bd, p.dir, "Task work", "--type", "task")
|
||||
bdProxiedCreate(t, bd, p.dir, "Bug work", "--type", "bug")
|
||||
bdProxiedCreate(t, bd, p.dir, "Epic work", "--type", "epic")
|
||||
|
|
@ -744,9 +779,10 @@ func TestProxiedServerReady(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestProxiedServerReadyConcurrent(t *testing.T) {
|
||||
requireProxiedServerEnv(t)
|
||||
requireSharedProxiedServer(t)
|
||||
t.Parallel()
|
||||
bd := buildEmbeddedBD(t)
|
||||
p := bdProxiedInit(t, bd, "rxc")
|
||||
p := newSharedProxiedProject(t, bd, "rxc")
|
||||
bdProxiedCreate(t, bd, p.dir, "Concurrent read target")
|
||||
|
||||
const numWorkers = 8
|
||||
|
|
@ -769,9 +805,10 @@ func TestProxiedServerReadyConcurrent(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestProxiedServerReadyClaimConcurrent(t *testing.T) {
|
||||
requireProxiedServerEnv(t)
|
||||
requireSharedProxiedServer(t)
|
||||
t.Parallel()
|
||||
bd := buildEmbeddedBD(t)
|
||||
p := bdProxiedInit(t, bd, "rcx")
|
||||
p := newSharedProxiedProject(t, bd, "rcx")
|
||||
issue := bdProxiedCreate(t, bd, p.dir, "Atomic claim target", "--label", "atomic")
|
||||
|
||||
const numWorkers = 8
|
||||
|
|
|
|||
|
|
@ -8,11 +8,13 @@ import (
|
|||
)
|
||||
|
||||
func TestProxiedServerLink(t *testing.T) {
|
||||
requireProxiedServerEnv(t)
|
||||
requireSharedProxiedServer(t)
|
||||
t.Parallel()
|
||||
bd := buildEmbeddedBD(t)
|
||||
|
||||
t.Run("link_default_blocks", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "lk")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "lk")
|
||||
a := bdProxiedCreate(t, bd, p.dir, "Link from")
|
||||
b := bdProxiedCreate(t, bd, p.dir, "Link to")
|
||||
|
||||
|
|
@ -29,7 +31,8 @@ func TestProxiedServerLink(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("link_with_type", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "lt")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "lt")
|
||||
a := bdProxiedCreate(t, bd, p.dir, "Rel from")
|
||||
b := bdProxiedCreate(t, bd, p.dir, "Rel to")
|
||||
|
||||
|
|
@ -42,7 +45,8 @@ func TestProxiedServerLink(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("link_invalid_type_rejected", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "li")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "li")
|
||||
a := bdProxiedCreate(t, bd, p.dir, "Bad from")
|
||||
b := bdProxiedCreate(t, bd, p.dir, "Bad to")
|
||||
_, out, err := bdProxiedRunBuffers(t, bd, p.dir, "link", a.ID, b.ID, "--type", "")
|
||||
|
|
@ -53,10 +57,11 @@ func TestProxiedServerLink(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestProxiedServerChildren(t *testing.T) {
|
||||
requireProxiedServerEnv(t)
|
||||
requireSharedProxiedServer(t)
|
||||
t.Parallel()
|
||||
bd := buildEmbeddedBD(t)
|
||||
|
||||
p := bdProxiedInit(t, bd, "ch")
|
||||
p := newSharedProxiedProject(t, bd, "ch")
|
||||
parent := bdProxiedCreate(t, bd, p.dir, "Parent", "--type", "epic")
|
||||
c1 := bdProxiedCreate(t, bd, p.dir, "Child 1", "--parent", parent.ID)
|
||||
c2 := bdProxiedCreate(t, bd, p.dir, "Child 2", "--parent", parent.ID)
|
||||
|
|
@ -71,11 +76,13 @@ func TestProxiedServerChildren(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestProxiedServerGateList(t *testing.T) {
|
||||
requireProxiedServerEnv(t)
|
||||
requireSharedProxiedServer(t)
|
||||
t.Parallel()
|
||||
bd := buildEmbeddedBD(t)
|
||||
|
||||
t.Run("db_wide_lists_gates", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "ga")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "ga")
|
||||
gate := bdProxiedCreate(t, bd, p.dir, "A gate", "--type", "gate")
|
||||
bdProxiedCreate(t, bd, p.dir, "Not a gate", "--type", "task")
|
||||
|
||||
|
|
@ -89,7 +96,8 @@ func TestProxiedServerGateList(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("bead_scoped_lists_blocking_gates", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "gb")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "gb")
|
||||
work := bdProxiedCreate(t, bd, p.dir, "Blocked work")
|
||||
gate := bdProxiedCreate(t, bd, p.dir, "Blocking gate", "--type", "gate")
|
||||
unrelated := bdProxiedCreate(t, bd, p.dir, "Unrelated gate", "--type", "gate")
|
||||
|
|
|
|||
|
|
@ -85,11 +85,13 @@ func readReopenComment(t *testing.T, db *sql.DB, id string) string {
|
|||
}
|
||||
|
||||
func TestProxiedServerReopen(t *testing.T) {
|
||||
requireProxiedServerEnv(t)
|
||||
requireSharedProxiedServer(t)
|
||||
t.Parallel()
|
||||
bd := buildEmbeddedBD(t)
|
||||
|
||||
t.Run("no_ids_errors", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "ron")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "ron")
|
||||
out := bdProxiedReopenFail(t, bd, p.dir)
|
||||
if !strings.Contains(out, "requires at least 1 arg") {
|
||||
t.Errorf("expected cobra arg-count error, got: %s", out)
|
||||
|
|
@ -97,7 +99,8 @@ func TestProxiedServerReopen(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("reopens_closed_issue", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "rorc")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "rorc")
|
||||
issue := bdProxiedCreate(t, bd, p.dir, "Reopen target")
|
||||
bdProxiedClose(t, bd, p.dir, issue.ID)
|
||||
out := bdProxiedReopen(t, bd, p.dir, issue.ID)
|
||||
|
|
@ -122,7 +125,8 @@ func TestProxiedServerReopen(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("reason_recorded_as_comment", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "rorr")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "rorr")
|
||||
issue := bdProxiedCreate(t, bd, p.dir, "Reason target")
|
||||
bdProxiedClose(t, bd, p.dir, issue.ID)
|
||||
bdProxiedReopen(t, bd, p.dir, issue.ID, "--reason", "regression in QA")
|
||||
|
|
@ -133,7 +137,8 @@ func TestProxiedServerReopen(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("already_open_prints_warning", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "roao")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "roao")
|
||||
issue := bdProxiedCreate(t, bd, p.dir, "Already open")
|
||||
stdout, stderr, err := bdProxiedRunBuffers(t, bd, p.dir, "reopen", issue.ID)
|
||||
if err != nil {
|
||||
|
|
@ -145,7 +150,8 @@ func TestProxiedServerReopen(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("missing_id_errors", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "rom")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "rom")
|
||||
out := bdProxiedReopenFail(t, bd, p.dir, "rom-does-not-exist")
|
||||
if !strings.Contains(out, "not found") {
|
||||
t.Errorf("expected 'not found' error, got: %s", out)
|
||||
|
|
@ -153,7 +159,8 @@ func TestProxiedServerReopen(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("reopens_wisp", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "rorw")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "rorw")
|
||||
wisp := bdProxiedCreate(t, bd, p.dir, "Wisp reopen", "--ephemeral")
|
||||
bdProxiedClose(t, bd, p.dir, wisp.ID)
|
||||
bdProxiedReopen(t, bd, p.dir, wisp.ID)
|
||||
|
|
@ -186,7 +193,8 @@ func TestProxiedServerReopen(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("json_output", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "roj")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "roj")
|
||||
issue := bdProxiedCreate(t, bd, p.dir, "JSON reopen")
|
||||
bdProxiedClose(t, bd, p.dir, issue.ID)
|
||||
issues := bdProxiedReopenJSON(t, bd, p.dir, issue.ID)
|
||||
|
|
@ -199,7 +207,8 @@ func TestProxiedServerReopen(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("batch_single_dolt_commit", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "rosd")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "rosd")
|
||||
a := bdProxiedCreate(t, bd, p.dir, "Batch A")
|
||||
b := bdProxiedCreate(t, bd, p.dir, "Batch B")
|
||||
bdProxiedClose(t, bd, p.dir, a.ID, b.ID)
|
||||
|
|
@ -222,7 +231,8 @@ func TestProxiedServerReopen(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("reblocks_dependent", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "rorb")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "rorb")
|
||||
blocker := bdProxiedCreate(t, bd, p.dir, "Reblock blocker")
|
||||
blocked := bdProxiedCreate(t, bd, p.dir, "Reblock blocked", "--deps", "depends-on:"+blocker.ID)
|
||||
bdProxiedClose(t, bd, p.dir, blocker.ID)
|
||||
|
|
@ -237,7 +247,8 @@ func TestProxiedServerReopen(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("reopen_with_reason_short", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "rorrs")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "rorrs")
|
||||
issue := bdProxiedCreate(t, bd, p.dir, "Short reason target")
|
||||
bdProxiedClose(t, bd, p.dir, issue.ID)
|
||||
bdProxiedReopen(t, bd, p.dir, issue.ID, "-r", "needs more work")
|
||||
|
|
@ -251,7 +262,8 @@ func TestProxiedServerReopen(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("reopen_clears_defer_until", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "rocd")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "rocd")
|
||||
issue := bdProxiedCreate(t, bd, p.dir, "Deferred reopen", "--defer", "+8760h")
|
||||
bdProxiedClose(t, bd, p.dir, issue.ID)
|
||||
bdProxiedReopen(t, bd, p.dir, issue.ID)
|
||||
|
|
@ -270,7 +282,8 @@ func TestProxiedServerReopen(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("last_touched_not_supported", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "rolt")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "rolt")
|
||||
_ = bdProxiedCreate(t, bd, p.dir, "Recent create")
|
||||
out := bdProxiedReopenFail(t, bd, p.dir)
|
||||
if !strings.Contains(out, "requires at least 1 arg") {
|
||||
|
|
@ -279,12 +292,13 @@ func TestProxiedServerReopen(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("hooks_fire_on_update", func(t *testing.T) {
|
||||
t.Parallel()
|
||||
if runtime.GOOS == "windows" {
|
||||
t.Skip("hook script form is POSIX shell")
|
||||
}
|
||||
marker := filepath.Join(t.TempDir(), "on_update_marker")
|
||||
script := "#!/bin/sh\nprintf '%s\\n' \"$1\" > " + shellQuote(marker) + "\n"
|
||||
p := bdProxiedInitWithHooks(t, bd, "rofh", map[string]string{"on_update": script})
|
||||
p := newSharedProxiedProjectWithHooks(t, bd, "rofh", map[string]string{"on_update": script})
|
||||
issue := bdProxiedCreate(t, bd, p.dir, "Hook reopen")
|
||||
bdProxiedClose(t, bd, p.dir, issue.ID)
|
||||
_ = os.Remove(marker)
|
||||
|
|
@ -299,7 +313,8 @@ func TestProxiedServerReopen(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("wisp_reopen_clears_defer_until", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "rowd")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "rowd")
|
||||
wisp := bdProxiedCreate(t, bd, p.dir, "Deferred wisp", "--ephemeral", "--defer", "+8760h")
|
||||
bdProxiedClose(t, bd, p.dir, wisp.ID)
|
||||
bdProxiedReopen(t, bd, p.dir, wisp.ID)
|
||||
|
|
@ -315,7 +330,8 @@ func TestProxiedServerReopen(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("wisp_reason_recorded_as_comment", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "rowr")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "rowr")
|
||||
wisp := bdProxiedCreate(t, bd, p.dir, "Wisp reason", "--ephemeral")
|
||||
bdProxiedClose(t, bd, p.dir, wisp.ID)
|
||||
bdProxiedReopen(t, bd, p.dir, wisp.ID, "--reason", "wisp regression")
|
||||
|
|
@ -326,7 +342,8 @@ func TestProxiedServerReopen(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("wisp_reopen_with_reason_short", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "rowrs")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "rowrs")
|
||||
wisp := bdProxiedCreate(t, bd, p.dir, "Wisp short reason", "--ephemeral")
|
||||
bdProxiedClose(t, bd, p.dir, wisp.ID)
|
||||
bdProxiedReopen(t, bd, p.dir, wisp.ID, "-r", "still flaky")
|
||||
|
|
@ -346,10 +363,11 @@ func TestProxiedServerReopen(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestProxiedServerReopenConcurrent(t *testing.T) {
|
||||
requireProxiedServerEnv(t)
|
||||
requireSharedProxiedServer(t)
|
||||
t.Parallel()
|
||||
bd := buildEmbeddedBD(t)
|
||||
|
||||
p := bdProxiedInit(t, bd, "rxc")
|
||||
p := newSharedProxiedProject(t, bd, "rxc")
|
||||
|
||||
const (
|
||||
numWorkers = 10
|
||||
|
|
|
|||
|
|
@ -9,11 +9,13 @@ import (
|
|||
)
|
||||
|
||||
func TestProxiedServerState(t *testing.T) {
|
||||
requireProxiedServerEnv(t)
|
||||
requireSharedProxiedServer(t)
|
||||
t.Parallel()
|
||||
bd := buildEmbeddedBD(t)
|
||||
|
||||
t.Run("state_query", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "st")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "st")
|
||||
issue := bdProxiedCreate(t, bd, p.dir, "State target")
|
||||
bdProxiedLabel(t, bd, p.dir, "add", issue.ID, "patrol:active")
|
||||
|
||||
|
|
@ -27,7 +29,8 @@ func TestProxiedServerState(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("state_query_unset", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "su")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "su")
|
||||
issue := bdProxiedCreate(t, bd, p.dir, "No state")
|
||||
out, _, err := bdProxiedRunBuffers(t, bd, p.dir, "state", issue.ID, "mode")
|
||||
if err != nil {
|
||||
|
|
@ -39,7 +42,8 @@ func TestProxiedServerState(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("state_query_json", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "sj")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "sj")
|
||||
issue := bdProxiedCreate(t, bd, p.dir, "State json")
|
||||
bdProxiedLabel(t, bd, p.dir, "add", issue.ID, "mode:degraded")
|
||||
|
||||
|
|
@ -61,7 +65,8 @@ func TestProxiedServerState(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("state_list", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "sl")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "sl")
|
||||
issue := bdProxiedCreate(t, bd, p.dir, "State list target")
|
||||
bdProxiedLabel(t, bd, p.dir, "add", issue.ID, "patrol:active,mode:normal")
|
||||
|
||||
|
|
@ -75,7 +80,8 @@ func TestProxiedServerState(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("state_list_empty", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "se")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "se")
|
||||
issue := bdProxiedCreate(t, bd, p.dir, "No labels")
|
||||
out, _, err := bdProxiedRunBuffers(t, bd, p.dir, "state", "list", issue.ID)
|
||||
if err != nil {
|
||||
|
|
@ -87,7 +93,8 @@ func TestProxiedServerState(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("state_reads_wisp_labels", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "sw")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "sw")
|
||||
wisp := bdProxiedCreate(t, bd, p.dir, "Wisp state", "--ephemeral")
|
||||
bdProxiedLabel(t, bd, p.dir, "add", wisp.ID, "patrol:muted")
|
||||
|
||||
|
|
|
|||
|
|
@ -18,11 +18,13 @@ import (
|
|||
)
|
||||
|
||||
func TestProxiedServerUpdate(t *testing.T) {
|
||||
requireProxiedServerEnv(t)
|
||||
requireSharedProxiedServer(t)
|
||||
t.Parallel()
|
||||
bd := buildEmbeddedBD(t)
|
||||
|
||||
t.Run("no_ids_errors", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "un1")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "un1")
|
||||
out := bdProxiedUpdateFail(t, bd, p.dir)
|
||||
if !strings.Contains(out, "no issue ID provided") {
|
||||
t.Errorf("expected no-id error, got: %s", out)
|
||||
|
|
@ -30,7 +32,8 @@ func TestProxiedServerUpdate(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("no_flags_is_noop_message", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "un2")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "un2")
|
||||
issue := bdProxiedCreate(t, bd, p.dir, "Seed")
|
||||
out, err := bdProxiedRun(t, bd, p.dir, "update", issue.ID)
|
||||
if err != nil {
|
||||
|
|
@ -42,7 +45,8 @@ func TestProxiedServerUpdate(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("field_updates_round_trip", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "uf")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "uf")
|
||||
issue := bdProxiedCreate(t, bd, p.dir, "Original")
|
||||
updated := bdProxiedUpdateOne(t, bd, p.dir, issue.ID,
|
||||
"--title", "Renamed",
|
||||
|
|
@ -64,7 +68,8 @@ func TestProxiedServerUpdate(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("claim_sets_assignee_and_in_progress", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "uc")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "uc")
|
||||
issue := bdProxiedCreate(t, bd, p.dir, "To claim")
|
||||
updated := bdProxiedUpdateOne(t, bd, p.dir, issue.ID, "--claim")
|
||||
if updated.Status != types.StatusInProgress {
|
||||
|
|
@ -76,7 +81,8 @@ func TestProxiedServerUpdate(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("claim_then_other_user_conflicts", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "ucc")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "ucc")
|
||||
issue := bdProxiedCreate(t, bd, p.dir, "Contested")
|
||||
bdProxiedUpdateOne(t, bd, p.dir, issue.ID, "--claim", "--assignee", "alice")
|
||||
|
||||
|
|
@ -91,7 +97,8 @@ func TestProxiedServerUpdate(t *testing.T) {
|
|||
// the lost claim is not hidden from exit-code automation (beads audit
|
||||
// finding #10). The winner is still committed.
|
||||
t.Run("claim_batch_partial_loss_exits_nonzero", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "ucbp")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "ucbp")
|
||||
lost := bdProxiedCreate(t, bd, p.dir, "Batch lost")
|
||||
won := bdProxiedCreate(t, bd, p.dir, "Batch won")
|
||||
// Pre-claim `lost` as alice so bob's claim in the batch loses.
|
||||
|
|
@ -117,7 +124,8 @@ func TestProxiedServerUpdate(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("add_remove_labels", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "ul")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "ul")
|
||||
issue := bdProxiedCreate(t, bd, p.dir, "Labeled")
|
||||
bdProxiedUpdateOne(t, bd, p.dir, issue.ID, "--add-label", "perf,tech-debt")
|
||||
bdProxiedUpdateOne(t, bd, p.dir, issue.ID, "--remove-label", "perf")
|
||||
|
|
@ -130,7 +138,8 @@ func TestProxiedServerUpdate(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("set_labels_diffs", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "usl")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "usl")
|
||||
issue := bdProxiedCreate(t, bd, p.dir, "Set labels")
|
||||
bdProxiedUpdateOne(t, bd, p.dir, issue.ID, "--add-label", "a,b,c")
|
||||
bdProxiedUpdateOne(t, bd, p.dir, issue.ID, "--set-labels", "b,d")
|
||||
|
|
@ -144,7 +153,8 @@ func TestProxiedServerUpdate(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("reparent_replaces_existing_parent", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "urp")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "urp")
|
||||
oldParent := bdProxiedCreate(t, bd, p.dir, "Old parent", "-t", "epic")
|
||||
newParent := bdProxiedCreate(t, bd, p.dir, "New parent", "-t", "epic")
|
||||
child := bdProxiedCreate(t, bd, p.dir, "Child", "--parent", oldParent.ID)
|
||||
|
|
@ -165,7 +175,8 @@ func TestProxiedServerUpdate(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("reparent_empty_unparents", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "uup")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "uup")
|
||||
parent := bdProxiedCreate(t, bd, p.dir, "Parent", "-t", "epic")
|
||||
child := bdProxiedCreate(t, bd, p.dir, "Child", "--parent", parent.ID)
|
||||
|
||||
|
|
@ -184,7 +195,8 @@ func TestProxiedServerUpdate(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("close_unblocks_dependents", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "ucb")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "ucb")
|
||||
blocker := bdProxiedCreate(t, bd, p.dir, "Blocker")
|
||||
blocked := bdProxiedCreate(t, bd, p.dir, "Dependent", "--deps", "depends-on:"+blocker.ID)
|
||||
|
||||
|
|
@ -201,7 +213,8 @@ func TestProxiedServerUpdate(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("invalid_status_rejected", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "uis")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "uis")
|
||||
issue := bdProxiedCreate(t, bd, p.dir, "Status test")
|
||||
out := bdProxiedUpdateFail(t, bd, p.dir, issue.ID, "-s", "not-a-real-status")
|
||||
if !strings.Contains(out, "invalid status") {
|
||||
|
|
@ -210,7 +223,8 @@ func TestProxiedServerUpdate(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("multiple_ids_update_all", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "umu")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "umu")
|
||||
a := bdProxiedCreate(t, bd, p.dir, "A")
|
||||
b := bdProxiedCreate(t, bd, p.dir, "B")
|
||||
issues := bdProxiedUpdate(t, bd, p.dir, a.ID, b.ID, "--assignee", "team")
|
||||
|
|
@ -225,7 +239,8 @@ func TestProxiedServerUpdate(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("defer_clear_restores_open", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "udf")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "udf")
|
||||
issue := bdProxiedCreate(t, bd, p.dir, "Deferred")
|
||||
|
||||
deferred := bdProxiedUpdateOne(t, bd, p.dir, issue.ID, "--defer", "+1d")
|
||||
|
|
@ -240,7 +255,8 @@ func TestProxiedServerUpdate(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("update_type", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "ut")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "ut")
|
||||
issue := bdProxiedCreate(t, bd, p.dir, "Type test")
|
||||
updated := bdProxiedUpdateOne(t, bd, p.dir, issue.ID, "--type", "bug")
|
||||
if updated.IssueType != types.TypeBug {
|
||||
|
|
@ -249,7 +265,8 @@ func TestProxiedServerUpdate(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("update_type_invalid_rejected", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "uti")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "uti")
|
||||
issue := bdProxiedCreate(t, bd, p.dir, "Bad type test")
|
||||
out := bdProxiedUpdateFail(t, bd, p.dir, issue.ID, "--type", "not-a-real-type")
|
||||
if !strings.Contains(strings.ToLower(out), "invalid") &&
|
||||
|
|
@ -259,7 +276,8 @@ func TestProxiedServerUpdate(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("update_type_custom", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "utc")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "utc")
|
||||
issue := bdProxiedCreate(t, bd, p.dir, "Custom type test")
|
||||
|
||||
db := openProxiedDB(t, p)
|
||||
|
|
@ -277,7 +295,8 @@ func TestProxiedServerUpdate(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("description_from_file", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "ubf")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "ubf")
|
||||
issue := bdProxiedCreate(t, bd, p.dir, "Body file test")
|
||||
|
||||
bodyPath := filepath.Join(p.dir, "body.txt")
|
||||
|
|
@ -292,7 +311,8 @@ func TestProxiedServerUpdate(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("description_body_alias", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "uba")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "uba")
|
||||
issue := bdProxiedCreate(t, bd, p.dir, "Body alias test")
|
||||
updated := bdProxiedUpdateOne(t, bd, p.dir, issue.ID, "--body", "via body flag")
|
||||
if updated.Description != "via body flag" {
|
||||
|
|
@ -301,7 +321,8 @@ func TestProxiedServerUpdate(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("update_creates_dolt_commit", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "udc")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "udc")
|
||||
issue := bdProxiedCreate(t, bd, p.dir, "Dolt commit test")
|
||||
|
||||
db := openProxiedDB(t, p)
|
||||
|
|
@ -325,7 +346,8 @@ func TestProxiedServerUpdate(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("reparent_from_orphan", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "urpo")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "urpo")
|
||||
parent := bdProxiedCreate(t, bd, p.dir, "New parent", "-t", "epic")
|
||||
orphan := bdProxiedCreate(t, bd, p.dir, "Orphan child")
|
||||
|
||||
|
|
@ -336,7 +358,8 @@ func TestProxiedServerUpdate(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("close_with_session_flag", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "ucws")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "ucws")
|
||||
issue := bdProxiedCreate(t, bd, p.dir, "Close-with-session flag test")
|
||||
|
||||
bdProxiedUpdateOne(t, bd, p.dir, issue.ID, "-s", "closed", "--session", "sess-flag")
|
||||
|
|
@ -353,11 +376,13 @@ func TestProxiedServerUpdate(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("close_with_session_env", func(t *testing.T) {
|
||||
t.Setenv("CLAUDE_SESSION_ID", "sess-env")
|
||||
p := bdProxiedInit(t, bd, "ucwe")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "ucwe")
|
||||
issue := bdProxiedCreate(t, bd, p.dir, "Close-with-session env test")
|
||||
|
||||
bdProxiedUpdateOne(t, bd, p.dir, issue.ID, "-s", "closed")
|
||||
if _, stderr, err := bdProxiedRunEnv(t, bd, p.dir, []string{"CLAUDE_SESSION_ID=sess-env"}, "update", issue.ID, "-s", "closed"); err != nil {
|
||||
t.Fatalf("update failed: %v\n%s", err, stderr)
|
||||
}
|
||||
|
||||
db := openProxiedDB(t, p)
|
||||
var got sql.NullString
|
||||
|
|
@ -372,7 +397,8 @@ func TestProxiedServerUpdate(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("ephemeral_persistent_conflict", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "uepc")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "uepc")
|
||||
issue := bdProxiedCreate(t, bd, p.dir, "Ephemeral/persistent conflict test")
|
||||
out := bdProxiedUpdateFail(t, bd, p.dir, issue.ID, "--ephemeral", "--persistent")
|
||||
if !strings.Contains(out, "cannot specify both --ephemeral and --persistent") {
|
||||
|
|
@ -381,7 +407,8 @@ func TestProxiedServerUpdate(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("update_history", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "uh")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "uh")
|
||||
issue := bdProxiedCreate(t, bd, p.dir, "History test")
|
||||
|
||||
db := openProxiedDB(t, p)
|
||||
|
|
@ -399,7 +426,8 @@ func TestProxiedServerUpdate(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("update_no_history", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "unh")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "unh")
|
||||
issue := bdProxiedCreate(t, bd, p.dir, "No history test")
|
||||
|
||||
db := openProxiedDB(t, p)
|
||||
|
|
@ -416,7 +444,8 @@ func TestProxiedServerUpdate(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("update_persistent", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "ups")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "ups")
|
||||
issue := bdProxiedCreate(t, bd, p.dir, "Persistent test")
|
||||
|
||||
db := openProxiedDB(t, p)
|
||||
|
|
@ -434,7 +463,8 @@ func TestProxiedServerUpdate(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("update_ephemeral", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "uep")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "uep")
|
||||
issue := bdProxiedCreate(t, bd, p.dir, "Ephemeral test")
|
||||
|
||||
db := openProxiedDB(t, p)
|
||||
|
|
@ -451,7 +481,8 @@ func TestProxiedServerUpdate(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("reopen_reblocks_dependents", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "urb")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "urb")
|
||||
blocker := bdProxiedCreate(t, bd, p.dir, "Reopen blocker")
|
||||
blocked := bdProxiedCreate(t, bd, p.dir, "Reopen dependent", "--deps", "depends-on:"+blocker.ID)
|
||||
|
||||
|
|
@ -472,7 +503,8 @@ func TestProxiedServerUpdate(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("update_nonexistent_id", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "unx")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "unx")
|
||||
out := bdProxiedUpdateFail(t, bd, p.dir, "unx-doesnotexist", "--title", "x")
|
||||
if !strings.Contains(strings.ToLower(out), "not found") &&
|
||||
!strings.Contains(strings.ToLower(out), "no rows") &&
|
||||
|
|
@ -482,7 +514,8 @@ func TestProxiedServerUpdate(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("update_invalid_priority", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "uip")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "uip")
|
||||
issue := bdProxiedCreate(t, bd, p.dir, "Invalid priority test")
|
||||
out := bdProxiedUpdateFail(t, bd, p.dir, issue.ID, "-p", "99")
|
||||
if !strings.Contains(out, "invalid priority") {
|
||||
|
|
@ -491,7 +524,8 @@ func TestProxiedServerUpdate(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("update_metadata_invalid_json", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "umij")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "umij")
|
||||
issue := bdProxiedCreate(t, bd, p.dir, "Metadata invalid JSON test")
|
||||
out := bdProxiedUpdateFail(t, bd, p.dir, issue.ID, "--metadata", "not json at all")
|
||||
if !strings.Contains(out, "invalid JSON") {
|
||||
|
|
@ -500,7 +534,8 @@ func TestProxiedServerUpdate(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("update_metadata_at_file", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "umaf")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "umaf")
|
||||
issue := bdProxiedCreate(t, bd, p.dir, "Metadata @file test")
|
||||
|
||||
metaPath := filepath.Join(p.dir, "meta.json")
|
||||
|
|
@ -522,7 +557,8 @@ func TestProxiedServerUpdate(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("metadata_and_set_conflict", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "umsc")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "umsc")
|
||||
issue := bdProxiedCreate(t, bd, p.dir, "Metadata conflict test")
|
||||
out := bdProxiedUpdateFail(t, bd, p.dir, issue.ID,
|
||||
"--metadata", `{"a":1}`,
|
||||
|
|
@ -533,7 +569,8 @@ func TestProxiedServerUpdate(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("update_unset_metadata", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "uum")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "uum")
|
||||
issue := bdProxiedCreate(t, bd, p.dir, "Unset metadata test")
|
||||
bdProxiedUpdateOne(t, bd, p.dir, issue.ID, "--metadata", `{"keep":"yes","drop":"yes"}`)
|
||||
|
||||
|
|
@ -552,7 +589,8 @@ func TestProxiedServerUpdate(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("update_set_metadata", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "usm")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "usm")
|
||||
issue := bdProxiedCreate(t, bd, p.dir, "Set metadata test")
|
||||
updated := bdProxiedUpdateOne(t, bd, p.dir, issue.ID,
|
||||
"--set-metadata", "tier=gold",
|
||||
|
|
@ -571,7 +609,8 @@ func TestProxiedServerUpdate(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("update_metadata_merge", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "umm")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "umm")
|
||||
issue := bdProxiedCreate(t, bd, p.dir, "Metadata merge test")
|
||||
bdProxiedUpdateOne(t, bd, p.dir, issue.ID, "--metadata", `{"a":1,"b":2}`)
|
||||
merged := bdProxiedUpdateOne(t, bd, p.dir, issue.ID, "--metadata", `{"b":3,"c":4}`)
|
||||
|
|
@ -597,7 +636,8 @@ func TestProxiedServerUpdate(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("update_metadata_json", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "umd")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "umd")
|
||||
issue := bdProxiedCreate(t, bd, p.dir, "Metadata json test")
|
||||
updated := bdProxiedUpdateOne(t, bd, p.dir, issue.ID, "--metadata", `{"k":"v","n":42}`)
|
||||
var got map[string]any
|
||||
|
|
@ -613,7 +653,8 @@ func TestProxiedServerUpdate(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("update_await_id", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "uaw")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "uaw")
|
||||
issue := bdProxiedCreate(t, bd, p.dir, "Await id test")
|
||||
updated := bdProxiedUpdateOne(t, bd, p.dir, issue.ID, "--await-id", "gate-1")
|
||||
if updated.AwaitID != "gate-1" {
|
||||
|
|
@ -622,7 +663,8 @@ func TestProxiedServerUpdate(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("update_defer_clear_preserves_non_deferred_status", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "udfp2")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "udfp2")
|
||||
issue := bdProxiedCreate(t, bd, p.dir, "Defer clear preserve test")
|
||||
|
||||
seeded := bdProxiedUpdateOne(t, bd, p.dir, issue.ID, "--defer", "+1d", "-s", "blocked")
|
||||
|
|
@ -641,7 +683,8 @@ func TestProxiedServerUpdate(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("update_defer_past_date_keeps_status_open", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "udfp")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "udfp")
|
||||
issue := bdProxiedCreate(t, bd, p.dir, "Defer past test")
|
||||
|
||||
updated := bdProxiedUpdateOne(t, bd, p.dir, issue.ID, "--defer", "2020-01-01")
|
||||
|
|
@ -655,7 +698,8 @@ func TestProxiedServerUpdate(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("update_defer_respects_explicit_status", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "udfe")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "udfe")
|
||||
issue := bdProxiedCreate(t, bd, p.dir, "Defer explicit status test")
|
||||
|
||||
updated := bdProxiedUpdateOne(t, bd, p.dir, issue.ID, "--defer", "+1d", "-s", "blocked")
|
||||
|
|
@ -669,7 +713,8 @@ func TestProxiedServerUpdate(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("update_defer_set", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "udfs")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "udfs")
|
||||
issue := bdProxiedCreate(t, bd, p.dir, "Defer set test")
|
||||
|
||||
now := time.Now()
|
||||
|
|
@ -686,7 +731,8 @@ func TestProxiedServerUpdate(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("update_due", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "udu")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "udu")
|
||||
issue := bdProxiedCreate(t, bd, p.dir, "Due test")
|
||||
|
||||
now := time.Now()
|
||||
|
|
@ -705,7 +751,8 @@ func TestProxiedServerUpdate(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("update_estimate", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "ues")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "ues")
|
||||
issue := bdProxiedCreate(t, bd, p.dir, "Estimate test")
|
||||
|
||||
updated := bdProxiedUpdateOne(t, bd, p.dir, issue.ID, "--estimate", "60")
|
||||
|
|
@ -723,7 +770,8 @@ func TestProxiedServerUpdate(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("update_spec_id", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "usp")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "usp")
|
||||
issue := bdProxiedCreate(t, bd, p.dir, "Spec id test")
|
||||
updated := bdProxiedUpdateOne(t, bd, p.dir, issue.ID, "--spec-id", "spec-42")
|
||||
if updated.SpecID != "spec-42" {
|
||||
|
|
@ -732,7 +780,8 @@ func TestProxiedServerUpdate(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("update_external_ref_clear", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "uerc")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "uerc")
|
||||
issue := bdProxiedCreate(t, bd, p.dir, "External ref clear test", "--external-ref", "gh-9")
|
||||
if issue.ExternalRef == nil || *issue.ExternalRef != "gh-9" {
|
||||
t.Fatalf("seed: external_ref not set as expected, got %v", issue.ExternalRef)
|
||||
|
|
@ -745,7 +794,8 @@ func TestProxiedServerUpdate(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("update_external_ref", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "uer")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "uer")
|
||||
issue := bdProxiedCreate(t, bd, p.dir, "External ref test")
|
||||
updated := bdProxiedUpdateOne(t, bd, p.dir, issue.ID, "--external-ref", "gh-9")
|
||||
if updated.ExternalRef == nil {
|
||||
|
|
@ -757,7 +807,8 @@ func TestProxiedServerUpdate(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("update_acceptance", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "uac")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "uac")
|
||||
issue := bdProxiedCreate(t, bd, p.dir, "Acceptance test")
|
||||
|
||||
shortFlag := bdProxiedUpdateOne(t, bd, p.dir, issue.ID, "--acceptance", "via short")
|
||||
|
|
@ -772,7 +823,8 @@ func TestProxiedServerUpdate(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("notes_and_append_conflict", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "una")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "una")
|
||||
issue := bdProxiedCreate(t, bd, p.dir, "Notes conflict test")
|
||||
out := bdProxiedUpdateFail(t, bd, p.dir, issue.ID, "--notes", "a", "--append-notes", "b")
|
||||
if !strings.Contains(out, "cannot specify both --notes and --append-notes") {
|
||||
|
|
@ -781,7 +833,8 @@ func TestProxiedServerUpdate(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("update_notes", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "un")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "un")
|
||||
issue := bdProxiedCreate(t, bd, p.dir, "Notes test", "--notes", "first")
|
||||
updated := bdProxiedUpdateOne(t, bd, p.dir, issue.ID, "--notes", "replacement")
|
||||
if updated.Notes != "replacement" {
|
||||
|
|
@ -790,7 +843,8 @@ func TestProxiedServerUpdate(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("update_design", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "ud")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "ud")
|
||||
issue := bdProxiedCreate(t, bd, p.dir, "Design test")
|
||||
|
||||
flagUpdated := bdProxiedUpdateOne(t, bd, p.dir, issue.ID, "--design", "via flag")
|
||||
|
|
@ -809,7 +863,8 @@ func TestProxiedServerUpdate(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("update_type_custom_table", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "utt")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "utt")
|
||||
issue := bdProxiedCreate(t, bd, p.dir, "Custom type table test")
|
||||
|
||||
db := openProxiedDB(t, p)
|
||||
|
|
@ -825,7 +880,8 @@ func TestProxiedServerUpdate(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("append_notes_concatenates", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "uan")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "uan")
|
||||
issue := bdProxiedCreate(t, bd, p.dir, "Notes", "--notes", "first")
|
||||
updated := bdProxiedUpdateOne(t, bd, p.dir, issue.ID, "--append-notes", "second")
|
||||
want := "first\nsecond"
|
||||
|
|
@ -836,15 +892,17 @@ func TestProxiedServerUpdate(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestProxiedServerUpdateHooks(t *testing.T) {
|
||||
requireProxiedServerEnv(t)
|
||||
requireSharedProxiedServer(t)
|
||||
t.Parallel()
|
||||
bd := buildEmbeddedBD(t)
|
||||
|
||||
t.Run("on_update_fires_on_field_change", func(t *testing.T) {
|
||||
t.Parallel()
|
||||
dir := t.TempDir()
|
||||
markerPath := filepath.Join(dir, "on_update_marker")
|
||||
hookBody := "#!/bin/sh\necho \"$1\" > " + markerPath + "\n"
|
||||
|
||||
p := bdProxiedInitWithHooks(t, bd, "uph", map[string]string{
|
||||
p := newSharedProxiedProjectWithHooks(t, bd, "uph", map[string]string{
|
||||
"on_update": hookBody,
|
||||
})
|
||||
issue := bdProxiedCreate(t, bd, p.dir, "Hook test")
|
||||
|
|
@ -866,11 +924,12 @@ func TestProxiedServerUpdateHooks(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("on_close_fires_when_status_transitions_to_closed", func(t *testing.T) {
|
||||
t.Parallel()
|
||||
dir := t.TempDir()
|
||||
markerPath := filepath.Join(dir, "on_close_marker")
|
||||
hookBody := "#!/bin/sh\necho \"$1\" > " + markerPath + "\n"
|
||||
|
||||
p := bdProxiedInitWithHooks(t, bd, "uphc", map[string]string{
|
||||
p := newSharedProxiedProjectWithHooks(t, bd, "uphc", map[string]string{
|
||||
"on_close": hookBody,
|
||||
})
|
||||
issue := bdProxiedCreate(t, bd, p.dir, "Hook close test")
|
||||
|
|
@ -906,11 +965,13 @@ func waitForMarker(path string, timeout time.Duration) (string, error) {
|
|||
}
|
||||
|
||||
func TestProxiedServerUpdateWisp(t *testing.T) {
|
||||
requireProxiedServerEnv(t)
|
||||
requireSharedProxiedServer(t)
|
||||
t.Parallel()
|
||||
bd := buildEmbeddedBD(t)
|
||||
|
||||
t.Run("wisp_field_update_routes_to_wisps_table", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "uwf")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "uwf")
|
||||
wisp := bdProxiedCreate(t, bd, p.dir, "Wisp field test", "--ephemeral")
|
||||
db := openProxiedDB(t, p)
|
||||
assertRowExists(t, db, "wisps", wisp.ID)
|
||||
|
|
@ -937,7 +998,8 @@ func TestProxiedServerUpdateWisp(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("wisp_status_close_routes_to_wisps_table", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "uws")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "uws")
|
||||
wisp := bdProxiedCreate(t, bd, p.dir, "Wisp close test", "--ephemeral")
|
||||
|
||||
bdProxiedUpdateOne(t, bd, p.dir, wisp.ID, "-s", "closed")
|
||||
|
|
@ -954,7 +1016,8 @@ func TestProxiedServerUpdateWisp(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("wisp_labels_route_to_wisp_labels", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "uwl")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "uwl")
|
||||
wisp := bdProxiedCreate(t, bd, p.dir, "Wisp labels test", "--ephemeral")
|
||||
|
||||
bdProxiedUpdateOne(t, bd, p.dir, wisp.ID, "--add-label", "alpha,beta")
|
||||
|
|
@ -971,7 +1034,8 @@ func TestProxiedServerUpdateWisp(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("wisp_set_labels_diffs_against_wisp_labels", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "uwsl")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "uwsl")
|
||||
wisp := bdProxiedCreate(t, bd, p.dir, "Wisp set-labels test", "--ephemeral")
|
||||
|
||||
bdProxiedUpdateOne(t, bd, p.dir, wisp.ID, "--add-label", "keep,drop")
|
||||
|
|
@ -985,7 +1049,8 @@ func TestProxiedServerUpdateWisp(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("wisp_claim_routes_to_wisps_table", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "uwc")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "uwc")
|
||||
wisp := bdProxiedCreate(t, bd, p.dir, "Wisp claim test", "--ephemeral")
|
||||
|
||||
updated := bdProxiedUpdateOne(t, bd, p.dir, wisp.ID, "--claim", "--actor", "alice")
|
||||
|
|
@ -1008,7 +1073,8 @@ func TestProxiedServerUpdateWisp(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("wisp_reparent_routes_to_wisp_dependencies", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "uwr")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "uwr")
|
||||
parent := bdProxiedCreate(t, bd, p.dir, "Wisp parent", "--ephemeral")
|
||||
child := bdProxiedCreate(t, bd, p.dir, "Wisp child", "--ephemeral")
|
||||
|
||||
|
|
@ -1034,7 +1100,8 @@ func TestProxiedServerUpdateWisp(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("wisp_metadata_routes_to_wisps_table", func(t *testing.T) {
|
||||
p := bdProxiedInit(t, bd, "uwm")
|
||||
t.Parallel()
|
||||
p := newSharedProxiedProject(t, bd, "uwm")
|
||||
wisp := bdProxiedCreate(t, bd, p.dir, "Wisp metadata test", "--ephemeral")
|
||||
|
||||
bdProxiedUpdateOne(t, bd, p.dir, wisp.ID, "--metadata", `{"src":"wisp"}`)
|
||||
|
|
@ -1105,10 +1172,11 @@ func readLabels(t *testing.T, db *sql.DB, table, id string) []string {
|
|||
}
|
||||
|
||||
func TestProxiedServerUpdateConcurrentClaim(t *testing.T) {
|
||||
requireProxiedServerEnv(t)
|
||||
requireSharedProxiedServer(t)
|
||||
t.Parallel()
|
||||
bd := buildEmbeddedBD(t)
|
||||
|
||||
p := bdProxiedInit(t, bd, "ucc")
|
||||
p := newSharedProxiedProject(t, bd, "ucc")
|
||||
issue := bdProxiedCreate(t, bd, p.dir, "Concurrent claim contest")
|
||||
|
||||
const n = 5
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue