Add sqlc-test-setup command for database test environment setup#4304
Open
kyleconroy wants to merge 4 commits intomainfrom
Open
Add sqlc-test-setup command for database test environment setup#4304kyleconroy wants to merge 4 commits intomainfrom
kyleconroy wants to merge 4 commits intomainfrom
Conversation
New cmd/sqlc-test-setup package with two subcommands: - `install`: Installs PostgreSQL and MySQL 9 via apt, including apt proxy configuration for Claude Code remote environments. - `start`: Starts both database services, configures authentication (passwords, pg_hba.conf), and verifies connectivity. Both commands log all actions verbosely for easy debugging. https://claude.ai/code/session_01CsyRwSkRxBcQoaQFVkMQsJ
Key fixes: - Use apt-get install -f to resolve dpkg dependency issues (libaio1t64, libmecab2, libnuma1) instead of expecting all dpkg -i to succeed - Remove /etc/init.d/mysql chmod (not present in systemd environments) - Use mysqld_safe to start MySQL (works without systemd/init.d) - Use caching_sha2_password plugin instead of auth_socket for TCP access - Add waitForMySQL polling loop for reliable startup detection Idempotency: - install: Skips apt proxy, PostgreSQL, and MySQL if already present - start: Detects running MySQL via mysqladmin ping, skips pg_hba.conf entry if already configured, skips password setup if already correct, skips MySQL data dir initialization if already done Tested: both commands succeed on first run and on subsequent re-runs. https://claude.ai/code/session_01CsyRwSkRxBcQoaQFVkMQsJ
…UDE.md - docker.Installed(): Also verify Docker daemon is running (not just binary in PATH). Without this, tests try Docker first, fail on docker pull, and t.Fatal instead of falling back to native databases. - expander_test.go: Use the same Docker/native detection chain as other tests instead of hardcoding connection URIs. The PostgreSQL test was hardcoded to password 'mysecretpassword' which doesn't match native setup (password 'postgres'). - CLAUDE.md: Replace manual apt/dpkg database setup instructions with sqlc-test-setup commands. Remove Step 1-4 manual instructions. All 29 test packages pass with zero skips. https://claude.ai/code/session_01CsyRwSkRxBcQoaQFVkMQsJ
Adds database setup before the test step so integration tests can connect to PostgreSQL and MySQL without Docker. https://claude.ai/code/session_01CsyRwSkRxBcQoaQFVkMQsJ
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.
New cmd/sqlc-test-setup package with two subcommands:
install: Installs PostgreSQL and MySQL 9 via apt, including aptproxy configuration for Claude Code remote environments.
start: Starts both database services, configures authentication(passwords, pg_hba.conf), and verifies connectivity.
Both commands log all actions verbosely for easy debugging.
https://claude.ai/code/session_01CsyRwSkRxBcQoaQFVkMQsJ