Skip to content

Commit

Permalink
add nginx integration test with shell script
Browse files Browse the repository at this point in the history
  • Loading branch information
xmclark committed Jan 14, 2019
1 parent b448933 commit 0a38245
Show file tree
Hide file tree
Showing 6 changed files with 68 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,12 @@ jobs:
sudo sysctl -w kern.maxfiles=655360 kern.maxfilesperproc=327680
make test
make lint
- run:
name: Execute integration tests
command: |
export PATH="`pwd`/cmake-3.4.1-Darwin-x86_64/CMake.app/Contents/bin:$PATH"
export PATH="$HOME/.cargo/bin:$PATH"
./integration_tests/nginx/test.sh
test-and-build:
docker:
Expand Down
12 changes: 12 additions & 0 deletions integration_tests/nginx/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# `nginx` integration test


This starts wasmer with the nginx wasm file and serves an html
file with some simple text to assert on. The test script does
the assertion.

Run test with:

```
> ./integration_tests/nginx/test.sh
```
1 change: 1 addition & 0 deletions integration_tests/nginx/html/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
wasmer
1 change: 1 addition & 0 deletions integration_tests/nginx/logs/nginx.pid
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
26310
24 changes: 24 additions & 0 deletions integration_tests/nginx/nginx.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
events {
}

# We need this for now, as we want to run nginx as a worker
daemon off;
master_process off;

# We show the errors and info in stderr
error_log /dev/stderr info;

http {
# We show access in the stdout
access_log /dev/stdout;
server {
listen 8080;
server_name _;

location / {
# IMPORTANT: Replace the dir with the one you want to serve (that have an index.html file)
root ./html/;
index index.html;
}
}
}
24 changes: 24 additions & 0 deletions integration_tests/nginx/test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#! /bin/bash

# Build the release and run nginx
make release
nohup ./target/release/wasmer run examples/nginx/nginx.wasm -- -p integration_tests/nginx/ -c nginx.conf &
sleep 3s

curl localhost:8080 > ./nginx.out


if grep "wasmer" ./nginx.out
then
echo "nginx integration test succeeded"
rm ./nohup.out
rm ./nginx.out
rm -rf ./integration_tests/nginx/*_temp
exit 0
else
echo "nginx integration test failed"
rm ./nohup.out
rm ./nginx.out
rm -rf ./integration_tests/nginx/*_temp
exit -1
fi

0 comments on commit 0a38245

Please sign in to comment.