detached 6c2bf1e

test: use minimal ReadinessDelay to speed up tests

Setting ReadinessDelay to 0 defaults to 5s. Use time.Millisecond
instead to bypass the default and run tests instantly.
commit
6c2bf1e88f9ac726c673276b514f4c71bce76753
author
brice · · 2026-01-17 11:42 UTC
parent
94edfa9
signature
unsigned
1 file · +10 -9
M internal/usecase/container/service_test.go +10 -9
@@ -4,6 +4,7 @@ import (
44 "context"
55 "errors"
66 "testing"
7+ "time"
78
89 "github.com/bnema/zerowrap"
910 "github.com/stretchr/testify/assert"
@@ -25,7 +26,7 @@ func TestService_Deploy_Success(t *testing.T) {
2526 config := Config{
2627 NetworkIsolation: false,
2728 VolumeAutoCreate: false,
28- ReadinessDelay: 0, // No delay for tests
29+ ReadinessDelay: time.Millisecond, // Minimal delay for tests
2930 }
3031
3132 svc := NewService(runtime, envLoader, eventBus, nil, config)
@@ -124,7 +125,7 @@ func TestService_Deploy_ReplacesExistingContainer(t *testing.T) {
124125 eventBus := mocks.NewMockEventPublisher(t)
125126
126127 config := Config{
127- ReadinessDelay: 0, // No delay for tests
128+ ReadinessDelay: time.Millisecond, // Minimal delay for tests
128129 }
129130 svc := NewService(runtime, envLoader, eventBus, nil, config)
130131 ctx := testContext()
@@ -199,7 +200,7 @@ func TestService_Deploy_WithNetworkIsolation(t *testing.T) {
199200 config := Config{
200201 NetworkIsolation: true,
201202 NetworkPrefix: "gordon",
202- ReadinessDelay: 0, // No delay for tests
203+ ReadinessDelay: time.Millisecond, // Minimal delay for tests
203204 }
204205 svc := NewService(runtime, envLoader, eventBus, nil, config)
205206 ctx := testContext()
@@ -250,7 +251,7 @@ func TestService_Deploy_WithVolumeAutoCreate(t *testing.T) {
250251 config := Config{
251252 VolumeAutoCreate: true,
252253 VolumePrefix: "gordon",
253- ReadinessDelay: 0, // No delay for tests
254+ ReadinessDelay: time.Millisecond, // Minimal delay for tests
254255 }
255256 svc := NewService(runtime, envLoader, eventBus, nil, config)
256257 ctx := testContext()
@@ -723,7 +724,7 @@ func TestService_Deploy_InternalDeployForcesPull(t *testing.T) {
723724 RegistryPort: 5000,
724725 InternalRegistryUsername: "internal",
725726 InternalRegistryPassword: "secret",
726- ReadinessDelay: 0,
727+ ReadinessDelay: time.Millisecond,
727728 }
728729
729730 svc := NewService(runtime, envLoader, eventBus, nil, config)
@@ -791,7 +792,7 @@ func TestService_AutoStart_StartsNewContainers(t *testing.T) {
791792 eventBus := mocks.NewMockEventPublisher(t)
792793
793794 config := Config{
794- ReadinessDelay: 0,
795+ ReadinessDelay: time.Millisecond,
795796 }
796797 svc := NewService(runtime, envLoader, eventBus, nil, config)
797798 ctx := testContext()
@@ -834,7 +835,7 @@ func TestService_AutoStart_SkipsExistingContainers(t *testing.T) {
834835 eventBus := mocks.NewMockEventPublisher(t)
835836
836837 config := Config{
837- ReadinessDelay: 0,
838+ ReadinessDelay: time.Millisecond,
838839 }
839840 svc := NewService(runtime, envLoader, eventBus, nil, config)
840841 ctx := testContext()
@@ -906,7 +907,7 @@ func TestService_Deploy_OrphanCleanupSkipsTrackedContainer(t *testing.T) {
906907 eventBus := mocks.NewMockEventPublisher(t)
907908
908909 config := Config{
909- ReadinessDelay: 0, // No delay for tests
910+ ReadinessDelay: time.Millisecond, // Minimal delay for tests
910911 }
911912 svc := NewService(runtime, envLoader, eventBus, nil, config)
912913 ctx := testContext()
@@ -990,7 +991,7 @@ func TestService_Deploy_OrphanCleanupRemovesTrueOrphans(t *testing.T) {
990991 eventBus := mocks.NewMockEventPublisher(t)
991992
992993 config := Config{
993- ReadinessDelay: 0, // No delay for tests
994+ ReadinessDelay: time.Millisecond, // Minimal delay for tests
994995 }
995996 svc := NewService(runtime, envLoader, eventBus, nil, config)
996997 ctx := testContext()
@@ -4,6 +4,7 @@ import (
4 "context"4 "context"
5 "errors"5 "errors"
6 "testing"6 "testing"
7+ "time"
7 8
8 "github.com/bnema/zerowrap"9 "github.com/bnema/zerowrap"
9 "github.com/stretchr/testify/assert"10 "github.com/stretchr/testify/assert"
@@ -25,7 +26,7 @@ func TestService_Deploy_Success(t *testing.T) {
25 config := Config{26 config := Config{
26 NetworkIsolation: false,27 NetworkIsolation: false,
27 VolumeAutoCreate: false,28 VolumeAutoCreate: false,
28- ReadinessDelay: 0, // No delay for tests29+ ReadinessDelay: time.Millisecond, // Minimal delay for tests
29 }30 }
30 31
31 svc := NewService(runtime, envLoader, eventBus, nil, config)32 svc := NewService(runtime, envLoader, eventBus, nil, config)
@@ -124,7 +125,7 @@ func TestService_Deploy_ReplacesExistingContainer(t *testing.T) {
124 eventBus := mocks.NewMockEventPublisher(t)125 eventBus := mocks.NewMockEventPublisher(t)
125 126
126 config := Config{127 config := Config{
127- ReadinessDelay: 0, // No delay for tests128+ ReadinessDelay: time.Millisecond, // Minimal delay for tests
128 }129 }
129 svc := NewService(runtime, envLoader, eventBus, nil, config)130 svc := NewService(runtime, envLoader, eventBus, nil, config)
130 ctx := testContext()131 ctx := testContext()
@@ -199,7 +200,7 @@ func TestService_Deploy_WithNetworkIsolation(t *testing.T) {
199 config := Config{200 config := Config{
200 NetworkIsolation: true,201 NetworkIsolation: true,
201 NetworkPrefix: "gordon",202 NetworkPrefix: "gordon",
202- ReadinessDelay: 0, // No delay for tests203+ ReadinessDelay: time.Millisecond, // Minimal delay for tests
203 }204 }
204 svc := NewService(runtime, envLoader, eventBus, nil, config)205 svc := NewService(runtime, envLoader, eventBus, nil, config)
205 ctx := testContext()206 ctx := testContext()
@@ -250,7 +251,7 @@ func TestService_Deploy_WithVolumeAutoCreate(t *testing.T) {
250 config := Config{251 config := Config{
251 VolumeAutoCreate: true,252 VolumeAutoCreate: true,
252 VolumePrefix: "gordon",253 VolumePrefix: "gordon",
253- ReadinessDelay: 0, // No delay for tests254+ ReadinessDelay: time.Millisecond, // Minimal delay for tests
254 }255 }
255 svc := NewService(runtime, envLoader, eventBus, nil, config)256 svc := NewService(runtime, envLoader, eventBus, nil, config)
256 ctx := testContext()257 ctx := testContext()
@@ -723,7 +724,7 @@ func TestService_Deploy_InternalDeployForcesPull(t *testing.T) {
723 RegistryPort: 5000,724 RegistryPort: 5000,
724 InternalRegistryUsername: "internal",725 InternalRegistryUsername: "internal",
725 InternalRegistryPassword: "secret",726 InternalRegistryPassword: "secret",
726- ReadinessDelay: 0,727+ ReadinessDelay: time.Millisecond,
727 }728 }
728 729
729 svc := NewService(runtime, envLoader, eventBus, nil, config)730 svc := NewService(runtime, envLoader, eventBus, nil, config)
@@ -791,7 +792,7 @@ func TestService_AutoStart_StartsNewContainers(t *testing.T) {
791 eventBus := mocks.NewMockEventPublisher(t)792 eventBus := mocks.NewMockEventPublisher(t)
792 793
793 config := Config{794 config := Config{
794- ReadinessDelay: 0,795+ ReadinessDelay: time.Millisecond,
795 }796 }
796 svc := NewService(runtime, envLoader, eventBus, nil, config)797 svc := NewService(runtime, envLoader, eventBus, nil, config)
797 ctx := testContext()798 ctx := testContext()
@@ -834,7 +835,7 @@ func TestService_AutoStart_SkipsExistingContainers(t *testing.T) {
834 eventBus := mocks.NewMockEventPublisher(t)835 eventBus := mocks.NewMockEventPublisher(t)
835 836
836 config := Config{837 config := Config{
837- ReadinessDelay: 0,838+ ReadinessDelay: time.Millisecond,
838 }839 }
839 svc := NewService(runtime, envLoader, eventBus, nil, config)840 svc := NewService(runtime, envLoader, eventBus, nil, config)
840 ctx := testContext()841 ctx := testContext()
@@ -906,7 +907,7 @@ func TestService_Deploy_OrphanCleanupSkipsTrackedContainer(t *testing.T) {
906 eventBus := mocks.NewMockEventPublisher(t)907 eventBus := mocks.NewMockEventPublisher(t)
907 908
908 config := Config{909 config := Config{
909- ReadinessDelay: 0, // No delay for tests910+ ReadinessDelay: time.Millisecond, // Minimal delay for tests
910 }911 }
911 svc := NewService(runtime, envLoader, eventBus, nil, config)912 svc := NewService(runtime, envLoader, eventBus, nil, config)
912 ctx := testContext()913 ctx := testContext()
@@ -990,7 +991,7 @@ func TestService_Deploy_OrphanCleanupRemovesTrueOrphans(t *testing.T) {
990 eventBus := mocks.NewMockEventPublisher(t)991 eventBus := mocks.NewMockEventPublisher(t)
991 992
992 config := Config{993 config := Config{
993- ReadinessDelay: 0, // No delay for tests994+ ReadinessDelay: time.Millisecond, // Minimal delay for tests
994 }995 }
995 svc := NewService(runtime, envLoader, eventBus, nil, config)996 svc := NewService(runtime, envLoader, eventBus, nil, config)
996 ctx := testContext()997 ctx := testContext()

Keyboard shortcuts

Single-key shortcuts are on. ctrl k and esc work whatever this says.

ctrl k :
go to a section, branch, tag, file or repository
?
this list
j k
move the row cursor down / up
enter
open the row under the cursor; on Files, a directory opens or closes in place
↑ ↓ ← → home end
in the file tree (focus on a row): previous / next row, close / open a directory or go to its parent / first entry, first / last row. They never open a file
l h
on Files: open a directory or a file / close a directory or go up to its parent, then to the parent page. Elsewhere: into the side panel (on a merge request, its files) / back to the content; there j k move between its controls
g g G
first / last row
/
filter the list; on Files, find a file anywhere in the repository (esc clears, enter opens the best match)
b
switch branch or tag
g s g f g c g b g m g i g r g a
tabs: summary, files, commits, branches & tags, merge requests, issues, releases, actions (when available)
g h
home
w
wide mode: use the whole width of the screen, or not (remembered)
y
copy a permalink pinned to the commit
d u x
diff: split / unified / collapse or expand all
e E
diff: the whole file in view / every file, with the lines the hunks hide
n
merge request: next note in the diff
esc
close a dialog, leave a field

Branches 7

Tags 106

↑↓ moveenter openesc close