Skip to content

Commit

Permalink
Update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
triole committed Dec 11, 2023
1 parent a354cbf commit a7a42f5
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 7 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
.imdone/
.task/
build/
testdata/bin/
tmp/

go.trace
secret.toml
8 changes: 4 additions & 4 deletions Taskfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,12 @@ tasks:
desc: run docker to test memory issue inside
dir: testdata
cmds:
- cmd: cp "{{.CURDIR}}/build/linux_x86_64/logaxe" "{{.CURDIR}}/testdata/tmp"
- cmd: cp "{{.CURDIR}}/build/linux_x86_64/logaxe" "{{.CURDIR}}/testdata/bin/"
- cmd: cp "$(which fakedata)" "{{.CURDIR}}/testdata/bin/"
- cmd: docker build --tag logaxe-test .
- cmd: >-
docker ps -a | grep logaxe-test | grep -Po "^[0-9a-f]+"
| xargs -i docker rm {}
- cmd: >-
docker run --kernel-memory="500m" --memory-swap="400m"
--memory="300m" --name logaxe-test logaxe-test
- cmd: docker logs -f logaxe-test
docker run --kernel-memory="64m" --memory-swap="128m"
--memory="128m" --name logaxe-test logaxe-test
6 changes: 3 additions & 3 deletions testdata/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM centos:latest
COPY ./tmp/logaxe /
RUN dd if=/dev/random of=/sample.log bs=1G count=1
CMD ["/logaxe", "/"]
COPY ./bin/* /usr/bin/
COPY ./drun.sh /
CMD ["/drun.sh"]
16 changes: 16 additions & 0 deletions testdata/drun.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/sh
fol="/tmp/log"

rcmd() {
cmd=${@}
echo -e "\033[0;93m${cmd}\033[0m"
eval ${cmd}
}

rcmd mkdir -p "${fol}"

cd ${fol} && {
rcmd dd if=/dev/random of=sample.log bs=2M count=1024
rcmd logaxe "${fol}"
ls -lah
}

0 comments on commit a7a42f5

Please sign in to comment.