Skip to content

Commit 3b715b8

Browse files
committed
test: update accelerate tests
1 parent 2ddbe6d commit 3b715b8

File tree

44 files changed

+119
-77
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+119
-77
lines changed

.github/workflows/test.yaml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1027,7 +1027,6 @@ jobs:
10271027
command: bash .github/scripts/test-project.sh ${{ github.job }} ${{ matrix.platform }}
10281028
env:
10291029
DATAPROXY_FLAVOR: 'DP2+Extension'
1030-
PRISMA_GENERATE_FLAG: '--accelerate'
10311030
DATAPROXY_COMMON_URL: ${{ secrets.DP2_DATAPROXY_COMMON_URL }}
10321031
ITX_PDP_MONGODB_DATABASE_URL: ${{ secrets.DP2_ITX_PDP_MONGODB_DATABASE_URL }}
10331032
ITX_PDP_MONGODB: ${{ secrets.DP2_ITX_PDP_MONGODB }}
@@ -1048,7 +1047,6 @@ jobs:
10481047
command: bash .github/scripts/test-project.sh ${{ github.job }} ${{ matrix.platform }}
10491048
env:
10501049
DATAPROXY_FLAVOR: 'DP2'
1051-
PRISMA_GENERATE_FLAG: '--accelerate'
10521050
DATAPROXY_COMMON_URL: ${{ secrets.DP2_DATAPROXY_COMMON_URL }}
10531051
ITX_PDP_MONGODB_DATABASE_URL: ${{ secrets.DP2_ITX_PDP_MONGODB_DATABASE_URL }}
10541052
ITX_PDP_MONGODB: ${{ secrets.DP2_ITX_PDP_MONGODB }}

accelerate/cloudflare-workers-module/run.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@ set -eu
44

55
pnpm install
66

7-
pnpm prisma generate $PRISMA_GENERATE_FLAG
7+
pnpm prisma generate
88

99
pnpm wrangler deploy | tee deployment-url.txt

accelerate/cloudflare-workers-module/src/index.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,7 @@ let prisma: PrismaClient
1313
export default {
1414
fetch(request: Request, env: Env) {
1515
prisma = new PrismaClient({
16-
datasources: {
17-
db: {
18-
url: env.DATAPROXY_COMMON_URL,
19-
},
20-
},
16+
accelerateUrl: env.DATAPROXY_COMMON_URL,
2117
})
2218

2319
if (env.DATAPROXY_FLAVOR === 'DP2+Extension') {

accelerate/cloudflare-workers-service/run.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@ set -eu
44

55
pnpm install
66

7-
pnpm prisma generate $PRISMA_GENERATE_FLAG
7+
pnpm prisma generate
88

99
pnpm wrangler deploy | tee deployment-url.txt

accelerate/deno/run.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22

33
set -eu
44

5-
deno task generate $PRISMA_GENERATE_FLAG
5+
deno task generate

accelerate/deno/src/index.ts

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,15 @@
1-
import { PrismaClient } from "../generated/client.ts";
1+
import { PrismaClient } from '../generated/client.ts'
22

3-
const prisma = new PrismaClient({});
3+
const prisma = new PrismaClient({
4+
accelerateUrl: process.env.DATAPROXY_COMMON_URL,
5+
})
46

57
export async function getUsers() {
68
// Do a query and disconnect
79
// So we also test that connection is re-established in next query below
8-
await prisma.user.findFirst();
9-
await prisma.$disconnect();
10+
await prisma.user.findFirst()
11+
await prisma.$disconnect()
1012

1113
// query should re-connect automatically
12-
return await prisma.$transaction([
13-
prisma.user.findFirst(),
14-
prisma.user.findMany(),
15-
]);
14+
return await prisma.$transaction([prisma.user.findFirst(), prisma.user.findMany()])
1615
}

accelerate/nodejs-cockroachdb-itx/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"scripts": {
66
"prisma": "prisma",
77
"test": "jest --runInBand",
8-
"generate-client": "prisma generate $PRISMA_GENERATE_FLAG",
8+
"generate-client": "prisma generate",
99
"migrate-deploy": "prisma db push"
1010
},
1111
"dependencies": {

accelerate/nodejs-cockroachdb-itx/test/batch-itx.test.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@ describe('batch-itx', () => {
1313
let prisma: PrismaClient
1414

1515
beforeAll(() => {
16-
prisma = new PrismaClient()
16+
prisma = new PrismaClient({
17+
accelerateUrl: process.env.ITX_PDP_COCKROACHDB,
18+
})
1719

1820
if (process.env.DATAPROXY_FLAVOR === 'DP2+Extension') {
1921
prisma = prisma.$extends(withAccelerate()) as any

accelerate/nodejs-cockroachdb-itx/test/burst-load/burst-load.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@ const util = require('util')
66
const sleep = util.promisify(setTimeout)
77
const accelerateItxMax = 15_000
88

9-
let prisma = new PrismaClient()
9+
let prisma = new PrismaClient({
10+
accelerateUrl: process.env.ITX_PDP_COCKROACHDB,
11+
})
1012

1113
if (process.env.DATAPROXY_FLAVOR === 'DP2+Extension') {
1214
prisma = prisma.$extends(withAccelerate())

accelerate/nodejs-cockroachdb-itx/test/concurrent/concurrent.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@ const util = require('util')
66
const sleep = util.promisify(setTimeout)
77
const accelerateItxMax = 15_000
88

9-
let prisma = new PrismaClient()
9+
let prisma = new PrismaClient({
10+
accelerateUrl: process.env.ITX_PDP_COCKROACHDB,
11+
})
1012

1113
if (process.env.DATAPROXY_FLAVOR === 'DP2+Extension') {
1214
prisma = prisma.$extends(withAccelerate())

0 commit comments

Comments
 (0)