Skip to content
This repository has been archived by the owner on Sep 19, 2024. It is now read-only.

Commit

Permalink
do 100 requests towards nginx in smoke test
Browse files Browse the repository at this point in the history
  • Loading branch information
waynz0r committed Mar 11, 2024
1 parent 7112743 commit 5c99f9f
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 35 deletions.
35 changes: 2 additions & 33 deletions .github/actions/smoketest/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,42 +11,11 @@ runs:
touch /tmp/camblet.log /tmp/file-server.log /tmp/python.log
echo "Run processes"
sudo AGENT_METADATACOLLECTORS_DOCKER_ENABLED=true camblet agent > /tmp/camblet.log &
go build test/file-server.go
./file-server >/tmp/file-server.log &
docker run -d --rm -p 8080:80 nginx
sleep 2
echo "Test downloading a bigger file"
head -c 2M </dev/urandom > bigfile.o
curl -v -o /tmp/bigfile_downloaded.o http://localhost:8000/bigfile.o
./test/smoke.sh
echo "Test uploading this file"
curl -v -F "bigfile_downloaded.o=@/tmp/bigfile_downloaded.o" http://localhost:8000/upload
diff bigfile.o bigfile_downloaded.o
echo "Test bearssl with non-bearssl compatibility"
python3 -m http.server 7000 >/tmp/python.log &
sleep 1
echo "testing with curl..."
curl -k -v https://localhost:7000/
echo "testing with wget..."
wget --no-check-certificate https://localhost:7000/
echo "Test openssl client connect to python with default cipher"
openssl s_client -connect 127.0.0.1:7000
echo "Test openssl client connect to python with ECDHE-RSA-CHACHA20-POLY1305 cipher"
openssl s_client -cipher ECDHE-RSA-CHACHA20-POLY1305 -connect 127.0.0.1:7000
echo "Test sendfile with NGiNX using curl"
curl -v http://localhost:8080
echo "Test sendfile with NGiNX using wget"
wget -v http://localhost:8000
echo "Stop processes"
sudo kill -9 $(jobs -p)
echo "Stop camblet"
sudo pkill -9 camblet
docker kill $(docker ps -q)
- name: Kernel log
if: always()
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ jobs:
working-directory: camblet-driver
run: |
sudo modprobe tls
sudo modprobe camblet ktls_available=1
sudo modprobe camblet dyndbg==_ ktls_available=1
sudo dmesg -T
# - name: Setup upterm session
Expand All @@ -91,7 +91,7 @@ jobs:
working-directory: camblet-driver
run: |
sudo rmmod tls
sudo modprobe camblet ktls_available=0
sudo modprobe camblet dyndbg==_ ktls_available=0
sudo dmesg -T
- name: Run proxy-wasm smoke test with bearSSL
Expand Down
55 changes: 55 additions & 0 deletions test/smoke.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
#!/bin/bash

set -euo pipefail

echo "Building file server"
go build test/file-server.go

echo "Starting file server"
./file-server >/tmp/file-server.log 2>&1 &

echo "Starting NGiNX in docker"
sudo docker run -d --rm -p 8080:80 nginx

sleep 2

echo "Test downloading a bigger file"
head -c 2M </dev/urandom > bigfile.o
curl -v -o /tmp/bigfile_downloaded.o http://localhost:8000/bigfile.o

echo "Test uploading this file"
curl -v -F "bigfile_downloaded.o=@/tmp/bigfile_downloaded.o" http://localhost:8000/upload
diff bigfile.o bigfile_downloaded.o

echo "Test bearssl with non-bearssl compatibility"
python3 -m http.server 7000 >/tmp/python.log &
sleep 1
echo "testing with curl..."
curl -k -v https://localhost:7000/
echo "testing with wget..."
wget --no-check-certificate https://localhost:7000/

echo "Test openssl client connect to python with default cipher"
echo -e "GET / HTTP/1.1\r\n\r\n" | openssl s_client -connect 127.0.0.1:7000
echo "Test openssl client connect to python with ECDHE-RSA-CHACHA20-POLY1305 cipher"
echo -e "GET / HTTP/1.1\r\n\r\n" | openssl s_client -cipher ECDHE-RSA-CHACHA20-POLY1305 -connect 127.0.0.1:7000

# turn off because of know issue
# echo "Test file-server using curl"
# rm -f testfile test.output
# echo "response" > testfile
# echo -e " 100 0\n 100 response" > test.output
# for i in `seq 1 100`; do curl -s localhost:8000/testfile; echo $?; done |sort|uniq -c|diff - test.output

echo "Test sendfile with NGiNX using curl"
echo -e " 100 0" > test.output
for i in `seq 1 100`; do curl -s -o/dev/null localhost:8080; echo $?; done |sort|uniq -c|diff - test.output

echo "Test sendfile with NGiNX using wget"
echo -e " 100 0" > test.output
for i in `seq 1 100`; do wget -q -O/dev/null localhost:8080; echo $?; done |sort|uniq -c|diff - test.output

echo "Stop processes"
sudo pkill python3
sudo pkill file-server
sudo docker kill $(sudo docker ps -q)

0 comments on commit 5c99f9f

Please sign in to comment.