Add tests for nginx.conf directives #1
@ -32,6 +32,11 @@ http {
|
||||
}
|
||||
}
|
||||
|
||||
server {
|
||||
server_name apps.miti.sh;
|
||||
root /var/www/sites/apps.miti.sh;
|
||||
}
|
||||
|
||||
server {
|
||||
# listen 443 ssl;
|
||||
server_name webdevcat.me;
|
||||
|
@ -8,6 +8,12 @@ req = (url) ->
|
||||
error request\lastError! if not st
|
||||
request
|
||||
|
||||
describe "test environment", ->
|
||||
it "can't connect to the internet", ->
|
||||
request = http.init "http://example.org"
|
||||
assert.not_true request\perform!
|
||||
assert.same request\lastError!, "Couldn't resolve host name"
|
||||
|
||||
describe "http://webdevcat.me", ->
|
||||
it "permanently redirects to http://miti.sh", ->
|
||||
request = req "http://webdevcat.me"
|
||||
@ -69,3 +75,9 @@ describe "http://miti.sh/posts", ->
|
||||
assert.same request\statusCode!, 200
|
||||
assert.same request\statusMessage!, "OK"
|
||||
assert.same request\body!\match("<title>(.*)</title>"), "miti.sh · Posts"
|
||||
|
||||
describe "http://apps.miti.sh", ->
|
||||
it "doesn't find it", ->
|
||||
request = req "http://apps.miti.sh"
|
||||
assert.same request\statusCode!, 404
|
||||
assert.same request\statusMessage!, "Not Found"
|
||||
|
6
test.sh
6
test.sh
@ -5,8 +5,12 @@
|
||||
image=miti.sh
|
||||
|
||||
echo "Starting test container..."
|
||||
container_id=$(docker run --rm -d -v $(pwd):/opt/app \
|
||||
|
||||
# Make sure to create 'no-internet' network, if it doesn't already exist:
|
||||
# $ docker network create --internal no-internet
|
||||
container_id=$(docker run --rm -d -v $(pwd):/opt/app --network no-internet \
|
||||
--add-host=miti.sh=127.0.0.1 \
|
||||
--add-host=apps.miti.sh=127.0.0.1 \
|
||||
--add-host=webdevcat.me=127.0.0.1 \
|
||||
$image)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user