beads/cmd/bd/reopen_defer_test.go
Julian Knutsen 9e8d411f71
Add PR CI wrapper command surface (#4211)
* ci: add PR wrapper command surface

* ci: collect wrapper timing in PR checks

* docs: record initial CI wrapper measurements

* ci: add manual measurement workflow

* ci: allow branch measurement dispatch

* ci: keep measuring independent commands after failures

* docs: record branch-dispatched CI measurement

* ci: keep measuring package suites after failures

* docs: record CI measurement batch

* fix: repair CI-measured test failures

* test: make local Go gates hermetic

* ci: add sharded integration measurement lane

* test: fix internal beads integration TestMain

* docs: record fixed integration shard measurement

* ci: add hybrid integration sharding measurement

* ci: speed up cmd/bd test shard discovery

* ci: add 16-way integration sharding measurement

* ci: measure prebuilt cmd bd sharding

* docs: record prebuilt sharding measurement

* docs: design CI build artifact stage

* docs: record repeat prebuilt integration measurement

* ci: add build artifact stage

* ci: reuse build artifact in linux test lane

* ci: promote main linux integration shards

* ci: gate legacy platform tests to main

* ci: satisfy workflow shell lint

* ci: ignore archived migrations in duplicate check

* ci: add package gate wrappers

* test: clean up testing short boundaries

* ci: allow unreleased version docs lag

* ci: gate releases on package checks

* ci: split workflow by tier

* ci: add aggregate PR gates
2026-05-29 18:52:53 -07:00

72 lines
1.9 KiB
Go

// reopen_defer_test.go - Test that reopen clears defer_until.
//go:build cgo && integration
package main
import (
"encoding/json"
"os"
"os/exec"
"testing"
)
// TestCLI_ReopenClearsDeferUntil tests that reopening a deferred+closed issue
// clears defer_until so the issue appears in bd ready immediately.
//
// This documents the decision: reopen means "I want to work on this NOW",
// so defer_until is cleared.
func TestCLI_ReopenClearsDeferUntil(t *testing.T) {
if testDoltServerPort == 0 {
t.Skip("skipping: Dolt test container not available")
}
tmpDir := initExecTestDB(t)
id := createExecTestIssue(t, tmpDir, "Deferred then reopened")
// Defer the issue to far future
cmd := exec.Command(testBD, "update", id, "--defer", "+8760h") // 1 year
cmd.Dir = tmpDir
cmd.Env = os.Environ()
if out, err := cmd.CombinedOutput(); err != nil {
t.Fatalf("defer failed: %v\n%s", err, out)
}
// Close it
cmd = exec.Command(testBD, "close", id)
cmd.Dir = tmpDir
cmd.Env = os.Environ()
if out, err := cmd.CombinedOutput(); err != nil {
t.Fatalf("close failed: %v\n%s", err, out)
}
// Reopen it
cmd = exec.Command(testBD, "reopen", id)
cmd.Dir = tmpDir
cmd.Env = os.Environ()
if out, err := cmd.CombinedOutput(); err != nil {
t.Fatalf("reopen failed: %v\n%s", err, out)
}
// Verify defer_until is cleared
cmd = exec.Command(testBD, "show", id, "--json")
cmd.Dir = tmpDir
cmd.Env = os.Environ()
out, err := cmd.CombinedOutput()
if err != nil {
t.Fatalf("show failed: %v\n%s", err, out)
}
var issues []map[string]interface{}
json.Unmarshal(out, &issues)
if len(issues) == 0 {
t.Fatalf("show returned no issues")
}
issue := issues[0]
if issue["status"] != "open" {
t.Errorf("expected status=open after reopen, got: %v", issue["status"])
}
if deferUntil, ok := issue["defer_until"]; ok && deferUntil != nil && deferUntil != "" {
t.Errorf("expected defer_until to be cleared after reopen, got: %v", deferUntil)
}
}