Skip to content

Commit e7f10a8

Browse files
authored
add some simple integration tests (#15)
1 parent ed8c5a1 commit e7f10a8

File tree

3 files changed

+59
-0
lines changed

3 files changed

+59
-0
lines changed
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
name: Integration Test
2+
3+
on:
4+
push:
5+
branches: [ master ]
6+
pull_request:
7+
8+
jobs:
9+
test:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- uses: actions/checkout@v3
14+
15+
- name: Run integration tests
16+
run: make test

Dockerfile

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
FROM ubuntu:22.04
2+
3+
# Install required packages
4+
RUN apt-get update && \
5+
apt-get install -y \
6+
net-tools \
7+
iproute2 \
8+
&& rm -rf /var/lib/apt/lists/*
9+
10+
# Copy the script
11+
COPY check_netio.sh /usr/local/bin/check_netio.sh
12+
13+
# Make it executable
14+
RUN chmod +x /usr/local/bin/check_netio.sh
15+
16+
# Set working directory
17+
WORKDIR /usr/local/bin
18+
19+
# Default command that runs basic test
20+
CMD ["./check_netio.sh", "-i", "eth0"]

Makefile

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
.PHONY: build test test-basic test-error test-tcp test-legacy test-invalid
2+
3+
IMAGE_NAME = check-netio
4+
5+
build:
6+
docker build -t $(IMAGE_NAME) .
7+
8+
test-basic: build
9+
docker run --network host $(IMAGE_NAME)
10+
11+
test-error: build
12+
docker run --network host $(IMAGE_NAME) ./check_netio.sh -i eth0 -e
13+
14+
test-tcp: build
15+
docker run --network host $(IMAGE_NAME) ./check_netio.sh -i eth0 -t
16+
17+
test-legacy: build
18+
docker run --network host $(IMAGE_NAME) ./check_netio.sh -i eth0 -l
19+
20+
test-invalid: build
21+
docker run --network host $(IMAGE_NAME) ./check_netio.sh -i eth999 || test $$? -eq 3
22+
23+
test: test-basic test-error test-tcp test-legacy test-invalid

0 commit comments

Comments
 (0)