Skip to content

fix(ping): correct flag default and bind pflags to viper#4543

Open
bosiakov wants to merge 1 commit intoagones-dev:mainfrom
bosiakov:fix/ping-flag-bugs
Open

fix(ping): correct flag default and bind pflags to viper#4543
bosiakov wants to merge 1 commit intoagones-dev:mainfrom
bosiakov:fix/ping-flag-bugs

Conversation

@bosiakov
Copy link
Copy Markdown

What this PR does / Why we need it:

Fixes two bugs in cmd/ping/main.go's command-line flag handling:

  1. The --udp-rate-limit flag was reading its default from httpResponseFlag (a string flag defaulting to "ok"). viper.GetFloat64("ok") returns 0, so the documented default of 20 never took effect — the actual default was 0.
  2. parseEnvFlags called pflag.Parse() but never invoked viper.BindPFlags(pflag.CommandLine), so values passed on the command line (--http-response=..., --udp-rate-limit=...) were parsed and then silently dropped — only the viper defaults and the bound env vars surfaced in the resulting config.

The fix mirrors the pattern used by every other cmd/*/main.go (allocator, controller, extensions, processor, sdk-server), all of which call runtime.Must(viper.BindPFlags(pflag.CommandLine)) after their BindEnv calls.

Signed-off-by: Eugene <eugenebosyakov@gmail.com>
@lacroixthomas
Copy link
Copy Markdown
Collaborator

Oh nice catch !

@lacroixthomas
Copy link
Copy Markdown
Collaborator

/gcbrun

@agones-bot
Copy link
Copy Markdown
Collaborator

Build Failed 😭

Build Id: b0f86c9f-3b60-42a4-88f4-80a3d5a110c7

Status: FAILURE

To get permission to view the Cloud Build view, join the agones-discuss Google Group.

@lacroixthomas
Copy link
Copy Markdown
Collaborator

lacroixthomas commented Apr 30, 2026

/gcbrun

It's a flaky test, probably not related
Just to keep track of it:

Step #2 - "e2e-stable": VERBOSE: time="2026-04-30 00:15:04.616" level=info msg="GameServer Ready" gs=game-serversnvw2
Step #2 - "e2e-stable": VERBOSE:     gameserver_test.go:1055: 
Step #2 - "e2e-stable": VERBOSE:         	Error Trace:	/go/src/agones.dev/agones/test/e2e/gameserver_test.go:1055
Step #2 - "e2e-stable": VERBOSE:         	Error:      	Received unexpected error:
Step #2 - "e2e-stable": VERBOSE:         	            	dial tcp 34.74.214.65:7579: connect: connection refused
Step #2 - "e2e-stable": VERBOSE:         	Test:       	TestGameServerTcpProtocol
Step #2 - "e2e-stable": VERBOSE: --- FAIL: TestGameServerTcpProtocol (3.23s)

@agones-bot
Copy link
Copy Markdown
Collaborator

Build Failed 😭

Build Id: a99bfb73-7a8b-4dd6-b41e-3576f762e7ed

Status: FAILURE

To get permission to view the Cloud Build view, join the agones-discuss Google Group.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants