Skip to content

Commit 7e161c7

Browse files
committed
fix(ci): robust sql server connection and code coverage math
1 parent a72995c commit 7e161c7

3 files changed

Lines changed: 5 additions & 47 deletions

File tree

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ jobs:
3030
run: |
3131
COVERAGE=$(go tool cover -func=coverage.out | grep total: | awk '{print $3}' | sed 's/%//')
3232
echo "Coverage: $COVERAGE%"
33-
if (( $(echo "$COVERAGE < 20" | bc -l) )); then
33+
if awk "BEGIN {exit !($COVERAGE < 20)}"; then
3434
echo "Coverage $COVERAGE% is below 20% threshold"
3535
exit 1
3636
fi

.goreleaser.yaml

Lines changed: 0 additions & 45 deletions
This file was deleted.

internal/db/mssql/mssql_integration_test.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import (
1313
"github.com/stretchr/testify/require"
1414
"github.com/testcontainers/testcontainers-go"
1515
"github.com/testcontainers/testcontainers-go/wait"
16+
"github.com/docker/go-connections/nat"
1617
)
1718

1819
func TestMSSQLIntrospectionIntegration(t *testing.T) {
@@ -31,7 +32,9 @@ func TestMSSQLIntrospectionIntegration(t *testing.T) {
3132
"ACCEPT_EULA": "Y",
3233
"MSSQL_SA_PASSWORD": "StrongPassword123!",
3334
},
34-
WaitingFor: wait.ForLog("SQL Server is now ready for client connections.").WithStartupTimeout(120 * time.Second),
35+
WaitingFor: wait.ForSQL("1433/tcp", "sqlserver", func(host string, port nat.Port) string {
36+
return fmt.Sprintf("sqlserver://sa:StrongPassword123!@%s:%s?database=master&encrypt=disable", host, port.Port())
37+
}).WithStartupTimeout(120 * time.Second),
3538
}
3639

3740
mssqlC, err := testcontainers.GenericContainer(ctx, testcontainers.GenericContainerRequest{

0 commit comments

Comments
 (0)