Skip to content

Commit

Permalink
Merge pull request #3500 from Unitech/test-parallel
Browse files Browse the repository at this point in the history
Test parallel
  • Loading branch information
Unitech authored Mar 26, 2018
2 parents 1325704 + e6febcd commit da56c7a
Show file tree
Hide file tree
Showing 84 changed files with 536 additions and 470 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,5 @@ package-lock.json
*.swp
*.swo
currentTagChangelog.md
joblog-X
test/fixtures/path-check*.txt
3 changes: 1 addition & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,8 @@ os:
- linux
before_install:
- sudo apt-get -qq update
- sudo apt-get install parallel
- sudo apt-get install python3
- sudo apt-get install php5-cli
services:
- docker
notifications:
slack: pm2-nodejs:5Lolyw2LMnwy8fziqOGILQxG
6 changes: 3 additions & 3 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": "NODE_ENV=test bash test/pm2_check_dependencies.sh && NODE_ENV=test bash test/pm2_programmatic_tests.sh && NODE_ENV=test bash test/pm2_behavior_tests.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 Expand Up @@ -164,6 +163,7 @@
"chalk": "^2.3.1",
"chokidar": "^2.0.2",
"cli-table-redemption": "^1.0.0",
"coffee-script": "^1.12.7",
"commander": "2.14.1",
"cron": "^1.3",
"debug": "^3.0",
Expand All @@ -174,7 +174,7 @@
"moment": "^2.19",
"needle": "^2.2.0",
"nssocket": "0.6.0",
"pidusage": "^2.0.5",
"pidusage": "^2.0.6",
"pm2-axon": "3.1.0",
"pm2-axon-rpc": "0.5.0",
"pm2-deploy": "^0.3.9",
Expand Down
7 changes: 6 additions & 1 deletion test/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
FROM node:9
FROM node:alpine

RUN mkdir -p /var/pm2

WORKDIR /var/pm2

ENV NODE_ENV test
ENV PM2_DISCRETE_MODE true

