Skip to content

Add omclickhouse CI workflow backed by ClickHouse container#127

Open
rgerhards wants to merge 11 commits intomainfrom
codex/create-github-actions-workflow-for-omclickhouse
Open

Add omclickhouse CI workflow backed by ClickHouse container#127
rgerhards wants to merge 11 commits intomainfrom
codex/create-github-actions-workflow-for-omclickhouse

Conversation

@rgerhards
Copy link
Owner

Summary

  • add a GitHub Actions workflow that spins up a ClickHouse service and runs the omclickhouse test suite
  • add reusable ClickHouse helpers to the testbench so the omclickhouse scripts can target external clients and HTTP defaults
  • adjust the omclickhouse tests and preparation tooling to consume the helpers and support container-managed databases

Testing

  • not run (not requested)

https://chatgpt.com/codex/tasks/task_e_68d91a4937008332ae338a83c9f0ec97

- add an omclickhouse CI workflow backed by a ClickHouse service container
- add ClickHouse helpers to diag.sh and reuse them across omclickhouse tests
- adjust the ClickHouse tests and tooling for external clients and HTTP defaults

AI-Agent: ChatGPT
@gemini-code-assist
Copy link

Summary of Changes

Hello @rgerhards, 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 significantly enhances the testing infrastructure for the omclickhouse plugin by integrating a new GitHub Actions CI workflow. The core change involves refactoring the testbench to use a containerized ClickHouse instance and introducing helper functions that abstract away direct clickhouse-client commands, making the tests more robust, flexible, and easier to manage across different environments.

Highlights

  • New CI Workflow: Introduced a GitHub Actions workflow to run the omclickhouse test suite, backed by a ClickHouse container.
  • Testbench Helpers: Added reusable ClickHouse helper functions to the testbench, enabling omclickhouse scripts to target external clients and configure HTTP defaults dynamically.
  • Test Adaptability: Adjusted existing omclickhouse tests and preparation tooling to leverage the new helpers and support container-managed ClickHouse databases.
Ignored Files
  • Ignored by pattern: .github/workflows/** (1)
    • .github/workflows/omclickhouse.yml
Using Gemini Code Assist

The 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 /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

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

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a CI workflow for omclickhouse using a containerized ClickHouse instance, which is a great improvement for testing. The changes involve refactoring the test scripts to use new helper functions in diag.sh, making them more flexible and configurable for different environments. The refactoring of test configurations using heredocs is a nice cleanup.

My review focuses on shell scripting best practices and potential security improvements. I've pointed out the use of eval, which can be risky, and a bug related to its unquoted use. I've also suggested a minor improvement for robustness in one of the new helper functions. Overall, the changes are well-structured and achieve the goal of improving the test setup.

#wait_startup_pid /var/run/clickhouse-server/clickhouse-server.pid
if [ -n "$CLICKHOUSE_START_CMD" ]; then
printf 'starting clickhouse...\n'
eval "$CLICKHOUSE_START_CMD" &

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Using eval can be a security risk as it executes arbitrary code from the CLICKHOUSE_START_CMD variable. While this might be acceptable in a controlled CI environment, it's a good practice to avoid it if possible. If CLICKHOUSE_START_CMD is expected to be a simple command with arguments, consider splitting it into an array to execute it more safely, similar to how CLICKHOUSE_CLIENT is handled in _clickhouse_exec.

Comment on lines +101 to +103
if [ "$1" == "" ]; then
printf 'TESTBENCH_ERROR: clickhouse_query requires a SQL statement\n'
error_exit 100

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

For checking if a string is empty, it's more robust and conventional in shell scripting to use [ -z "$1" ] instead of [ "$1" == "" ]. This is a minor improvement for robustness and adherence to common shell scripting practices.

Suggested change
if [ "$1" == "" ]; then
printf 'TESTBENCH_ERROR: clickhouse_query requires a SQL statement\n'
error_exit 100
if [ -z "$1" ]; then
printf 'TESTBENCH_ERROR: clickhouse_query requires a SQL statement\n'
error_exit 100

- revert the direct config writes and use add_conf so the testbench instrumentation runs while keeping the new ClickHouse helper parameters in place\n\nAI-Agent: Codex
## Summary
- explain why libuuid stays disabled in the omclickhouse workflow so CI runs without the dependency.

## Testing
- not run (not requested)

AI-Agent: Codex
Switch the ClickHouse GitHub Actions job to run autoreconf directly so the job can pass custom configure options without pulling libuuid via autogen.sh.

AI-Agent: ChatGPT
Adopt the run_codecov_base.yml configure matrix so the ClickHouse CI job builds with the full option set while explicitly enabling the module and disabling uuid to avoid the dependency.

AI-Agent: ChatGPT
## Summary
- poll ClickHouse readiness before preparing the test database and skip the suite when no endpoint is reachable
- run the preparation helper via env so docker-exec based clients are honoured and guard the database drop step
- make the prepare script idempotent by ignoring existing databases and failing fast when the client command errors

## Testing
- not run (missing ClickHouse service in container)

AI-Agent: Codex
The ClickHouse action helper defaulted to HTTPS, which broke the shell\ntests because the ClickHouse service provided in CI only exposes HTTP on\nport 8123. Restore the previous behaviour by defaulting the helper back\nto HTTP so existing scenarios connect successfully.\n\nAI-Agent: ChatGPT
* convert the TabSeparated EXPECTED strings to use real tab characters so they match ClickHouse 25.9.2.1 output\n* note in the scripts that the tabular and CSV expectations were validated with clickhouse local 25.9.2.1\n\nAI-Agent: Codex
- cache clickhouse readiness in the testbench and gate data-driven scenarios\n- let availability-sensitive tests skip individually while mock checks keep running\n- update the omclickhouse workflow yaml header so Actions picks it up\n\nAI-Agent: ChatGPT
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant