test: comprehensive C++ unit testing and black-box CLI bash test suite#6
Merged
Conversation
Update the CI trigger branches and the test runner command. Modify unit tests to align with the updated Task schema and correct the JSON configuration filename.
Split path management into separate file and directory paths, implement idempotent path addition, and update CLI list command to display resolved files. Update test runner configuration to include missing test suites.
Standardize task identification by replacing task names with file paths across the API. Update internal logic to ensure idempotency for task activation and start operations.
- Added `set` CLI command to configure active status and watching depth. - Updated core logic to persist task settings and validation. - Enabled running tasks by active status. - Cleaned up output formatting in list command. - Removed unused `isRunning` property from task configuration.
- add tests to test the add, run, init and list subcommands - refactored existing code to make the tests pass
- Added a `-f` flag to bypass the confirmation dialog when removing a task. - Added a suite of unit tests for the remove command. - Improved SIGINT handling in `test_run.sh` to ensure clean process cleanup.
Implement the `check` subcommand to verify task status (active/inactive) and retrieve the watching depth for the current directory.
- Add `set` command support for --active, --deactive, and --depth - Update FlowHookCore to manage task depth and activation status - Normalize output streams to standard output across CLI commands - Add unit tests for configuration persistence and validation
Run the project binary installation and execute the full suite of CLI shell scripts.
Add missing install rule to CMakeLists and verify the binary path in CI.
Install the flowhook_cli executable and create a symlink or rename it to flowhook in the bin directory to maintain legacy command support.
Automatically remove non-existent file and directory paths when initializing a task instead of failing the process.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
This PR introduces a testing infrastructure to ensure the reliability and stability of flowhook. It covers low-level component validation via unit tests and end-to-end black-box verification of the CLI layer using native Bash scripting.
Changes Implemented
Wrote and updated comprehensive unit tests for the core structural elements of the engine:
FileWatcher: Verified inotify event handling.
TaskRunner: Validated process execution, on_success/on_failure branching logic, and child process signaling. Recursive file watching and management of the
Taskstruct also happens here.SessionLogger: Tested decoupled thread-safe logging and TUI/CLI output consistency.
ConfigManager: Ensured fault-tolerant JSON serialization/deserialization from the config.json file, dirty-state tracking (isflushed), and handling of edge-case sentinels (INT_MIN).
FlowHookCore: Validated the orchestrator layer, fixing critical initialization ordering bugs (handling path injection before scanning, resetting state guards, and stale path cleanup).
Built a modular, isolated integration test suite from scratch using native Bash to verify UX correctness:
Isolation: Implemented FLOWHOOK_CONFIG_DIR_TEST environment overrides to prevent clobbering user configurations during execution.
Subcommand Coverage: Comprehensive test scripts (test_init.sh, test_add.sh, test_list.sh, test_remove.sh, test_set.sh, test_run.sh) covering all options, flag combinations, active/inactive toggles, duplicate entries, and forced removals (-f).
Harness (test_cli.sh): A unified orchestrator that exits with status code 1 on any failure, explicitly designed for continuous integration.
Integrated the full CLI test harness into the GitHub Actions workflow (tests.yml).
Fixed CMake installation targets and binary renaming mechanics to guarantee reliable, clean compilation in remote environments.
Status: All 58+ integration tests and core unit tests are passing successfully on CI.
How to Manually Run Tests