0
0
mirror of https://github.com/tursodatabase/libsql.git synced 2025-05-25 19:10:39 +00:00

Go Bindings: More tests ()

* Go Bindings: More tests

Signed-off-by: Piotr Jastrzebski <piotr@chiselstrike.com>

* Cleanup disk in Go/C CI

Signed-off-by: Piotr Jastrzebski <piotr@chiselstrike.com>

---------

Signed-off-by: Piotr Jastrzebski <piotr@chiselstrike.com>
This commit is contained in:
Piotr Jastrzębski
2024-02-09 15:48:16 +01:00
committed by GitHub
parent cd82068edf
commit 64e5549cec
3 changed files with 75 additions and 1 deletions

@ -16,6 +16,14 @@ jobs:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
# needed because we run out of disk space during tests
- name: Free Disk Space (Ubuntu)
uses: jlumbroso/free-disk-space@main
with:
# this might remove tools that are actually needed,
# when set to "true" but frees about 6 GB
tool-cache: true
- name: Install Protoc
uses: arduino/setup-protoc@v2

@ -15,7 +15,20 @@ jobs:
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
- name: Set up Go
uses: actions/setup-go@v3
with:
cache: true
go-version: '>=1.21'
# needed because we run out of disk space during tests
- name: Free Disk Space (Ubuntu)
uses: jlumbroso/free-disk-space@main
with:
# this might remove tools that are actually needed,
# when set to "true" but frees about 6 GB
tool-cache: true
- name: get TCL
run: sudo apt-get install -y tcl8.6-dev

@ -581,6 +581,16 @@ func TestMultiLineStatement(t *testing.T) {
func TestPreparedStatementInTransaction(t *testing.T) {
t.Parallel()
db := getRemoteDb(T{t})
testPreparedStatementInTransaction(db)
}
func TestPreparedStatementInTransactionEmbedded(t *testing.T) {
t.Parallel()
db := getEmbeddedDb(T{t})
testPreparedStatementInTransaction(db)
}
func testPreparedStatementInTransaction(db *Database) {
if db == nil {
return
}
@ -592,6 +602,7 @@ func TestPreparedStatementInTransaction(t *testing.T) {
tx.assertRowsCount(1)
tx.assertRowExists(1)
db.t.FatalOnError(tx.Commit())
db.sync()
table.assertRowsCount(1)
table.assertRowExists(1)
}
@ -599,6 +610,16 @@ func TestPreparedStatementInTransaction(t *testing.T) {
func TestPreparedStatementInTransactionRollback(t *testing.T) {
t.Parallel()
db := getRemoteDb(T{t})
testPreparedStatementInTransactionRollback(db)
}
func TestPreparedStatementInTransactionRollbackEmbedded(t *testing.T) {
t.Parallel()
db := getEmbeddedDb(T{t})
testPreparedStatementInTransactionRollback(db)
}
func testPreparedStatementInTransactionRollback(db *Database) {
if db == nil {
return
}
@ -610,6 +631,7 @@ func TestPreparedStatementInTransactionRollback(t *testing.T) {
tx.assertRowsCount(1)
tx.assertRowExists(1)
db.t.FatalOnError(tx.Rollback())
db.sync()
table.assertRowsCount(0)
table.assertRowDoesNotExist(1)
}
@ -617,6 +639,16 @@ func TestPreparedStatementInTransactionRollback(t *testing.T) {
func TestCancelContext(t *testing.T) {
t.Parallel()
db := getRemoteDb(T{t})
testCancelContext(db)
}
func TestCancelContextEmbedded(t *testing.T) {
t.Parallel()
db := getEmbeddedDb(T{t})
testCancelContext(db)
}
func testCancelContext(db *Database) {
if db == nil {
return
}
@ -634,6 +666,16 @@ func TestCancelContext(t *testing.T) {
func TestCancelContextWithTransaction(t *testing.T) {
t.Parallel()
db := getRemoteDb(T{t})
testCancelContextWithTransaction(db)
}
func TestCancelContextWithTransactionEmbedded(t *testing.T) {
t.Parallel()
db := getEmbeddedDb(T{t})
testCancelContextWithTransaction(db)
}
func testCancelContextWithTransaction(db *Database) {
if db == nil {
return
}
@ -662,6 +704,16 @@ func TestCancelContextWithTransaction(t *testing.T) {
func TestTransactionRollback(t *testing.T) {
t.Parallel()
db := getRemoteDb(T{t})
testTransactionRollback(db)
}
func TestTransactionRollbackEmbedded(t *testing.T) {
t.Parallel()
db := getEmbeddedDb(T{t})
testTransactionRollback(db)
}
func testTransactionRollback(db *Database) {
if db == nil {
return
}
@ -674,6 +726,7 @@ func TestTransactionRollback(t *testing.T) {
tx.assertRowExists(0)
tx.assertRowExists(19)
db.t.FatalOnError(tx.Rollback())
db.sync()
table.assertRowsCount(0)
}