Skip to content

Commit 41f35df

Browse files
committed
fix: create dir, add test
1 parent 5997ac1 commit 41f35df

File tree

2 files changed

+30
-0
lines changed

2 files changed

+30
-0
lines changed

.github/workflows/verify.yaml

+28
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,37 @@ jobs:
2222
- name: Run image
2323
run: docker run -p 2444:2444/udp -d udp-echo
2424

25+
- name: Get container ID
26+
run: |
27+
CONTAINER_ID=$(docker ps -q --filter "ancestor=udp-echo")
28+
echo "CONTAINER_ID=$CONTAINER_ID" >> $GITHUB_ENV
29+
2530
- name: Run tests
2631
run: deno test --allow-net --allow-env test.ts
2732

33+
- name: Get log file
34+
run: |
35+
LOG_FILES=(docker exec ${{ env.CONTAINER_ID }} bash -c 'ls /var/log/academy/')
36+
for file in "${LOG_FILES[@]}"; do
37+
docker cp ${{ env.CONTAINER_ID }}:/var/log/academy/$file ./
38+
done
39+
40+
- name: Test log file
41+
run: |
42+
LOG_FILE=(*-udp-echo.log)
43+
if [[ -f $LOG_FILE ]]; then
44+
echo "Log file exists: $LOG_FILE"
45+
else
46+
echo "Log file does not exist: $LOG_FILE"
47+
# exit 1
48+
fi
49+
grep -E "^20[0-9]{2}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}\.[0-9]+[^,]+,UDP,echo$" $LOG_FILE
50+
51+
- uses: actions/upload-artifact@v4
52+
with:
53+
name: metric-logs-${{ github.sha }}
54+
path: *-udp-echo.log
55+
2856
- name: Login to Azure Container Registry
2957
uses: docker/login-action@v3
3058
with:

Dockerfile

+2
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ EOT
1313

1414
COPY server.py /server.py
1515

16+
RUN mkdir /var/log/academy
17+
1618
EXPOSE 2444/udp
1719

1820
CMD [ "python3", "/server.py"]

0 commit comments

Comments
 (0)