Skip to content

Commit 42f8729

Browse files
committed
feature: auto test code
1 parent 76da873 commit 42f8729

File tree

2 files changed

+70
-0
lines changed

2 files changed

+70
-0
lines changed

.github/workflows/integ_tests.yaml

+68
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
name: Integration Tests
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
9+
env:
10+
CARGO_TERM_COLOR: always
11+
12+
jobs:
13+
test:
14+
name: Integration Tests
15+
runs-on: ubuntu-latest
16+
17+
services:
18+
redis:
19+
image: redis
20+
ports:
21+
- 6379:6379
22+
rabbitmq:
23+
image: rabbitmq:management
24+
ports:
25+
- 5672:5672
26+
- 15672:15672
27+
28+
steps:
29+
- uses: actions/checkout@v4
30+
31+
- name: Install Rust toolchain
32+
uses: actions-rs/toolchain@v1
33+
with:
34+
profile: minimal
35+
toolchain: stable
36+
override: true
37+
38+
- name: Cache dependencies
39+
uses: actions/cache@v3
40+
with:
41+
path: |
42+
~/.cargo/bin/
43+
~/.cargo/registry/index/
44+
~/.cargo/registry/cache/
45+
~/.cargo/git/db/
46+
target/
47+
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
48+
restore-keys: ${{ runner.os }}-cargo-
49+
50+
- name: Run Redis tests
51+
run: cargo test --features redis
52+
env:
53+
BROCCOLI_QUEUE_URL: redis://localhost:6379
54+
55+
- name: Run RabbitMQ tests
56+
run: cargo test --features rabbitmq
57+
env:
58+
BROCCOLI_QUEUE_URL: amqp://localhost:5672
59+
60+
- name: Run RabbitMQ tests with delay plugin
61+
run: |
62+
docker stop ${{ job.services.rabbitmq.id }}
63+
docker build -f Dockerfile.rabbitmq -t rabbitmq-with-delays .
64+
docker run -d --name rabbitmq-delay -p 5672:5672 -p 15672:15672 rabbitmq-with-delays
65+
sleep 15 # Wait for RabbitMQ to start
66+
cargo test --features rabbitmq,rabbitmq-delay
67+
env:
68+
BROCCOLI_QUEUE_URL: amqp://localhost:5672

run-tests.sh

+2
Original file line numberDiff line numberDiff line change
@@ -50,3 +50,5 @@ case "$1" in
5050
run_rabbitmq_test
5151
;;
5252
esac
53+
54+

0 commit comments

Comments
 (0)