detached fe58985

refactor: address CodeRabbit review nitpicks

- Remove unused containerConfig parameter from resolveContainerEndpoint
  and update both call sites in readinessCascade
- Add t.Logf in TestTCPProbe_DelayedListener to surface re-listen
  failures instead of silently swallowing them
- Times(5) for IsContainerRunning in concurrent test is correct:
  2x per deploy (pollContainerRunning + waitForReadyByDelay) + 1x
  stabilization for the second deploy = 5 total; left as-is
commit
fe5898575cce58e4f1b6e78402d54d0cdf1292d5
author
brice · · 2026-03-03 03:47 UTC
parent
6cba420
signature
unsigned
2 files · +4 -3
M internal/usecase/container/readiness_test.go +1 -0
@@ -63,6 +63,7 @@ func TestTCPProbe_DelayedListener(t *testing.T) {
6363 time.Sleep(time.Second)
6464 newLn, err := net.Listen("tcp", addr)
6565 if err != nil {
66+ t.Logf("delayed listener failed to bind: %v", err)
6667 return
6768 }
6869 defer newLn.Close()
@@ -63,6 +63,7 @@ func TestTCPProbe_DelayedListener(t *testing.T) {
63 time.Sleep(time.Second)63 time.Sleep(time.Second)
64 newLn, err := net.Listen("tcp", addr)64 newLn, err := net.Listen("tcp", addr)
65 if err != nil {65 if err != nil {
66+ t.Logf("delayed listener failed to bind: %v", err)
66 return67 return
67 }68 }
68 defer newLn.Close()69 defer newLn.Close()
M internal/usecase/container/service.go +3 -3
@@ -2288,7 +2288,7 @@ func (s *Service) readinessCascade(ctx context.Context, containerID string, cont
22882288 // 2. HTTP probe via gordon.health label
22892289 if containerConfig != nil {
22902290 if healthPath, ok := containerConfig.Labels[domain.LabelHealth]; ok && healthPath != "" {
2291- ip, port, probeErr := s.resolveContainerEndpoint(ctx, containerID, containerConfig)
2291+ ip, port, probeErr := s.resolveContainerEndpoint(ctx, containerID)
22922292 if probeErr == nil && ip != "" && port > 0 {
22932293 url := fmt.Sprintf("http://%s:%d%s", ip, port, healthPath)
22942294 timeout := cfg.HTTPProbeTimeout
@@ -2305,7 +2305,7 @@ func (s *Service) readinessCascade(ctx context.Context, containerID string, cont
23052305
23062306 // 3. TCP probe (if port info available)
23072307 if containerConfig != nil && len(containerConfig.Ports) > 0 {
2308- ip, port, probeErr := s.resolveContainerEndpoint(ctx, containerID, containerConfig)
2308+ ip, port, probeErr := s.resolveContainerEndpoint(ctx, containerID)
23092309 if probeErr == nil && ip != "" && port > 0 {
23102310 addr := fmt.Sprintf("%s:%d", ip, port)
23112311 timeout := cfg.TCPProbeTimeout
@@ -2326,7 +2326,7 @@ func (s *Service) readinessCascade(ctx context.Context, containerID string, cont
23262326
23272327 // resolveContainerEndpoint retrieves the container's IP and first port via
23282328 // GetContainerNetworkInfo. The result can be used for HTTP or TCP probes.
2329-func (s *Service) resolveContainerEndpoint(ctx context.Context, containerID string, containerConfig *domain.ContainerConfig) (string, int, error) {
2329+func (s *Service) resolveContainerEndpoint(ctx context.Context, containerID string) (string, int, error) {
23302330 ip, port, err := s.runtime.GetContainerNetworkInfo(ctx, containerID)
23312331 if err != nil {
23322332 return "", 0, err
@@ -2288,7 +2288,7 @@ func (s *Service) readinessCascade(ctx context.Context, containerID string, cont
2288 // 2. HTTP probe via gordon.health label2288 // 2. HTTP probe via gordon.health label
2289 if containerConfig != nil {2289 if containerConfig != nil {
2290 if healthPath, ok := containerConfig.Labels[domain.LabelHealth]; ok && healthPath != "" {2290 if healthPath, ok := containerConfig.Labels[domain.LabelHealth]; ok && healthPath != "" {
2291- ip, port, probeErr := s.resolveContainerEndpoint(ctx, containerID, containerConfig)2291+ ip, port, probeErr := s.resolveContainerEndpoint(ctx, containerID)
2292 if probeErr == nil && ip != "" && port > 0 {2292 if probeErr == nil && ip != "" && port > 0 {
2293 url := fmt.Sprintf("http://%s:%d%s", ip, port, healthPath)2293 url := fmt.Sprintf("http://%s:%d%s", ip, port, healthPath)
2294 timeout := cfg.HTTPProbeTimeout2294 timeout := cfg.HTTPProbeTimeout
@@ -2305,7 +2305,7 @@ func (s *Service) readinessCascade(ctx context.Context, containerID string, cont
2305 2305
2306 // 3. TCP probe (if port info available)2306 // 3. TCP probe (if port info available)
2307 if containerConfig != nil && len(containerConfig.Ports) > 0 {2307 if containerConfig != nil && len(containerConfig.Ports) > 0 {
2308- ip, port, probeErr := s.resolveContainerEndpoint(ctx, containerID, containerConfig)2308+ ip, port, probeErr := s.resolveContainerEndpoint(ctx, containerID)
2309 if probeErr == nil && ip != "" && port > 0 {2309 if probeErr == nil && ip != "" && port > 0 {
2310 addr := fmt.Sprintf("%s:%d", ip, port)2310 addr := fmt.Sprintf("%s:%d", ip, port)
2311 timeout := cfg.TCPProbeTimeout2311 timeout := cfg.TCPProbeTimeout
@@ -2326,7 +2326,7 @@ func (s *Service) readinessCascade(ctx context.Context, containerID string, cont
2326 2326
2327 // resolveContainerEndpoint retrieves the container's IP and first port via2327 // resolveContainerEndpoint retrieves the container's IP and first port via
2328 // GetContainerNetworkInfo. The result can be used for HTTP or TCP probes.2328 // GetContainerNetworkInfo. The result can be used for HTTP or TCP probes.
2329-func (s *Service) resolveContainerEndpoint(ctx context.Context, containerID string, containerConfig *domain.ContainerConfig) (string, int, error) {2329+func (s *Service) resolveContainerEndpoint(ctx context.Context, containerID string) (string, int, error) {
2330 ip, port, err := s.runtime.GetContainerNetworkInfo(ctx, containerID)2330 ip, port, err := s.runtime.GetContainerNetworkInfo(ctx, containerID)
2331 if err != nil {2331 if err != nil {
2332 return "", 0, err2332 return "", 0, err

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