-
Notifications
You must be signed in to change notification settings - Fork 498
Fix Timeout type drift between BoundedQueriesConfig and AWFBoundedQueriesConfig #53694
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -201,7 +201,8 @@ func TestExtractBoundedQueriesConfig(t *testing.T) { | |
| require.NotNil(t, got) | ||
| assert.True(t, got.Enabled) | ||
| assert.Equal(t, BoundedQueryRuntimeDocker, got.Runtime) | ||
| assert.Equal(t, 30, got.Timeout) | ||
| require.NotNil(t, got.Timeout) | ||
| assert.Equal(t, 30, *got.Timeout) | ||
| assert.Equal(t, "512m", got.MemoryLimit) | ||
| assert.Equal(t, "python3", got.Interpreter) | ||
| assert.Equal(t, 32, got.MaxInvocations) | ||
|
|
@@ -228,8 +229,8 @@ func TestExtractBoundedQueriesConfig(t *testing.T) { | |
|
|
||
| got := extractBoundedQueriesConfig(data) | ||
| require.NotNil(t, got) | ||
| assert.Equal(t, 0, got.Timeout, "timeout must be zero (omitted) when not set") | ||
| assert.Equal(t, 0, got.MaxInvocations, "max-invocations must be zero (omitted) when not set") | ||
| assert.Nil(t, got.Timeout, "timeout must be nil (omitted) when not set") | ||
| }) | ||
| } | ||
|
|
||
|
|
@@ -606,7 +607,7 @@ func TestAWFBoundedQueriesJSONRoundtrip(t *testing.T) { | |
| {Repo: "my-org/sealed-service", Sensitivity: "sealed"}, | ||
| }, | ||
| Runtime: BoundedQueryRuntimeSbx, | ||
| Timeout: 30, | ||
| Timeout: new(30), | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [/diagnosing-bugs] 💡 Suggested fixUse an address-of with a temporary variable, consistent with timeout := 30
Timeout: &timeout,Or add a small package-level helper (as done in ptr := func(n int) *int { return &n }
// ...
Timeout: ptr(30),Note: @copilot please address this. |
||
| MemoryLimit: "512m", | ||
| Interpreter: "python3", | ||
| MaxInvocations: 32, | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
new(30)is not valid Go —newtakes a type, not a value. This will fail to compile.Use a local variable or a helper instead:
@copilot please address this.