13 lines
1.3 KiB
JavaScript
13 lines
1.3 KiB
JavaScript
#!/usr/bin/env node
|
|||
|
|
import { spawnSync } from 'node:child_process';
|
||
|
|
import { fileURLToPath } from 'node:url';
|
||
|
|
const root=fileURLToPath(new URL('..',import.meta.url));
|
||
|
|
const inspected=spawnSync('docker',['--context','colima-yawan','inspect','WeKnora-postgres'],{encoding:'utf8'});
|
||
|
|
if(inspected.status!==0)throw new Error(inspected.stderr);
|
||
|
|
const config=JSON.parse(inspected.stdout)[0];
|
||
|
|
const env=Object.fromEntries(config.Config.Env.map(s=>{const p=s.indexOf('=');return [s.slice(0,p),s.slice(p+1)]}));
|
||
|
|
const user=env.POSTGRES_USER||'postgres';
|
||
|
|
const dsn=`postgresql://${encodeURIComponent(user)}:${encodeURIComponent(env.POSTGRES_PASSWORD)}@127.0.0.1:5432/yawan_native_acceptance_20260915?sslmode=disable`;
|
||
|
|
const result=spawnSync('docker',['--context','colima-yawan','run','--rm','--network','container:WeKnora-postgres','-v',`${root}:/workspace`,'-v','/Volumes/Extreme SSD/yawan-storage/weknora/go-cache:/go','-v','/Volumes/Extreme SSD/yawan-storage/weknora/go-build:/build-cache','-e','GRAPH_TEST_DSN','-e','GOMODCACHE=/go/pkg/mod','-e','GOCACHE=/build-cache','-w','/workspace','golang:1.26-bookworm','go','test','-count=1','-v','./internal/application/repository/retriever/legacygraph'],{env:{...process.env,GRAPH_TEST_DSN:dsn},stdio:'inherit'});
|
||
|
|
process.exitCode=result.status||0;
|