RUN apk update && apk add bash git curl python python3 php5 && rm -rf /var/cache/apk/*
RUN ln -s /usr/bin/php5 /usr/bin/php
RUN npm install -g [email protected]

CMD ["mocha", "./test/programmatic/api.mocha.js"]
24 changes: 0 additions & 24 deletions test/bash/cli-ux.sh

This file was deleted.

53 changes: 0 additions & 53 deletions test/bash/file-descriptor.sh

This file was deleted.

32 changes: 0 additions & 32 deletions test/bash/interact.sh

This file was deleted.

18 changes: 0 additions & 18 deletions test/bash/issues/2337.sh

This file was deleted.

13 changes: 10 additions & 3 deletions test/docker_parallel_test.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
# docker build -t pm2-test -f test/Dockerfile .
docker run -v `pwd`:/var/pm2 pm2-test mocha ./test/programmatic/api.mocha.js
docker run -v `pwd`:/var/pm2 pm2-test mocha ./test/programmatic/client.mocha.js
set -e

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

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

ls test/e2e/cli/* | parallel $OPTS bash

#ls test/e2e/binaries/* test/e2e/modules/* test/e2e/internal/* test/e2e/process-file/* test/e2e/cli/* test/e2e/logs/* | parallel $OPTS bash
142 changes: 142 additions & 0 deletions test/e2e.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
#!/usr/bin/env bash

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

# Abort script at first error
set -e
set -o verbose

# MODULES
bash ./test/e2e/modules/get-set.sh
spec "Configuration system working"
bash ./test/e2e/modules/module.sh
spec "module system"
bash ./test/e2e/modules/module-safeguard.sh
spec "module safeguard system (--safe)"

# CLI
bash ./test/e2e/cli/reload.sh
spec "Reload"
bash ./test/e2e/cli/operate-regex.sh
spec "Operate process that match regex"
bash ./test/e2e/cli/interpreter.sh
spec "Javascript transpilers tests"
bash ./test/e2e/cli/app-configuration.sh
spec "App configuration"
bash ./test/e2e/cli/binary.sh
spec "binary test"
bash ./test/e2e/cli/startOrX.sh
spec "startOrX commands"
bash ./test/e2e/cli/reset.sh
spec "Reset meta"
bash ./test/e2e/cli/env-refresh.sh
spec "Environment refresh on restart"
bash ./test/e2e/cli/extra-lang.sh
spec "Various programming languages checks (Python, PHP)"
bash ./test/e2e/cli/multiparam.sh
spec "Multiparam process management"
bash ./test/e2e/cli/smart-start.sh
spec "smart start test"
bash ./test/e2e/cli/args.sh
spec "check arguments passing"
bash ./test/e2e/cli/attach.sh
spec "pm2 attach method"
bash ./test/e2e/cli/serve.sh
spec "pm2 serve CLI method"
bash ./test/e2e/cli/monit.sh
spec "km selective monitoring "
bash ./test/e2e/cli/cli-actions-1.sh
spec "CLI basic test"
bash ./test/e2e/cli/cli-actions-2.sh
spec "Second hard cli tests"
bash ./test/e2e/cli/dump.sh
spec "dump test"
bash ./test/e2e/cli/resurrect.sh
spec "resurrect test"
bash ./test/e2e/cli/mjs.sh
spec "Test import syntax"
bash ./test/e2e/cli/watch.sh
spec "watch system tests"
bash ./test/e2e/cli/right-exit-code.sh
spec "Verification exit code"
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/json-reload.sh
spec "JSON reload test"
bash ./test/e2e/process-file/homogen-json-action.sh
spec "Homogen json actions"
bash ./test/e2e/process-file/app-config-update.sh
spec "CLI/JSON argument reload"
bash ./test/e2e/process-file/js-configuration.sh
spec "js configuration support"

# BINARIES
bash ./test/e2e/binaries/pm2-dev.sh
spec "pm2-dev"
bash ./test/e2e/binaries/pm2-runtime.sh
spec "pm2-runtime"

# INTERNALS
bash ./test/e2e/internals/wait-ready-event.sh
spec "Wait for application ready event"
bash ./test/e2e/internals/daemon-paths-override.sh
spec "Override daemon configuration paths"
bash ./test/e2e/internals/source_map.sh
spec "Source map resolution on exception"
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/options-via-env.sh
spec "set option via environment"
bash ./test/e2e/internals/promise.sh
spec "Promise warning message tests"
bash ./test/e2e/internals/increment-var.sh
spec "Increment env variables"
bash ./test/e2e/internals/start-consistency.sh
spec "Consistency between a JSON an CLI start"

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

# LOGS
bash ./test/e2e/logs/log-timestamp.sh
spec "timestamp prefix of pm2.log"
bash ./test/e2e/logs/log-custom.sh
spec "Custom log timestamp"
bash ./test/e2e/logs/log-reload.sh
spec "Log reload"
bash ./test/e2e/logs/log-entire.sh
spec "merge stdout && stderr"
bash ./test/e2e/logs/log-null.sh
spec "Logging path set to null"
bash ./test/e2e/logs/log-json.sh
spec "Logging directly to file in json"

$pm2 kill
16 changes: 14 additions & 2 deletions test/bash/pm2-dev.sh → test/e2e/binaries/pm2-dev.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,21 @@
#!/usr/bin/env bash

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

pm2dev="`type -P node` `pwd`/bin/pm2-dev"

pm2_path=`pwd`/bin/pm2-dev

if [ ! -f $pm2_path ];
then
pm2_path=`pwd`/../bin/pm2-dev
if [ ! -f $pm2_path ];
then
pm2_path=`pwd`/../../bin/pm2-dev
fi
fi

pm2dev="`type -P node` $pm2_path"

export PM2_HOME=$HOME'/.pm2-dev'

Expand Down
16 changes: 14 additions & 2 deletions test/bash/pm2-runtime.sh → test/e2e/binaries/pm2-runtime.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,21 @@
#!/usr/bin/env bash

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

pm2_runtime="`type -P node` `pwd`/bin/pm2-runtime"

pm2_path=`pwd`/bin/pm2-runtime

if [ ! -f $pm2_path ];
then
pm2_path=`pwd`/../bin/pm2-runtime
if [ ! -f $pm2_path ];
then
pm2_path=`pwd`/../../bin/pm2-runtime
fi
fi

pm2_runtime="`type -P node` $pm2_path"

export PM2_RUNTIME_DEBUG='true'

Expand Down
Loading

0 comments on commit da56c7a

Please sign in to comment.