Skip to content

Commit b7f80f5

Browse files
committed
Merge branch 'op-sqlite-tests' of github.com:powersync-ja/powersync-js into op-sqlite-tests
2 parents 1924c86 + b98a193 commit b7f80f5

File tree

3 files changed

+16
-21
lines changed

3 files changed

+16
-21
lines changed

.github/workflows/test-simulators.yaml

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -90,26 +90,22 @@ jobs:
9090
emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
9191
script: echo "Generated AVD snapshot for caching."
9292

93+
- name: Android Emulator Build
94+
working-directory: ./tools/powersynctests
95+
run: pnpx detox build --configuration android.emu.release
96+
9397
- name: Run connected Android tests
9498
uses: ReactiveCircus/[email protected]
9599
with:
96100
api-level: 31
97101
target: google_apis
98102
arch: x86_64
99103
avd-name: $AVD_NAME
100-
script: cd tools/powersynctests && pnpm android
104+
script: cd tools/powersynctests && pnpx detox test --configuration android.emu.release --headless
101105
force-avd-creation: false
102106
emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
103107
disable-animations: true
104108

105-
- name: Android Emulator Build
106-
working-directory: ./tools/powersynctests
107-
run: pnpx detox build --configuration android.emu.release
108-
109-
- name: Android Emultator Test
110-
working-directory: ./tools/powersynctests
111-
run: pnpx detox test --configuration android.emu.release --headless
112-
113109
test-ios:
114110
name: Test iOS
115111
runs-on: macOS-15

packages/powersync-op-sqlite/src/db/OPSqliteAdapter.ts

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
import { BaseObserver, DBAdapter, DBAdapterListener, DBLockOptions, QueryResult, Transaction } from '@powersync/common';
21
import { ANDROID_DATABASE_PATH, getDylibPath, IOS_LIBRARY_PATH, open, type DB } from '@op-engineering/op-sqlite';
2+
import { BaseObserver, DBAdapter, DBAdapterListener, DBLockOptions, QueryResult, Transaction } from '@powersync/common';
33
import Lock from 'async-lock';
4-
import { OPSQLiteConnection } from './OPSQLiteConnection';
54
import { Platform } from 'react-native';
5+
import { OPSQLiteConnection } from './OPSQLiteConnection';
66
import { SqliteOptions } from './SqliteOptions';
77

88
/**
@@ -155,15 +155,14 @@ export class OPSQLiteDBAdapter extends BaseObserver<DBAdapterListener> implement
155155
}
156156
}
157157

158-
close() {
159-
this.initialized.then(() => {
160-
// Abort any pending operations
161-
this.abortController.abort();
162-
this.readQueue = [];
158+
async close() {
159+
await this.initialized;
160+
// Abort any pending operations
161+
this.abortController.abort();
162+
this.readQueue = [];
163163

164-
this.writeConnection!.close();
165-
this.readConnections!.forEach((c) => c.connection.close());
166-
});
164+
this.writeConnection!.close();
165+
this.readConnections!.forEach((c) => c.connection.close());
167166
}
168167

169168
async readLock<T>(fn: (tx: OPSQLiteConnection) => Promise<T>, options?: DBLockOptions): Promise<T> {

tools/powersynctests/src/tests/queries.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -585,7 +585,7 @@ export function registerBaseTests() {
585585
}
586586

587587
await db.executeBatch(statement, bulkInsertCommands);
588-
db.close();
588+
await db.close();
589589

590590
for (let i = 1; i < 10; i++) {
591591
db = createDatabase();
@@ -603,7 +603,7 @@ export function registerBaseTests() {
603603
db.execute(`SELECT * FROM t1 `)
604604
];
605605

606-
db.close();
606+
await db.close();
607607

608608
const results = await Promise.allSettled(tests);
609609
expect(results.map((r) => r.status)).deep.equal(Array(tests.length).fill('rejected'));

0 commit comments

Comments
 (0)