Optimize test suite with testing.Short() guards
- Add Short() guards to slow CLI tests (2-4s each) - Add Short() guards to slow API/integration tests (3-11s) - Add Short() guard to hanging daemon discovery test (29s timeout) - Short test suite now runs in ~6s (down from 5+ minutes) Run 'go test -short ./...' for fast iteration Run 'go test ./...' for full coverage Closes: bd-iov0
This commit is contained in:
@@ -22,6 +22,9 @@ func setupCLITestDB(t *testing.T) string {
|
||||
}
|
||||
|
||||
func TestCLI_Ready(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping slow CLI test in short mode")
|
||||
}
|
||||
t.Parallel()
|
||||
tmpDir := setupCLITestDB(t)
|
||||
runBD(t, tmpDir, "create", "Ready issue", "-p", "1")
|
||||
@@ -32,6 +35,9 @@ func TestCLI_Ready(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestCLI_Create(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping slow CLI test in short mode")
|
||||
}
|
||||
t.Parallel()
|
||||
tmpDir := setupCLITestDB(t)
|
||||
out := runBD(t, tmpDir, "create", "Test issue", "-p", "1", "--json")
|
||||
@@ -46,6 +52,9 @@ func TestCLI_Create(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestCLI_List(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping slow CLI test in short mode")
|
||||
}
|
||||
t.Parallel()
|
||||
tmpDir := setupCLITestDB(t)
|
||||
runBD(t, tmpDir, "create", "First", "-p", "1")
|
||||
@@ -62,6 +71,9 @@ func TestCLI_List(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestCLI_Update(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping slow CLI test in short mode")
|
||||
}
|
||||
t.Parallel()
|
||||
tmpDir := setupCLITestDB(t)
|
||||
out := runBD(t, tmpDir, "create", "Issue to update", "-p", "1", "--json")
|
||||
@@ -81,6 +93,9 @@ func TestCLI_Update(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestCLI_Close(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping slow CLI test in short mode")
|
||||
}
|
||||
t.Parallel()
|
||||
tmpDir := setupCLITestDB(t)
|
||||
out := runBD(t, tmpDir, "create", "Issue to close", "-p", "1", "--json")
|
||||
@@ -100,6 +115,9 @@ func TestCLI_Close(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestCLI_DepAdd(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping slow CLI test in short mode")
|
||||
}
|
||||
t.Parallel()
|
||||
tmpDir := setupCLITestDB(t)
|
||||
|
||||
@@ -120,6 +138,9 @@ func TestCLI_DepAdd(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestCLI_DepRemove(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping slow CLI test in short mode")
|
||||
}
|
||||
t.Parallel()
|
||||
tmpDir := setupCLITestDB(t)
|
||||
|
||||
@@ -141,6 +162,9 @@ func TestCLI_DepRemove(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestCLI_DepTree(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping slow CLI test in short mode")
|
||||
}
|
||||
t.Parallel()
|
||||
tmpDir := setupCLITestDB(t)
|
||||
|
||||
@@ -162,6 +186,9 @@ func TestCLI_DepTree(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestCLI_Blocked(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping slow CLI test in short mode")
|
||||
}
|
||||
t.Parallel()
|
||||
tmpDir := setupCLITestDB(t)
|
||||
|
||||
@@ -183,6 +210,9 @@ func TestCLI_Blocked(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestCLI_Stats(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping slow CLI test in short mode")
|
||||
}
|
||||
t.Parallel()
|
||||
tmpDir := setupCLITestDB(t)
|
||||
runBD(t, tmpDir, "create", "Issue 1", "-p", "1")
|
||||
@@ -195,6 +225,9 @@ func TestCLI_Stats(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestCLI_Show(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping slow CLI test in short mode")
|
||||
}
|
||||
t.Parallel()
|
||||
tmpDir := setupCLITestDB(t)
|
||||
out := runBD(t, tmpDir, "create", "Show test", "-p", "1", "--json")
|
||||
@@ -210,6 +243,9 @@ func TestCLI_Show(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestCLI_Export(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping slow CLI test in short mode")
|
||||
}
|
||||
t.Parallel()
|
||||
tmpDir := setupCLITestDB(t)
|
||||
runBD(t, tmpDir, "create", "Export test", "-p", "1")
|
||||
@@ -223,6 +259,9 @@ func TestCLI_Export(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestCLI_Import(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping slow CLI test in short mode")
|
||||
}
|
||||
t.Parallel()
|
||||
tmpDir := setupCLITestDB(t)
|
||||
runBD(t, tmpDir, "create", "Import test", "-p", "1")
|
||||
|
||||
Reference in New Issue
Block a user