Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improvement/nginx integraton test #91

Merged
merged 1 commit into from
Jan 14, 2019

Conversation

xmclark
Copy link
Contributor

@xmclark xmclark commented Jan 11, 2019

Add an integration test for running nginx with wasmer.

This is a brute-force, straight-forward solution. A shell script that starts the nginx server, and then curls it.



#[test]
fn test_nginx() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think for the integrations simpler might be easier to do it directly with a shell script that can run in CircleCI.
(rather than a rust test itself, that we need to compile first to execute later).

Thoughts?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes! @lachlansneff and I talked about writing it in rust. I said I would try it out and this is my stab/iteration.

It does seem a little overkill. My first thought was to write a shell script.

A benefit is our testing lives all under-one-roof. Cargo is the sole program we interact with for running tests. We get the benefit of assertions, cargo visualization, control flow, etc.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it could be as simple as a shell script like this. @syrusakbary , if you prefer the simplicity of the shell script, I can drop this PR and make something like this:

# nginx.sh
#! /bin/bash

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

curl localhost:8080 > ./nginx.out


if grep "<title>Nginx running with Wasmer</title>" ./nginx.out
then
    echo "SUCCESS"
    exit 0
else
    echo "FAILURE"
    exit 1
fi

rm ./nginx.out

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I went ahead and switched it to a shell script.

Makefile Outdated
@@ -28,7 +28,7 @@ precommit: lint test

test:
# We use one thread so the emscripten stdouts doesn't collide
cargo test -- --test-threads=1 $(runargs)
cargo test test_nginx # -- --test-threads=1 $(runargs)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you committed this one by mistake.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I went ahead and switched it to a shell script. This should be reverted now :)

@xmclark xmclark force-pushed the improvement/nginx-integraton-test branch 5 times, most recently from 6756053 to 30f87d0 Compare January 14, 2019 00:28
@xmclark xmclark force-pushed the improvement/nginx-integraton-test branch from 30f87d0 to 0a38245 Compare January 14, 2019 00:29
@xmclark xmclark changed the title WIP - Improvement/nginx integraton test Improvement/nginx integraton test Jan 14, 2019
Copy link
Member

@syrusakbary syrusakbary left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great!

@xmclark xmclark merged commit e05e71a into master Jan 14, 2019
@xmclark xmclark deleted the improvement/nginx-integraton-test branch January 14, 2019 04:57
nlewycky pushed a commit that referenced this pull request Aug 13, 2020
Added first compiler target iteration
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants