Skip to content

Testing

Ventana de terminal
cd test
go run test-connection.go

This test verifies connectivity, authentication, and TLS encryption.

Ventana de terminal
go test -v -run TestSQLInjectionVulnerability ./test/security/...

The security suite covers 6 SQL injection attack vectors.

Use the CLI tool to test operations:

Ventana de terminal
# Connection test
go run claude-code/db-connector.go test
# Database information
go run claude-code/db-connector.go info
# List tables
go run claude-code/db-connector.go tables
# Describe a table
go run claude-code/db-connector.go describe users
# Execute a query
go run claude-code/db-connector.go query "SELECT @@VERSION"

With MSSQL_READ_ONLY=true, confirm that write queries are blocked:

Ventana de terminal
go run claude-code/db-connector.go query "INSERT INTO some_table VALUES (1)"
# Should return: Query blocked: read-only mode

With MSSQL_WHITELIST_TABLES=temp_ai, confirm that only that table accepts writes:

Ventana de terminal
go run claude-code/db-connector.go query "INSERT INTO temp_ai (data) VALUES ('test')"
# Should execute successfully

Always use a separate database for testing. Never run tests against production.