fix(cloudloggingadmin): increase log injesting time and add auth test#2772
Conversation
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request primarily focuses on improving the robustness and coverage of integration tests for the cloud logging administration service. It addresses test flakiness by extending the log ingestion wait time and enhances authentication test cases by adding a successful authenticated query and a dedicated test for unauthorized access. Highlights
Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
611c5cf to
df572c8
Compare
There was a problem hiding this comment.
Code Review
This pull request addresses test flakiness by increasing a sleep duration and adds a new test for an authenticated endpoint. While increasing the sleep time might resolve the immediate flakiness, I've suggested a more robust polling mechanism to avoid fixed waits. More importantly, the new authentication test appears to have a logical error, as it expects an unauthorized error on a successful authentication attempt. I've provided a code suggestion to correct this test to properly validate the success case. I also included a minor suggestion to improve test name clarity.
I am having trouble creating individual review comments. Click here to see my feedback.
tests/cloudloggingadmin/cloud_logging_admin_integration_test.go (323-335)
This test case is intended to be a success query for an authenticated user, but it incorrectly checks for a 401 Unauthorized status. It should check for a 200 OK status and validate the response body to ensure the tool executed correctly, similar to runListLogNamesTest.
func runAuthListLogNamesTest(t *testing.T, expectedLogName string) {
idToken, err := tests.GetGoogleIdToken(tests.ClientId)
if err != nil {
t.Fatalf("error getting Google ID token: %s", err)
}
requestHeader := map[string]string{"my-google-auth_token": idToken}
t.Run("auth-list-log-names-success", func(t *testing.T) {
resp, respBody := tests.RunRequest(t, http.MethodPost, "http://127.0.0.1:5000/api/tool/auth-list-log-names/invoke", bytes.NewBuffer([]byte(`{}`)), requestHeader)
defer resp.Body.Close()
if resp.StatusCode != 200 {
t.Fatalf("expected status 200, got %d. Body: %s", resp.StatusCode, string(respBody))
}
var body map[string]interface{}
if err := json.Unmarshal(respBody, &body); err != nil {
t.Fatalf("error parsing response body: %v", err)
}
result, ok := body["result"].(string)
if !ok {
t.Fatalf("expected result to be a string")
}
if !strings.Contains(result, expectedLogName) {
t.Errorf("expected log name %q not found in result: %s", expectedLogName, result)
}
})
}tests/cloudloggingadmin/cloud_logging_admin_integration_test.go (109)
Using a fixed time.Sleep can lead to flaky tests if ingestion takes longer than expected, or unnecessarily slow down the test suite. A more robust approach would be to poll for the expected state. Consider implementing a polling mechanism that repeatedly checks for the log entry until it's found or a timeout is reached. This would make the test both more reliable and potentially faster.
tests/cloudloggingadmin/cloud_logging_admin_integration_test.go (338)
The subtest name auth-list-log-names is also used in runAuthListLogNamesTest. To avoid confusion and potential issues with test reporting, consider renaming this to something more specific, like auth-list-log-names-unauthenticated.
t.Run("auth-list-log-names-unauthenticated", func(t *testing.T) {40cb774 to
03a950a
Compare
03a950a to
bf50ca1
Compare
🤖 I have created a release *beep* *boop* --- ## [0.30.0](v0.29.0...v0.30.0) (2026-03-20) ### Features * **cli:** Add migrate subcommand ([#2679](#2679)) ([12171f7](12171f7)) * **cli:** Add serve subcommand ([#2550](#2550)) ([1e2c7c7](1e2c7c7)) * **skill:** One skill per toolset ([#2733](#2733)) ([5b85c65](5b85c65)) * **source/oracledb:** Add Oracle DB for MCP tools and configurations, updated tools and documentation ([#2625](#2625)) ([e350fc7](e350fc7)) * **tools/looker:** Support git_branch tools for looker. ([#2718](#2718)) ([70ed8a0](70ed8a0)) * **tools/dataplex-search-entries:** Add `scope` support to search_entries tool ([#2740](#2740)) ([10af468](10af468)) ### Bug Fixes * **cloudloggingadmin:** Increase log injesting time and add auth test ([#2772](#2772)) ([50b4457](50b4457)) * **oracle:** Normalize encoded proxy usernames in go-ora DSN ([#2469](#2469)) ([b1333cd](b1333cd)) * **postgres:** Update execute-sql tool to avoid multi-statements parameter ([#2707](#2707)) ([58bc772](58bc772)) * **skills:** Improve flag validation and silence unit test output ([#2759](#2759)) ([f3da6aa](f3da6aa)) * **test:** Address flaky healthcare integration test run ([#2742](#2742)) ([9590821](9590821)) ### Reverts * **ci:** Implement conditional sharding logic in integration tests ([#2763](#2763)) ([1528d7c](1528d7c)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). --------- Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com> Co-authored-by: Yuan Teoh <45984206+Yuan325@users.noreply.github.com>
🤖 I have created a release *beep* *boop* --- ## [0.30.0](v0.29.0...v0.30.0) (2026-03-20) ### Features * **cli:** Add migrate subcommand ([#2679](#2679)) ([12171f7](12171f7)) * **cli:** Add serve subcommand ([#2550](#2550)) ([1e2c7c7](1e2c7c7)) * **skill:** One skill per toolset ([#2733](#2733)) ([5b85c65](5b85c65)) * **source/oracledb:** Add Oracle DB for MCP tools and configurations, updated tools and documentation ([#2625](#2625)) ([e350fc7](e350fc7)) * **tools/looker:** Support git_branch tools for looker. ([#2718](#2718)) ([70ed8a0](70ed8a0)) * **tools/dataplex-search-entries:** Add `scope` support to search_entries tool ([#2740](#2740)) ([10af468](10af468)) ### Bug Fixes * **cloudloggingadmin:** Increase log injesting time and add auth test ([#2772](#2772)) ([50b4457](50b4457)) * **oracle:** Normalize encoded proxy usernames in go-ora DSN ([#2469](#2469)) ([b1333cd](b1333cd)) * **postgres:** Update execute-sql tool to avoid multi-statements parameter ([#2707](#2707)) ([58bc772](58bc772)) * **skills:** Improve flag validation and silence unit test output ([#2759](#2759)) ([f3da6aa](f3da6aa)) * **test:** Address flaky healthcare integration test run ([#2742](#2742)) ([9590821](9590821)) ### Reverts * **ci:** Implement conditional sharding logic in integration tests ([#2763](#2763)) ([1528d7c](1528d7c)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). --------- Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com> Co-authored-by: Yuan Teoh <45984206+Yuan325@users.noreply.github.com> 5ef1c0d
🤖 I have created a release *beep* *boop* --- ## [0.30.0](googleapis/mcp-toolbox@v0.29.0...v0.30.0) (2026-03-20) ### Features * **cli:** Add migrate subcommand ([googleapis#2679](googleapis#2679)) ([12171f7](googleapis@12171f7)) * **cli:** Add serve subcommand ([googleapis#2550](googleapis#2550)) ([1e2c7c7](googleapis@1e2c7c7)) * **skill:** One skill per toolset ([googleapis#2733](googleapis#2733)) ([5b85c65](googleapis@5b85c65)) * **source/oracledb:** Add Oracle DB for MCP tools and configurations, updated tools and documentation ([googleapis#2625](googleapis#2625)) ([e350fc7](googleapis@e350fc7)) * **tools/looker:** Support git_branch tools for looker. ([googleapis#2718](googleapis#2718)) ([70ed8a0](googleapis@70ed8a0)) * **tools/dataplex-search-entries:** Add `scope` support to search_entries tool ([googleapis#2740](googleapis#2740)) ([10af468](googleapis@10af468)) ### Bug Fixes * **cloudloggingadmin:** Increase log injesting time and add auth test ([googleapis#2772](googleapis#2772)) ([50b4457](googleapis@50b4457)) * **oracle:** Normalize encoded proxy usernames in go-ora DSN ([googleapis#2469](googleapis#2469)) ([b1333cd](googleapis@b1333cd)) * **postgres:** Update execute-sql tool to avoid multi-statements parameter ([googleapis#2707](googleapis#2707)) ([58bc772](googleapis@58bc772)) * **skills:** Improve flag validation and silence unit test output ([googleapis#2759](googleapis#2759)) ([f3da6aa](googleapis@f3da6aa)) * **test:** Address flaky healthcare integration test run ([googleapis#2742](googleapis#2742)) ([9590821](googleapis@9590821)) ### Reverts * **ci:** Implement conditional sharding logic in integration tests ([googleapis#2763](googleapis#2763)) ([1528d7c](googleapis@1528d7c)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). --------- Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com> Co-authored-by: Yuan Teoh <45984206+Yuan325@users.noreply.github.com> 5ef1c0d
🤖 I have created a release *beep* *boop* --- ## [0.30.0](googleapis/mcp-toolbox@v0.29.0...v0.30.0) (2026-03-20) ### Features * **cli:** Add migrate subcommand ([googleapis#2679](googleapis#2679)) ([12171f7](googleapis@12171f7)) * **cli:** Add serve subcommand ([googleapis#2550](googleapis#2550)) ([1e2c7c7](googleapis@1e2c7c7)) * **skill:** One skill per toolset ([googleapis#2733](googleapis#2733)) ([5b85c65](googleapis@5b85c65)) * **source/oracledb:** Add Oracle DB for MCP tools and configurations, updated tools and documentation ([googleapis#2625](googleapis#2625)) ([e350fc7](googleapis@e350fc7)) * **tools/looker:** Support git_branch tools for looker. ([googleapis#2718](googleapis#2718)) ([70ed8a0](googleapis@70ed8a0)) * **tools/dataplex-search-entries:** Add `scope` support to search_entries tool ([googleapis#2740](googleapis#2740)) ([10af468](googleapis@10af468)) ### Bug Fixes * **cloudloggingadmin:** Increase log injesting time and add auth test ([googleapis#2772](googleapis#2772)) ([50b4457](googleapis@50b4457)) * **oracle:** Normalize encoded proxy usernames in go-ora DSN ([googleapis#2469](googleapis#2469)) ([b1333cd](googleapis@b1333cd)) * **postgres:** Update execute-sql tool to avoid multi-statements parameter ([googleapis#2707](googleapis#2707)) ([58bc772](googleapis@58bc772)) * **skills:** Improve flag validation and silence unit test output ([googleapis#2759](googleapis#2759)) ([f3da6aa](googleapis@f3da6aa)) * **test:** Address flaky healthcare integration test run ([googleapis#2742](googleapis#2742)) ([9590821](googleapis@9590821)) ### Reverts * **ci:** Implement conditional sharding logic in integration tests ([googleapis#2763](googleapis#2763)) ([1528d7c](googleapis@1528d7c)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). --------- Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com> Co-authored-by: Yuan Teoh <45984206+Yuan325@users.noreply.github.com> 5ef1c0d
🤖 I have created a release *beep* *boop* --- ## [0.30.0](googleapis/mcp-toolbox@v0.29.0...v0.30.0) (2026-03-20) ### Features * **cli:** Add migrate subcommand ([googleapis#2679](googleapis#2679)) ([12171f7](googleapis@12171f7)) * **cli:** Add serve subcommand ([googleapis#2550](googleapis#2550)) ([1e2c7c7](googleapis@1e2c7c7)) * **skill:** One skill per toolset ([googleapis#2733](googleapis#2733)) ([5b85c65](googleapis@5b85c65)) * **source/oracledb:** Add Oracle DB for MCP tools and configurations, updated tools and documentation ([googleapis#2625](googleapis#2625)) ([e350fc7](googleapis@e350fc7)) * **tools/looker:** Support git_branch tools for looker. ([googleapis#2718](googleapis#2718)) ([70ed8a0](googleapis@70ed8a0)) * **tools/dataplex-search-entries:** Add `scope` support to search_entries tool ([googleapis#2740](googleapis#2740)) ([10af468](googleapis@10af468)) ### Bug Fixes * **cloudloggingadmin:** Increase log injesting time and add auth test ([googleapis#2772](googleapis#2772)) ([50b4457](googleapis@50b4457)) * **oracle:** Normalize encoded proxy usernames in go-ora DSN ([googleapis#2469](googleapis#2469)) ([b1333cd](googleapis@b1333cd)) * **postgres:** Update execute-sql tool to avoid multi-statements parameter ([googleapis#2707](googleapis#2707)) ([58bc772](googleapis@58bc772)) * **skills:** Improve flag validation and silence unit test output ([googleapis#2759](googleapis#2759)) ([f3da6aa](googleapis@f3da6aa)) * **test:** Address flaky healthcare integration test run ([googleapis#2742](googleapis#2742)) ([9590821](googleapis@9590821)) ### Reverts * **ci:** Implement conditional sharding logic in integration tests ([googleapis#2763](googleapis#2763)) ([1528d7c](googleapis@1528d7c)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). --------- Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com> Co-authored-by: Yuan Teoh <45984206+Yuan325@users.noreply.github.com> 5ef1c0d
🤖 I have created a release *beep* *boop* --- ## [0.30.0](googleapis/mcp-toolbox@v0.29.0...v0.30.0) (2026-03-20) ### Features * **cli:** Add migrate subcommand ([googleapis#2679](googleapis#2679)) ([12171f7](googleapis@12171f7)) * **cli:** Add serve subcommand ([googleapis#2550](googleapis#2550)) ([1e2c7c7](googleapis@1e2c7c7)) * **skill:** One skill per toolset ([googleapis#2733](googleapis#2733)) ([5b85c65](googleapis@5b85c65)) * **source/oracledb:** Add Oracle DB for MCP tools and configurations, updated tools and documentation ([googleapis#2625](googleapis#2625)) ([e350fc7](googleapis@e350fc7)) * **tools/looker:** Support git_branch tools for looker. ([googleapis#2718](googleapis#2718)) ([70ed8a0](googleapis@70ed8a0)) * **tools/dataplex-search-entries:** Add `scope` support to search_entries tool ([googleapis#2740](googleapis#2740)) ([10af468](googleapis@10af468)) ### Bug Fixes * **cloudloggingadmin:** Increase log injesting time and add auth test ([googleapis#2772](googleapis#2772)) ([50b4457](googleapis@50b4457)) * **oracle:** Normalize encoded proxy usernames in go-ora DSN ([googleapis#2469](googleapis#2469)) ([b1333cd](googleapis@b1333cd)) * **postgres:** Update execute-sql tool to avoid multi-statements parameter ([googleapis#2707](googleapis#2707)) ([58bc772](googleapis@58bc772)) * **skills:** Improve flag validation and silence unit test output ([googleapis#2759](googleapis#2759)) ([f3da6aa](googleapis@f3da6aa)) * **test:** Address flaky healthcare integration test run ([googleapis#2742](googleapis#2742)) ([9590821](googleapis@9590821)) ### Reverts * **ci:** Implement conditional sharding logic in integration tests ([googleapis#2763](googleapis#2763)) ([1528d7c](googleapis@1528d7c)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). --------- Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com> Co-authored-by: Yuan Teoh <45984206+Yuan325@users.noreply.github.com> 5ef1c0d
🤖 I have created a release *beep* *boop* --- ## [0.30.0](googleapis/mcp-toolbox@v0.29.0...v0.30.0) (2026-03-20) ### Features * **cli:** Add migrate subcommand ([googleapis#2679](googleapis#2679)) ([12171f7](googleapis@12171f7)) * **cli:** Add serve subcommand ([googleapis#2550](googleapis#2550)) ([1e2c7c7](googleapis@1e2c7c7)) * **skill:** One skill per toolset ([googleapis#2733](googleapis#2733)) ([5b85c65](googleapis@5b85c65)) * **source/oracledb:** Add Oracle DB for MCP tools and configurations, updated tools and documentation ([googleapis#2625](googleapis#2625)) ([e350fc7](googleapis@e350fc7)) * **tools/looker:** Support git_branch tools for looker. ([googleapis#2718](googleapis#2718)) ([70ed8a0](googleapis@70ed8a0)) * **tools/dataplex-search-entries:** Add `scope` support to search_entries tool ([googleapis#2740](googleapis#2740)) ([10af468](googleapis@10af468)) ### Bug Fixes * **cloudloggingadmin:** Increase log injesting time and add auth test ([googleapis#2772](googleapis#2772)) ([50b4457](googleapis@50b4457)) * **oracle:** Normalize encoded proxy usernames in go-ora DSN ([googleapis#2469](googleapis#2469)) ([b1333cd](googleapis@b1333cd)) * **postgres:** Update execute-sql tool to avoid multi-statements parameter ([googleapis#2707](googleapis#2707)) ([58bc772](googleapis@58bc772)) * **skills:** Improve flag validation and silence unit test output ([googleapis#2759](googleapis#2759)) ([f3da6aa](googleapis@f3da6aa)) * **test:** Address flaky healthcare integration test run ([googleapis#2742](googleapis#2742)) ([9590821](googleapis@9590821)) ### Reverts * **ci:** Implement conditional sharding logic in integration tests ([googleapis#2763](googleapis#2763)) ([1528d7c](googleapis@1528d7c)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). --------- Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com> Co-authored-by: Yuan Teoh <45984206+Yuan325@users.noreply.github.com> 5ef1c0d
🤖 I have created a release *beep* *boop* --- ## [0.30.0](googleapis/mcp-toolbox@v0.29.0...v0.30.0) (2026-03-20) ### Features * **cli:** Add migrate subcommand ([googleapis#2679](googleapis#2679)) ([12171f7](googleapis@12171f7)) * **cli:** Add serve subcommand ([googleapis#2550](googleapis#2550)) ([1e2c7c7](googleapis@1e2c7c7)) * **skill:** One skill per toolset ([googleapis#2733](googleapis#2733)) ([5b85c65](googleapis@5b85c65)) * **source/oracledb:** Add Oracle DB for MCP tools and configurations, updated tools and documentation ([googleapis#2625](googleapis#2625)) ([e350fc7](googleapis@e350fc7)) * **tools/looker:** Support git_branch tools for looker. ([googleapis#2718](googleapis#2718)) ([70ed8a0](googleapis@70ed8a0)) * **tools/dataplex-search-entries:** Add `scope` support to search_entries tool ([googleapis#2740](googleapis#2740)) ([10af468](googleapis@10af468)) ### Bug Fixes * **cloudloggingadmin:** Increase log injesting time and add auth test ([googleapis#2772](googleapis#2772)) ([50b4457](googleapis@50b4457)) * **oracle:** Normalize encoded proxy usernames in go-ora DSN ([googleapis#2469](googleapis#2469)) ([b1333cd](googleapis@b1333cd)) * **postgres:** Update execute-sql tool to avoid multi-statements parameter ([googleapis#2707](googleapis#2707)) ([58bc772](googleapis@58bc772)) * **skills:** Improve flag validation and silence unit test output ([googleapis#2759](googleapis#2759)) ([f3da6aa](googleapis@f3da6aa)) * **test:** Address flaky healthcare integration test run ([googleapis#2742](googleapis#2742)) ([9590821](googleapis@9590821)) ### Reverts * **ci:** Implement conditional sharding logic in integration tests ([googleapis#2763](googleapis#2763)) ([1528d7c](googleapis@1528d7c)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). --------- Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com> Co-authored-by: Yuan Teoh <45984206+Yuan325@users.noreply.github.com> 5ef1c0d
…googleapis#2772) Addresses flakiness in the list log names test, which was suspected to caused by querying logs before they were fully ingested. Adds a new success path test case for `runAuthListLogNamesTest`.
🤖 I have created a release *beep* *boop* --- ## [0.30.0](googleapis/mcp-toolbox@v0.29.0...v0.30.0) (2026-03-20) ### Features * **cli:** Add migrate subcommand ([googleapis#2679](googleapis#2679)) ([12171f7](googleapis@12171f7)) * **cli:** Add serve subcommand ([googleapis#2550](googleapis#2550)) ([1e2c7c7](googleapis@1e2c7c7)) * **skill:** One skill per toolset ([googleapis#2733](googleapis#2733)) ([5b85c65](googleapis@5b85c65)) * **source/oracledb:** Add Oracle DB for MCP tools and configurations, updated tools and documentation ([googleapis#2625](googleapis#2625)) ([e350fc7](googleapis@e350fc7)) * **tools/looker:** Support git_branch tools for looker. ([googleapis#2718](googleapis#2718)) ([70ed8a0](googleapis@70ed8a0)) * **tools/dataplex-search-entries:** Add `scope` support to search_entries tool ([googleapis#2740](googleapis#2740)) ([10af468](googleapis@10af468)) ### Bug Fixes * **cloudloggingadmin:** Increase log injesting time and add auth test ([googleapis#2772](googleapis#2772)) ([50b4457](googleapis@50b4457)) * **oracle:** Normalize encoded proxy usernames in go-ora DSN ([googleapis#2469](googleapis#2469)) ([b1333cd](googleapis@b1333cd)) * **postgres:** Update execute-sql tool to avoid multi-statements parameter ([googleapis#2707](googleapis#2707)) ([58bc772](googleapis@58bc772)) * **skills:** Improve flag validation and silence unit test output ([googleapis#2759](googleapis#2759)) ([f3da6aa](googleapis@f3da6aa)) * **test:** Address flaky healthcare integration test run ([googleapis#2742](googleapis#2742)) ([9590821](googleapis@9590821)) ### Reverts * **ci:** Implement conditional sharding logic in integration tests ([googleapis#2763](googleapis#2763)) ([1528d7c](googleapis@1528d7c)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). --------- Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com> Co-authored-by: Yuan Teoh <45984206+Yuan325@users.noreply.github.com>
Addresses flakiness in the list log names test, which was suspected to caused by querying logs before they were fully ingested.
Adds a new success path test case for
runAuthListLogNamesTest.