Skip to content

Commit

Permalink
refactor: e2e test rewrite
Browse files Browse the repository at this point in the history
  • Loading branch information
Unitech committed Mar 20, 2018
1 parent 6da48a4 commit 2b9ffd4
Show file tree
Hide file tree
Showing 15 changed files with 39 additions and 42 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,4 @@ package-lock.json
*.swo
currentTagChangelog.md
joblog-X
test/fixtures/path-check*.txt
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,7 @@
"main": "index.js",
"types": "types/index.d.ts",
"scripts": {
"test": "bash test/docker_parallel_test.sh",
"bench-pmx": "pm2 delete all; pm2 install pm2-probe; node examples/pmx/app.js; pm2 ls"
"test": "bash test/e2e.sh; bash test/unit.sh"
},
"keywords": [
"cli",
Expand Down
2 changes: 1 addition & 1 deletion test/docker_parallel_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ set -e

docker build -t pm2-test -f test/Dockerfile .

JOBS=20
JOBS=2
OPTS="--jobs $JOBS --joblog joblog-X docker run -v `pwd`:/var/pm2 pm2-test"

ls test/e2e/cli/* | parallel $OPTS bash
Expand Down
22 changes: 11 additions & 11 deletions test/e2e.sh
Original file line number Diff line number Diff line change
Expand Up @@ -70,14 +70,14 @@ bash ./test/e2e/cli/harmony.sh
spec "Harmony test"
bash ./test/e2e/cli/fork.sh
spec "Fork system working"
bash ./test/e2e/cli/piped-config.sh
spec "Piped JSON file test"

# PROCESS FILES
bash ./test/e2e/process-file/json-file.sh
spec "JSON file test"
bash ./test/e2e/process-file/yaml-configuration.sh
spec "YAML configuration support"
bash ./test/e2e/process-file/piped-config.sh
spec "Piped JSON file test"
bash ./test/e2e/process-file/json-reload.sh
spec "JSON reload test"
bash ./test/e2e/process-file/homogen-json-action.sh
Expand All @@ -104,7 +104,7 @@ bash ./test/e2e/internals/wrapped-fork.sh
spec "wrapped fork"
bash ./test/e2e/internals/infinite-loop.sh
spec "Infinite loop stop"
bash ./test/e2e/internals/internals/options-via-env.sh
bash ./test/e2e/internals/options-via-env.sh
spec "set option via environment"
bash ./test/e2e/internals/promise.sh
spec "Promise warning message tests"
Expand All @@ -114,21 +114,21 @@ bash ./test/e2e/internals/start-consistency.sh
spec "Consistency between a JSON an CLI start"

# MISC
bash ./test/misc/inside-pm2.sh
bash ./test/e2e/misc/inside-pm2.sh
spec "Starting a process inside a PM2 process"
bash ./test/misc/vizion.sh
bash ./test/e2e/misc/vizion.sh
spec "vizion features (versioning control)"
bash ./test/misc/misc.sh
bash ./test/e2e/misc/misc.sh
spec "MISC features"
bash ./test/misc/versioning-cmd.sh
bash ./test/e2e/misc/versioning-cmd.sh
spec "versioning system tests"
bash ./test/misc/instance-number.sh
bash ./test/e2e/misc/instance-number.sh
spec "Negative instance number spawn one worker"
bash ./test/misc/startup.sh
bash ./test/e2e/misc/startup.sh
spec "upstart startup test"
bash ./test/misc/nvm-node-version.sh
bash ./test/e2e/misc/nvm-node-version.sh
spec "NVM node version setting"
bash ./test/misc/cron-system.sh
bash ./test/e2e/misc/cron-system.sh
spec "Cron system tests"

# LOGS
Expand Down
6 changes: 1 addition & 5 deletions test/e2e/cli/interpreter.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ cd $file_path/interpreter

rm -rf ../../../node_modules/coffee-script/
rm -rf ../../../node_modules/livescript/
rm -rf ../../../node_modules/ts-node/

########### coffee

Expand Down Expand Up @@ -74,11 +75,6 @@ should 'process should be online' "status: 'online'" 1

########### TYPESCRIPT

$pm2 delete all
$pm2 start echo.ts
sleep 1
should 'process should be errored without typescript installed' "status: 'errored'" 1

########### Install

$pm2 install typescript
Expand Down
29 changes: 15 additions & 14 deletions test/e2e/cli/reload.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,22 +39,23 @@ sleep 3
should 'should restart processes' 'restart_time: 1' 1
$pm2 kill

$pm2 start delayed_exit.js -i 2
should 'should start processes' 'online' 2
$pm2 stop delayed_exit.js
sleep 3
should 'should stop processes' 'stopped' 2
$pm2 restart delayed_exit.js
should 'should restart processes' 'restart_time: 0' 2
$pm2 restart delayed_exit.js
should 'should restart processes' 'restart_time: 1' 2
$pm2 reload delayed_exit.js
should 'should restart processes' 'restart_time: 2' 2
$pm2 gracefulReload delayed_exit.js
should 'should restart processes' 'restart_time: 3' 2
$pm2 kill
# $pm2 start delayed_exit.js -i 2
# should 'should start processes' 'online' 2
# $pm2 stop delayed_exit.js
# sleep 3
# should 'should stop processes' 'stopped' 2
# $pm2 restart delayed_exit.js
# should 'should restart processes' 'restart_time: 0' 2
# $pm2 restart delayed_exit.js
# should 'should restart processes' 'restart_time: 1' 2
# $pm2 reload delayed_exit.js
# should 'should restart processes' 'restart_time: 2' 2
# $pm2 gracefulReload delayed_exit.js
# should 'should restart processes' 'restart_time: 3' 2
# $pm2 kill

$pm2 start child.js -i 4
sleep 0.5
should 'should start processes' 'online' 4
$pm2 restart all
should 'should restarted be one for all' 'restart_time' 4
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/misc/cron-system.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env bash

SRC=$(cd $(dirname "$0"); pwd)
source "${SRC}/include.sh"
source "${SRC}/../include.sh"

cd $file_path

Expand Down
2 changes: 1 addition & 1 deletion test/e2e/misc/inside-pm2.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env bash

SRC=$(cd $(dirname "$0"); pwd)
source "${SRC}/include.sh"
source "${SRC}/../include.sh"

cd $file_path

Expand Down
4 changes: 2 additions & 2 deletions test/e2e/misc/instance-number.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#!/usr/bin/env bash

SRC=$(cd $(dirname "$0"); pwd)
source "${SRC}/include.sh"
source "${SRC}/../include.sh"
cd $file_path

$pm2 start server.js -i -100
should 'should have started 1 processes' 'online' 1

$pm2 delete all
$pm2 delete all
2 changes: 1 addition & 1 deletion test/e2e/misc/misc.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env bash

SRC=$(cd $(dirname "$0"); pwd)
source "${SRC}/include.sh"
source "${SRC}/../include.sh"

cd $file_path

Expand Down
2 changes: 1 addition & 1 deletion test/e2e/misc/pull.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env bash

SRC=$(cd $(dirname "$0"); pwd)
source "${SRC}/include.sh"
source "${SRC}/../include.sh"

echo -e "\033[1mRunning tests:\033[0m"

Expand Down
2 changes: 1 addition & 1 deletion test/e2e/misc/startup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ then
fi

SRC=$(cd $(dirname "$0"); pwd)
source "${SRC}/include.sh"
source "${SRC}/../include.sh"

cd $file_path
$pm2 startup upstart -u $USER --hp $HOME --service-name abcdef
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/misc/versioning-cmd.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env bash

SRC=$(cd $(dirname "$0"); pwd)
source "${SRC}/include.sh"
source "${SRC}/../include.sh"

cd $file_path

Expand Down
2 changes: 1 addition & 1 deletion test/e2e/misc/vizion.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env bash

SRC=$(cd $(dirname "$0"); pwd)
source "${SRC}/include.sh"
source "${SRC}/../include.sh"

cd $file_path

Expand Down
File renamed without changes.

0 comments on commit 2b9ffd4

Please sign in to comment.