Add tests for the --filter=renamed option and the --filter=removed alias
that maps to dropped.
Go tests:
- Tests for filter=renamed checking all diff types
- Tests for "removed" alias mapping to dropped internally
- Verify renamed filter only includes renamed tables
BATS tests:
- Test --filter=renamed with table rename scenario
- Test --filter=dropped with table drop scenario
- Verify --filter=removed alias works same as dropped
- Verify other filters correctly exclude renamed/dropped tables
Refs: #1430
When Dolt CLI is running in a directory with a corresponding running sql-server
process, it will connect to the server process and complete its work using SQL
statements. Previously, the Dolt CLI was configured to always connect on a
plaintext TCP connection for these connections. That meant it did not work for
servers configured with require_secure_transport: true. One consequence was
that the published Dolt dockerhub image did not work with
require_secure_transport: true, since that image runs `dolt sql` against the
running server as part of its entrypoint.
This changes `dolt` CLI to connect over (non-verified) TLS if such as an option
is presented by the server. The CLI still falls back to plaintext as well.
Dolt CLI still does not work when the server is configured with
require_client_certificate, since Dolt CLI does not currently have a way to
configure its presented client certificate and private key. As a consequence,
at least for the time being, the published DockerHub images for Dolt do not
work with require_client_certificate: true.
The issue was that start_sql_server_with_args appends --port after
--config, but the config file was resetting to defaults. Fixed by:
1. Calling definePORT to get an available port
2. Including the port in the config file under listener.port
3. Using start_sql_server_with_args_no_port which expects PORT to be set
All 6 branch-activity tests now pass.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
The start_sql_server_with_config function creates a config with
a 'behavior:' section and appends the provided config file. This
caused a YAML parse error when our config also had a 'behavior:' key.
Fixed by creating a complete config file and using start_sql_server_with_args
instead, which avoids the duplicate key issue.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
- Modified branch-activity.bats to use config file that enables tracking
- Added IsTrackingEnabled() method to BranchActivityTracker
- Added error check in branch_activity_table to return helpful error message
when tracking is disabled
- Added new test case to verify error is shown when tracking is disabled
- Error message instructs users to enable via config:
'behavior.branch_activity_tracking: true'
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
Implement lazy table header initialization to fix a bug where
empty table headers were printed when all rows were filtered out
during data-only diffs. This occurred because BeginTable() was
called before row filtering, causing headers to print even when
no matching rows existed.
The solution introduces a lazyRowWriter that delays the BeginTable()
call until the first row is actually written. This wrapper is only
used when:
- A filter is active (added/modified/removed)
- The diff is data-only (no schema changes or table renames)
Implementation changes:
- Add shouldUseLazyHeader() helper to determine when to use lazy
initialization based on filter presence and diff type
- Add lazyRowWriter type that wraps SqlRowDiffWriter and delays
BeginTable() until first WriteRow() or WriteCombinedRow() call
- Modify diffUserTable() to skip BeginTable when using lazy writer
- Modify diffRows() to conditionally create lazyRowWriter vs normal
rowWriter based on shouldUseLazyHeader() check
- Add comprehensive unit tests for shouldUseLazyHeader logic and
lazyRowWriter behavior (5 test functions, 8+ test cases)
- Add mock implementations of diffWriter and SqlRowDiffWriter
interfaces to enable testing without database dependencies
- Fix BATS test assertions to match actual SQL output format
(lowercase type names, MODIFY COLUMN vs DROP/ADD pattern)
Test coverage:
- TestShouldUseLazyHeader: validates lazy header logic conditions
- TestLazyRowWriter_NoRowsWritten: verifies BeginTable not called
when no rows written (core lazy behavior)
- TestLazyRowWriter_RowsWritten: verifies BeginTable called on
first write
- TestLazyRowWriter_CombinedRowsWritten: tests combined row writes
- TestLazyRowWriter_InitializedOnlyOnce: ensures BeginTable called
exactly once
Refs: #1430
Add Go unit tests for the diff filter feature to provide fast
feedback and granular validation of filter logic.
Test coverage includes:
- diffTypeFilter struct validation (isValid method)
- Filter inclusion methods (adds, drops, modifications)
- Edge cases (empty strings, typos, case sensitivity)
- Consistency checks across all filter types
- Constant validation (values, uniqueness, lowercase)
- Invalid filter behavior verification
Tests added:
- 12 test functions
- 48+ individual test cases
- 100% coverage of diffTypeFilter struct methods
These tests complement the existing BATS integration tests
and provide unit-level regression protection.
Refs: #1430