Merge branch 'master' into feature-run-env
This commit is contained in:
5
tests/apps/dockerfile-dokku-scale/CHECKS
Normal file
5
tests/apps/dockerfile-dokku-scale/CHECKS
Normal file
@@ -0,0 +1,5 @@
|
||||
WAIT=2 # wait 2 seconds
|
||||
TIMEOUT=5 # set timeout to 5 seconds
|
||||
ATTEMPTS=2 # try 2 times
|
||||
|
||||
/ nodejs/express
|
||||
1
tests/apps/dockerfile-dokku-scale/DOKKU_SCALE
Normal file
1
tests/apps/dockerfile-dokku-scale/DOKKU_SCALE
Normal file
@@ -0,0 +1 @@
|
||||
web=1
|
||||
11
tests/apps/dockerfile-dokku-scale/Dockerfile
Normal file
11
tests/apps/dockerfile-dokku-scale/Dockerfile
Normal file
@@ -0,0 +1,11 @@
|
||||
FROM node:4
|
||||
|
||||
EXPOSE 3001/udp
|
||||
EXPOSE 3000/tcp
|
||||
EXPOSE 3003
|
||||
|
||||
COPY . /app
|
||||
WORKDIR /app
|
||||
RUN npm install
|
||||
|
||||
CMD npm start
|
||||
8
tests/apps/dockerfile-dokku-scale/Procfile
Normal file
8
tests/apps/dockerfile-dokku-scale/Procfile
Normal file
@@ -0,0 +1,8 @@
|
||||
###############################
|
||||
# DEVELOPMENT #
|
||||
###############################
|
||||
|
||||
# Procfile for development using the new threaded worker (scheduler, twitter stream and delayed job)
|
||||
cron: node worker.js
|
||||
web: node web.js
|
||||
worker: node worker.js
|
||||
5
tests/apps/dockerfile-dokku-scale/check_deploy
Executable file
5
tests/apps/dockerfile-dokku-scale/check_deploy
Executable file
@@ -0,0 +1,5 @@
|
||||
#!/usr/bin/env bash
|
||||
set -e
|
||||
output="$(curl -s -S "$1")"
|
||||
echo "$output"
|
||||
test "$output" == "nodejs/express"
|
||||
13
tests/apps/dockerfile-dokku-scale/package.json
Normal file
13
tests/apps/dockerfile-dokku-scale/package.json
Normal file
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"name": "node-example",
|
||||
"version": "0.0.1",
|
||||
"dependencies": {
|
||||
"express": "2.5.x"
|
||||
},
|
||||
"engines": {
|
||||
"node": "4.2.x"
|
||||
},
|
||||
"scripts": {
|
||||
"start": "false"
|
||||
}
|
||||
}
|
||||
12
tests/apps/dockerfile-dokku-scale/web.js
Normal file
12
tests/apps/dockerfile-dokku-scale/web.js
Normal file
@@ -0,0 +1,12 @@
|
||||
var express = require('express');
|
||||
|
||||
var app = express.createServer(express.logger());
|
||||
|
||||
app.get('/', function(request, response) {
|
||||
response.send('nodejs/express');
|
||||
});
|
||||
|
||||
var port = process.env.PORT || 5000;
|
||||
app.listen(port, function() {
|
||||
console.log("Listening on " + port);
|
||||
});
|
||||
6
tests/apps/dockerfile-dokku-scale/worker.js
Normal file
6
tests/apps/dockerfile-dokku-scale/worker.js
Normal file
@@ -0,0 +1,6 @@
|
||||
function worker() {
|
||||
console.log('sleeping for 60 seconds');
|
||||
setTimeout(worker, 60 * 1000);
|
||||
}
|
||||
|
||||
worker();
|
||||
@@ -134,6 +134,35 @@ teardown() {
|
||||
assert_success
|
||||
}
|
||||
|
||||
@test "(ps:scale) dockerfile dokku-scale" {
|
||||
run /bin/bash -c "dokku ps:scale $TEST_APP web=2"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
deploy_app dockerfile-dokku-scale
|
||||
CIDS=""
|
||||
for CID_FILE in $DOKKU_ROOT/$TEST_APP/CONTAINER.web.*; do
|
||||
CIDS+=$(< $CID_FILE)
|
||||
CIDS+=" "
|
||||
done
|
||||
CIDS_PATTERN=$(echo $CIDS | sed -e "s: :|:g")
|
||||
run /bin/bash -c "docker ps -q --no-trunc | egrep \"$CIDS_PATTERN\" | wc -l | grep 1"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku ps:scale $TEST_APP web=1"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_failure
|
||||
|
||||
run /bin/bash -c "dokku ps:report $TEST_APP --ps-can-scale"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_output "false"
|
||||
}
|
||||
|
||||
@test "(ps) dockerfile with procfile" {
|
||||
deploy_app dockerfile-procfile
|
||||
run /bin/bash -c "dokku ps:stop $TEST_APP"
|
||||
|
||||
@@ -234,6 +234,24 @@ teardown() {
|
||||
assert_success
|
||||
}
|
||||
|
||||
@test "(domains) domains:clear-global" {
|
||||
run /bin/bash -c "dokku domains:add-global global.dokku.invalid"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku domains:add-global global.dokku.me"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku domains:clear-global"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
refute_line "global.dokku.invalid"
|
||||
refute_line "global.dokku.me"
|
||||
}
|
||||
|
||||
@test "(domains) domains:remove-global" {
|
||||
run /bin/bash -c "dokku domains:add-global global.dokku.me"
|
||||
echo "output: $output"
|
||||
@@ -284,3 +302,22 @@ teardown() {
|
||||
assert_line ${TEST_APP}.global3.dokku.me
|
||||
assert_line ${TEST_APP}.global4.dokku.me
|
||||
}
|
||||
|
||||
@test "(domains) app name overlaps with global domain.tld" {
|
||||
run /bin/bash -c "dokku domains:set-global dokku.test"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
# run domains:clear in order to invoke default vhost creation
|
||||
dokku --quiet apps:create test.dokku.test
|
||||
dokku --quiet domains:clear test.dokku.test
|
||||
|
||||
run /bin/bash -c "dokku domains:report test.dokku.test --domains-app-vhosts"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output "test.dokku.test"
|
||||
|
||||
dokku --force apps:destroy test.dokku.test
|
||||
}
|
||||
|
||||
@@ -116,12 +116,21 @@ teardown() {
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku resource:reserve --cpu 0.5 --process-type worker $TEST_APP"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
dokku ps:rebuild "$TEST_APP"
|
||||
CID=$(< $DOKKU_ROOT/$TEST_APP/CONTAINER.web.1)
|
||||
run /bin/bash -c "docker inspect --format '{{.HostConfig.MemoryReservation}}' $CID"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_output "536870912"
|
||||
# run /bin/bash -c "docker inspect --format '{{.HostConfig.NanoCpus}}' $CID"
|
||||
# echo "output: $output"
|
||||
# echo "status: $status"
|
||||
# assert_output "500000000"
|
||||
|
||||
run /bin/bash -c "dokku resource:reserve-clear --process-type worker $TEST_APP"
|
||||
echo "output: $output"
|
||||
|
||||
Reference in New Issue
Block a user