Skip to content

Commit 5bec59d

Browse files
committed
Added db/sql package testing
1 parent 5afd68b commit 5bec59d

File tree

2 files changed

+28
-3
lines changed

2 files changed

+28
-3
lines changed

.github/workflows/go.yml

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,24 @@ jobs:
1313

1414
build:
1515
runs-on: ubuntu-latest
16+
17+
services:
18+
# Database service container (pgvector)
19+
postgres:
20+
image: ankane/pgvector:v0.5.1
21+
env:
22+
POSTGRES_USER: root
23+
POSTGRES_PASSWORD: password
24+
POSTGRES_DB: perfkit_pg_vector_db_ci
25+
ports:
26+
- 5432:5432
27+
# Health check to wait until postgres is ready
28+
options: >-
29+
--health-cmd pg_isready
30+
--health-interval 10s
31+
--health-timeout 5s
32+
--health-retries 5
33+
1634
steps:
1735
- uses: actions/checkout@v4
1836

@@ -22,4 +40,11 @@ jobs:
2240
go-version: '1.22'
2341

2442
- name: Test
25-
run: go test -v ./benchmark/...
43+
run: go test -v ./db/sql/...
44+
env:
45+
# Pass database connection details to tests (using pgvector config)
46+
DB_HOST: localhost
47+
DB_PORT: 5432
48+
DB_USER: root
49+
DB_PASSWORD: password
50+
DB_NAME: perfkit_pg_vector_db_ci

db/sql/sql_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,11 @@ type TestingSuite struct {
3636
func TestDatabaseSuiteSQLite(t *testing.T) {
3737
suite.Run(t, &TestingSuite{ConnString: sqliteConnString})
3838
}
39-
*/
4039
4140
func TestDatabaseSuiteMySQL(t *testing.T) {
4241
suite.Run(t, &TestingSuite{ConnString: mariaDBConnString})
4342
}
4443
45-
/*
4644
func TestDatabaseSuiteSQLServer(t *testing.T) {
4745
suite.Run(t, &TestingSuite{ConnString: sqlServerConnString})
4846
}
@@ -56,13 +54,15 @@ func TestDatabaseSuitePGVector(t *testing.T) {
5654
suite.Run(t, &TestingSuite{ConnString: pgVectorConnString})
5755
}
5856

57+
/*
5958
func TestDatabaseSuiteClickHouse(t *testing.T) {
6059
suite.Run(t, &TestingSuite{ConnString: clickHouseConnString})
6160
}
6261
6362
func TestDatabaseSuiteCassandra(t *testing.T) {
6463
suite.Run(t, &TestingSuite{ConnString: cassandraConnString})
6564
}
65+
*/
6666

6767
type testLogger struct {
6868
t *testing.T

0 commit comments

Comments
 (0)