-
Notifications
You must be signed in to change notification settings - Fork 1
Add MySQL integration tests (8.0, 8.4, 9.1) #22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
6b92ae6
b513ed6
2b49751
b46da46
034fc60
a5bf7e2
7553a03
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,89 @@ | ||
| name: Integration Tests | ||
|
|
||
| on: | ||
| push: | ||
| branches: [master] | ||
| pull_request: | ||
| branches: [master] | ||
| schedule: | ||
| # Run nightly at 2am UTC | ||
| - cron: '0 2 * * *' | ||
| workflow_dispatch: | ||
|
|
||
| jobs: | ||
| sandbox-test: | ||
| name: Sandbox (${{ matrix.mysql-version }}) | ||
| runs-on: ubuntu-22.04 | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| mysql-version: | ||
| - '8.0.42' | ||
| - '8.4.4' | ||
| - '9.1.0' | ||
| env: | ||
| GO111MODULE: on | ||
| SANDBOX_BINARY: ${{ github.workspace }}/opt/mysql | ||
| MYSQL_VERSION: ${{ matrix.mysql-version }} | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - uses: actions/setup-go@v5 | ||
| with: | ||
| go-version: '1.22' | ||
|
|
||
| - name: Install system libraries | ||
| run: | | ||
| sudo apt-get update | ||
| sudo apt-get install -y libaio1 libnuma1 libncurses5 | ||
|
|
||
| - name: Build dbdeployer | ||
| run: go build -o dbdeployer . | ||
|
|
||
| - name: Cache MySQL tarball | ||
| uses: actions/cache@v4 | ||
| with: | ||
| path: /tmp/mysql-tarball | ||
| key: mysql-${{ matrix.mysql-version }}-linux-x86_64-v1 | ||
|
|
||
| - name: Download MySQL | ||
| run: | | ||
| SHORT_VER=$(echo "$MYSQL_VERSION" | grep -oP '^\d+\.\d+') | ||
| TARBALL="mysql-${MYSQL_VERSION}-linux-glibc2.17-x86_64.tar.xz" | ||
| mkdir -p /tmp/mysql-tarball | ||
| if [ ! -f "/tmp/mysql-tarball/$TARBALL" ]; then | ||
| echo "Downloading $TARBALL..." | ||
| curl -L -f -o "/tmp/mysql-tarball/$TARBALL" \ | ||
| "https://dev.mysql.com/get/Downloads/MySQL-${SHORT_VER}/$TARBALL" \ | ||
| || curl -L -f -o "/tmp/mysql-tarball/$TARBALL" \ | ||
| "https://downloads.mysql.com/archives/get/p/23/file/$TARBALL" | ||
| fi | ||
| ls -lh "/tmp/mysql-tarball/$TARBALL" | ||
|
|
||
| - name: Unpack MySQL | ||
| run: | | ||
| mkdir -p "$SANDBOX_BINARY" | ||
| TARBALL="mysql-${MYSQL_VERSION}-linux-glibc2.17-x86_64.tar.xz" | ||
| ./dbdeployer unpack "/tmp/mysql-tarball/$TARBALL" \ | ||
| --sandbox-binary="$SANDBOX_BINARY" | ||
|
|
||
| - name: Test single sandbox | ||
| run: | | ||
| ./dbdeployer deploy single "$MYSQL_VERSION" \ | ||
| --sandbox-binary="$SANDBOX_BINARY" | ||
| ~/sandboxes/msb_*/use -e "SELECT VERSION()" | ||
| ./dbdeployer delete all --skip-confirm | ||
|
|
||
| - name: Test replication sandbox | ||
| run: | | ||
| ./dbdeployer deploy replication "$MYSQL_VERSION" \ | ||
| --sandbox-binary="$SANDBOX_BINARY" | ||
| ~/sandboxes/rsandbox_*/check_slaves | ||
| ~/sandboxes/rsandbox_*/test_replication | ||
| ./dbdeployer delete all --skip-confirm | ||
|
Comment on lines
+70
to
+83
|
||
|
|
||
| - name: Cleanup | ||
| if: always() | ||
| run: | | ||
| ./dbdeployer delete all --skip-confirm 2>/dev/null || true | ||
| pkill -9 -u "$USER" mysqld 2>/dev/null || true | ||
| Original file line number | Diff line number | Diff line change | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -2,21 +2,25 @@ run: | |||||||||||
| timeout: 5m | ||||||||||||
|
|
||||||||||||
| linters: | ||||||||||||
| disable-all: true | ||||||||||||
| enable: | ||||||||||||
| - errcheck | ||||||||||||
| - govet | ||||||||||||
| - ineffassign | ||||||||||||
| - staticcheck | ||||||||||||
| - unused | ||||||||||||
| - gosec | ||||||||||||
| disable: | ||||||||||||
| - depguard | ||||||||||||
|
|
||||||||||||
| linters-settings: | ||||||||||||
| errcheck: | ||||||||||||
| check-type-assertions: false | ||||||||||||
| gosec: | ||||||||||||
| excludes: | ||||||||||||
| - G115 # integer overflow int64->uint64 on file sizes — safe | ||||||||||||
| - G112 # Slowloris in test code only | ||||||||||||
|
Comment on lines
+16
to
+19
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
# Verify whether G112-relevant server code exists outside tests.
rg -nP --type=go -g '!**/*_test.go' 'http\.Server\s*\{' -C2
rg -nP --type=go -g '!**/*_test.go' '\bReadHeaderTimeout\s*:' -C1Repository: ProxySQL/dbdeployer Length of output: 45 🏁 Script executed: # Verify .golangci.yml exists and check the exact state around lines 16-19
cat -n .golangci.yml | head -30Repository: ProxySQL/dbdeployer Length of output: 686 🏁 Script executed: # Broader search for HTTP server usage in non-test code
rg -i 'http\.Server|net\.Listen|ListenAndServe' --type=go -g '!**/*_test.go' | head -20Repository: ProxySQL/dbdeployer Length of output: 45 🏁 Script executed: # Check for any Unlock() usage in codebase
rg 'Unlock\s*\(' --type=go -B2 -A2 | head -40Repository: ProxySQL/dbdeployer Length of output: 1143 🏁 Script executed: # Understand the repository structure and purpose
ls -la && cat README.md | head -50Repository: ProxySQL/dbdeployer Length of output: 6783 Scope Line 19 disables However, the broader concern about line 24–26 ( Suggested config adjustment linters-settings:
errcheck:
check-type-assertions: false
gosec:
excludes:
- G115 # integer overflow int64->uint64 on file sizes — safe
- - G112 # Slowloris in test code only
issues:
exclude-use-default: true
exclude-rules:
+ - path: '.*_test\.go'
+ linters:
+ - gosec
+ text: "G112"
- linters:
- errcheck
text: "lock.Unlock"Alternatively, if 🤖 Prompt for AI Agents |
||||||||||||
|
|
||||||||||||
| issues: | ||||||||||||
| exclude-use-default: true | ||||||||||||
| max-issues-per-linter: 50 | ||||||||||||
| max-same-issues: 10 | ||||||||||||
| exclude-rules: | ||||||||||||
| - linters: | ||||||||||||
| - errcheck | ||||||||||||
| text: "lock.Unlock" | ||||||||||||
|
Comment on lines
+23
to
+26
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
# Find unchecked Unlock() calls that may be hidden by errcheck exclusions.
rg -nP --type=go -C2 '\b_?\s*=\s*[A-Za-z_][A-Za-z0-9_]*\.Unlock\s*\(\)|\bdefer\s+[A-Za-z_][A-Za-z0-9_]*\.Unlock\s*\(\)'Repository: ProxySQL/dbdeployer Length of output: 638 🏁 Script executed: # Check the .golangci.yml to confirm the exclude-rule
cat .golangci.ymlRepository: ProxySQL/dbdeployer Length of output: 504 🏁 Script executed: # Get broader context around the Unlock calls in defaults/catalog.go
cat -n defaults/catalog.go | sed -n '65,80p;140,150p;165,180p'Repository: ProxySQL/dbdeployer Length of output: 1185 🏁 Script executed: # Search for all lock.Unlock calls to see complete picture
rg -n "lock\.Unlock" --type=goRepository: ProxySQL/dbdeployer Length of output: 194 🏁 Script executed: # Get function names for the other two Unlock calls
cat -n defaults/catalog.go | sed -n '135,150p;160,180p'Repository: ProxySQL/dbdeployer Length of output: 1072 🏁 Script executed: # Find the function name for the Unlock at line 145
cat -n defaults/catalog.go | sed -n '120,145p'Repository: ProxySQL/dbdeployer Length of output: 902 Remove the The global suppress rule in
Remove the exclusion and apply proper error handling to all three functions: Suggested fix issues:
exclude-use-default: true
- exclude-rules:
- - linters:
- - errcheck
- text: "lock.Unlock"
+ exclude-rules: []// For ReadCatalog()
defer func() {
if unlockErr := lock.Unlock(); unlockErr != nil && err == nil {
err = unlockErr
}
}()
// For UpdateCatalog() and DeleteFromCatalog()
defer func() {
if unlockErr := lock.Unlock(); unlockErr != nil {
// Log or return the error based on function signature
}
}()📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The workflow downloads MySQL tarballs via raw
curlURLs, which bypasses dbdeployer’s existingdownloadsmachinery (user-agent handling for dev.mysql.com, checksum verification when available, retries, etc.). This increases supply-chain risk and makes the workflow more brittle if MySQL changes download behavior. Consider replacing the custom download logic withdbdeployer downloads get-by-version/get-unpack(run from/tmp/mysql-tarballso caching still works), or at minimum add pinned SHA256 verification for each version in the matrix.