Skip to content

Commit 779c2b0

Browse files
author
magne
committed
chore: add test envs
1 parent 31bca3d commit 779c2b0

File tree

3 files changed

+17
-7
lines changed

3 files changed

+17
-7
lines changed

.github/workflows/main.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ jobs:
2323
image: rabbitmq:4.1.0-management
2424
options: --hostname test-node --name test-node
2525
env:
26+
RABBITMQ_HOSTNAME: "test-node"
2627
RABBITMQ_DEFAULT_USER: "test-user"
2728
RABBITMQ_DEFAULT_PASS: "test-password"
2829
volumes:
@@ -75,4 +76,4 @@ jobs:
7576
# - run: cd performance_test && npm install && npm run perftest 100000
7677
# env:
7778
# RABBITMQ_USER: "test-user"
78-
# RABBITMQ_PASSWORD: "test-password"
79+
# RABBITMQ_PASSWORD: "test-password"

cspell.json

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,13 @@
11
{
22
"language": "en",
3-
"words": ["ackmode", "ampq", "prefetch", "amqpvalue", "RABBITMQ", "Sasl"]
3+
"words": [
4+
"ackmode",
5+
"ampq",
6+
"amqpvalue",
7+
"perftest",
8+
"prefetch",
9+
"RABBITMQ",
10+
"rabbitmqctl",
11+
"Sasl"
12+
]
413
}

test/support/util.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@ export type QueueInfoResponse = {
55
name: string
66
}
77

8-
const host = "localhost"
9-
const port = 15672
8+
const host = process.env.RABBITMQ_HOSTNAME ?? "localhost"
9+
const managementPort = 15672
1010
const vhost = encodeURIComponent("/")
11-
const password = "rabbit"
12-
const username = "rabbit"
11+
export const username = process.env.RABBITMQ_USER ?? "rabbit"
12+
export const password = process.env.RABBITMQ_PASSWORD ?? "rabbit"
1313

1414
export async function existsQueue(queueName: string): Promise<boolean> {
1515
const response = await getQueueInfo(queueName)
@@ -24,7 +24,7 @@ export async function existsQueue(queueName: string): Promise<boolean> {
2424
}
2525

2626
async function getQueueInfo(queue: string): Promise<KyResponse<QueueInfoResponse>> {
27-
const response = await ky.get<QueueInfoResponse>(`http://${host}:${port}/api/queues/${vhost}/${queue}`, {
27+
const response = await ky.get<QueueInfoResponse>(`http://${host}:${managementPort}/api/queues/${vhost}/${queue}`, {
2828
headers: {
2929
Authorization: Buffer.from(`${username}:${password}`).toString("base64"),
3030
},

0 commit comments

Comments
 (0)