Skip to content

Add local server state machine subprocess tests - #521

Closed
sdairs wants to merge 2 commits into
issue-478-local-lifecycle-helpfrom
issue-479-local-server-state-machine-tests
Closed

Add local server state machine subprocess tests#521
sdairs wants to merge 2 commits into
issue-478-local-lifecycle-helpfrom
issue-479-local-server-state-machine-tests

Conversation

@sdairs

@sdairs sdairs commented Aug 24, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • add one table-driven real-binary suite for the complete project-local ClickHouse server state machine
  • cover fresh, default, generated-name, custom-only, multi-server, and exact-CWD root/child transitions
  • assert structured output and errors together with metadata, process liveness, and data-directory state in isolated temporary HOME and project directories
  • disable telemetry and seed the temporary update cache so the suite does not touch user state or depend on network access

Closes #479

Tests

  • cargo test -p clickhousectl --test local_server_state_machine_test (4 consecutive corrected runs; 25.29s-25.53s)
  • cargo test -p clickhousectl (639 unit tests plus all integration suites)
  • cargo fmt --all --check
  • cargo clippy -p clickhousectl --all-targets -- -D warnings

Stack

@sdairs sdairs changed the title issue 479 local server state machine tests Add local server state machine subprocess tests Aug 24, 2026
@sdairs
sdairs force-pushed the issue-478-local-lifecycle-help branch from 8eabc0c to f168202 Compare August 25, 2026 12:11
@sdairs
sdairs force-pushed the issue-479-local-server-state-machine-tests branch from 8f574d6 to 1e87a7e Compare August 25, 2026 12:11
@sdairs

sdairs commented Aug 25, 2026

Copy link
Copy Markdown
Collaborator Author

Addressed the latest fixture feedback in 4f89979.

The state-machine fixture now installs and selects a fake latest default. Starts use that fake default instead of invoking floating --version latest, retaining deterministic behavior without real network resolution.

Verified with:

  • cargo test -p clickhousectl --test local_server_state_machine_test
  • cargo fmt --all --check
  • cargo check -p clickhousectl --test local_server_state_machine_test
  • cargo clippy -p clickhousectl --test local_server_state_machine_test -- -D warnings

@sdairs
sdairs force-pushed the issue-479-local-server-state-machine-tests branch from 4f89979 to e9fb2cf Compare August 25, 2026 20:56

@iskakaushik iskakaushik left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM

@sdairs
sdairs force-pushed the issue-478-local-lifecycle-help branch from c764b48 to b8f1bf9 Compare August 26, 2026 09:28
@sdairs
sdairs force-pushed the issue-479-local-server-state-machine-tests branch from e9fb2cf to b037cd5 Compare August 26, 2026 09:28

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit b037cd5. Configure here.

.join("clickhouse");
std::fs::create_dir_all(binary.parent().expect("fake binary parent"))
.expect("create fake version directory");
std::fs::write(&binary, b"#!/bin/sh\nexec sleep 300\n").expect("write fake ClickHouse");

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Fake binary breaks process detection

High Severity

install_fake_clickhouse uses exec sleep 300, which replaces the process image so cmdline/basename are no longer clickhouse. Managed inspection then treats the server as not running, so list/stop/remove/collision checks in this suite cannot observe real running state. Sibling fixtures keep a trap/loop shell so identity checks still pass.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit b037cd5. Configure here.

@sdairs

sdairs commented Aug 27, 2026

Copy link
Copy Markdown
Collaborator Author

Superseded by #562 in stack #563.

@sdairs sdairs closed this Aug 27, 2026
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.

Add table-driven subprocess test suite for local server state machine

2 participants