Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 35 additions & 32 deletions .github/workflows/system-tests-against-emulator.yaml
Original file line number Diff line number Diff line change
@@ -1,34 +1,37 @@
# on:
# push:
# branches:
# - main
# paths:
# - 'handwritten/spanner/**'
# pull_request:
# paths:
# - 'handwritten/spanner/**'
# name: system-tests-against-emulator
# jobs:
# test:
# runs-on: ubuntu-latest
on:
push:
branches:
- main
paths:
- 'handwritten/spanner/**'
pull_request:
paths:
- 'handwritten/spanner/**'
name: system-tests-against-emulator
jobs:
test:
runs-on: ubuntu-latest

# services:
# emulator:
# image: gcr.io/cloud-spanner-emulator/emulator:latest
# ports:
# - 9010:9010
# - 9020:9020
permissions:
contents: read

# steps:
# - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5
# - uses: actions/setup-node@v5
# with:
# node-version: 22
# - run: node --version
# - run: npm install
# working-directory: handwritten/spanner
# - run: npm run system-test
# working-directory: handwritten/spanner
# env:
# SPANNER_EMULATOR_HOST: localhost:9010
# GCLOUD_PROJECT: emulator-test-project
services:
emulator:
image: gcr.io/cloud-spanner-emulator/emulator:latest
ports:
- 9010:9010
- 9020:9020

steps:
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5
- uses: actions/setup-node@v5
with:
node-version: 22
- run: node --version
- run: npm install
working-directory: handwritten/spanner
- run: npm run system-test
working-directory: handwritten/spanner
env:
SPANNER_EMULATOR_HOST: localhost:9010
GCLOUD_PROJECT: emulator-test-project
3 changes: 2 additions & 1 deletion handwritten/spanner/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,6 @@
"@types/yargs": "^17.0.35",
"binary-search-bounds": "^2.0.5",
"c8": "^10.1.3",
"codecov": "^3.8.3",
"concat-stream": "^2.0.0",
"dedent": "^1.5.3",
"execa": "^5.0.0",
Expand Down Expand Up @@ -147,11 +146,13 @@
},
"overrides": {
"gcp-metadata": "^7.0.1",
"punycode": "^2.3.1",
"@sinonjs/fake-timers": "15.2.1"
},
"pnpm": {
"overrides": {
"gcp-metadata": "^7.0.1",
"punycode": "^2.3.1",
"@sinonjs/fake-timers": "15.2.1"
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
"dependencies": {
"@google-cloud/spanner": "file:./spanner.tgz"
},
"overrides": {
"punycode": "^2.3.1"
},
"devDependencies": {
"@types/node": "^22.0.0",
"typescript": "^4.0.0",
Expand Down
14 changes: 8 additions & 6 deletions handwritten/spanner/system-test/spanner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,6 @@ describe('Spanner', () => {
});

after(async () => {
await MetricsTracerFactory.resetInstance();
try {
if (generateInstanceForTest) {
// Sleep for 30 seconds before cleanup, just in case
Expand Down Expand Up @@ -306,9 +305,10 @@ describe('Spanner', () => {
),
);
}
await MetricsTracerFactory.resetInstance();
} catch (err) {
console.error('Cleanup failed:', err);
} finally {
await MetricsTracerFactory.resetInstance();
}
});

Expand Down Expand Up @@ -8298,7 +8298,7 @@ describe('Spanner', () => {
const commitTransaction = async (database, table) => {
await database.runTransactionAsync(async transaction => {
transaction!.insert(table.name, {
Key: 'k5',
Key: generateName('k5'),
StringValue: 'v5',
});

Expand Down Expand Up @@ -8725,7 +8725,7 @@ describe('Spanner', () => {
});
}
transaction!.insert('TxnTable', {
Key: 'k1003',
Key: generateName('k1003'),
StringValue: 'mutation',
});
await transaction.commit();
Expand Down Expand Up @@ -8920,8 +8920,10 @@ function deleteInstanceArray(instanceArray) {
);
}
async function deleteInstance(instance: Instance) {
const [backups] = await instance.getBackups();
await Promise.all(backups.map(backup => backup.delete(GAX_OPTIONS)));
if (!process.env.SPANNER_EMULATOR_HOST) {
const [backups] = await instance.getBackups();
await Promise.all(backups.map(backup => backup.delete(GAX_OPTIONS)));
}
return instance.delete(GAX_OPTIONS);
}

Expand Down
Loading