Skip to content

fix(cmd): negative or zero parallelism#2114

Open
manishsvk wants to merge 7 commits into
mainfrom
fix/negative-or-zero-parallelism
Open

fix(cmd): negative or zero parallelism#2114
manishsvk wants to merge 7 commits into
mainfrom
fix/negative-or-zero-parallelism

Conversation

@manishsvk

@manishsvk manishsvk commented Jun 17, 2026

Copy link
Copy Markdown

Summary

This change adds a checkParallelism helper so an invalid value is rejected up front with a usage error, before any state file is read or any request is sent to Kong. Valid values (>= 1) are unaffected.

Full changelog

  • [Added checkParallelism helper in cmd/common.go]
  • [Fix for --parallelism < 1 (covers gateway sync, diff, apply and validate commands)]
  • [Updated go-database-reconciler version]
  • [Added unit tests for checkParallelism (zero, negative, positive)]

Issues resolved

Fix #375

Testing

  • Unit tests
  • Manual testing on local gateway instance

The --parallelism flag was passed without validation. A value < 1 would hang or panic: Solve blocks forever on a nil event channel, and the validator either hangs or panics on a negative channel buffer. Added a checkParallelism helper and called it early with a clear usage error.
Adding unit tests for the parallelism fix
@CLAassistant

CLAassistant commented Jun 17, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@codecov-commenter

codecov-commenter commented Jun 17, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 80.00000% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 34.12%. Comparing base (701be42) to head (da3269c).

Files with missing lines Patch % Lines
cmd/gateway_validate.go 50.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2114      +/-   ##
==========================================
+ Coverage   33.17%   34.12%   +0.94%     
==========================================
  Files          78       78              
  Lines        7433     7443      +10     
==========================================
+ Hits         2466     2540      +74     
+ Misses       4763     4669      -94     
- Partials      204      234      +30     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@manishsvk manishsvk changed the title Fix/negative or zero parallelism fixnegative or zero parallelism Jun 17, 2026
@manishsvk manishsvk changed the title fixnegative or zero parallelism fix: negative or zero parallelism Jun 17, 2026
@harshadixit12

Copy link
Copy Markdown
Contributor

LGTM - will approve once CI is fixed

@manishsvk manishsvk changed the title fix: negative or zero parallelism fix(cmd): negative or zero parallelism Jun 17, 2026
harshadixit12
harshadixit12 previously approved these changes Jun 17, 2026
@Prashansa-K

Copy link
Copy Markdown
Contributor

This should have a go.mod update with a new GDR version that has the changes added here:
Kong/go-database-reconciler#483

@harshadixit12

Copy link
Copy Markdown
Contributor

This should have a go.mod update with a new GDR version that has the changes added here: Kong/go-database-reconciler#483

We skipped it because it was not strictly required - it can go with next gdr release IMO

@harshadixit12 harshadixit12 dismissed their stale review June 17, 2026 11:50

let's do the GDR version bump as well

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants