Skip to content

Commit 697ebf7

Browse files
NathanFlurryclaude
andcommitted
feat: US-005 - Create ioredis-connect fixture
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent b08cb2c commit 697ebf7

3 files changed

Lines changed: 56 additions & 0 deletions

File tree

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"entry": "src/index.js",
3+
"expectation": "fail",
4+
"services": ["redis"],
5+
"fail": {
6+
"code": 1,
7+
"stderrIncludes": "net.createConnection is not supported in sandbox"
8+
}
9+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"name": "e2e-docker-ioredis-connect",
3+
"private": true,
4+
"type": "commonjs",
5+
"dependencies": {
6+
"ioredis": "5.4.2"
7+
}
8+
}
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
const Redis = require("ioredis");
2+
3+
async function main() {
4+
const redis = new Redis({
5+
host: process.env.REDIS_HOST,
6+
port: Number(process.env.REDIS_PORT),
7+
lazyConnect: false,
8+
});
9+
10+
// Basic set/get
11+
await redis.set("e2e:key", "hello-sandbox");
12+
const value = await redis.get("e2e:key");
13+
14+
// Pipeline
15+
const pipeline = redis.pipeline();
16+
pipeline.set("e2e:p1", "a");
17+
pipeline.set("e2e:p2", "b");
18+
pipeline.get("e2e:p1");
19+
pipeline.get("e2e:p2");
20+
const pipeResults = await pipeline.exec();
21+
22+
// Cleanup
23+
await redis.del("e2e:key", "e2e:p1", "e2e:p2");
24+
await redis.quit();
25+
26+
console.log(
27+
JSON.stringify({
28+
connected: true,
29+
value,
30+
pipelineP1: pipeResults[2][1],
31+
pipelineP2: pipeResults[3][1],
32+
}),
33+
);
34+
}
35+
36+
main().catch((err) => {
37+
console.error(err.message);
38+
process.exit(1);
39+
});

0 commit comments

Comments
 (0)