Skip to content

Commit

Permalink
fix: verify default conf variable via package.json on public module
Browse files Browse the repository at this point in the history
  • Loading branch information
Unitech committed May 10, 2018
1 parent adcbebc commit 157b106
Showing 1 changed file with 18 additions and 15 deletions.
33 changes: 18 additions & 15 deletions test/e2e/modules/module.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ $pm2 kill
#
#

$pm2 unset pm2-probe

$pm2 set 'pm2-probe:config1xxx' true

$pm2 install pm2-probe
Expand All @@ -29,11 +31,15 @@ should 'should app be online' 'online' 1
ls ~/.pm2/modules/pm2-probe
spec "Module should be installed"


# Default configuration variable in package.json (under "config" attribute)
should 'should have default config variable via package.json' "var2: false" 4

#
# Should configuration variable be present two times
# one time in the raw env, and a second time prefixed with the module name
#
exists '1# should have config variable' "config1xxx: 'true'" 4
exists '1# should have config variable' "config1xxx: 'true'" 6

#
# Change variable value
Expand Down Expand Up @@ -98,21 +104,18 @@ $pm2 install .
sleep 0.5
spec 'Should have installed module'

# Default configuration variable in package.json (under "config" attribute)
# Only 2 occurences because this is the first start
should 'should have config variable' "var2: false" 2

# Override environment variable
$pm2 set example-module:var2 true
sleep 0.5
should 'should module been restarted after setting variable' 'restart_time: 1' 1
# # Override environment variable
# $pm2 set example-module:var2 true
# sleep 0.5
# should 'should module been restarted after setting variable' 'restart_time: 1' 1

# 4 occurences because of a restart
should 'should have config variable modified' "var2: 'true'" 4
# # 4 occurences because of a restart
# should 'should have config variable modified' "var2: 'true'" 4

$pm2 set example-module:newvar true
sleep 0.5
should 'should module been restarted after setting variable' 'restart_time: 2' 1
# $pm2 set example-module:newvar true
# sleep 0.5
# should 'should module been restarted after setting variable' 'restart_time: 2' 1

# 4 occurences because of a restart
should 'should have config variable modified' "newvar: 'true'" 4
# # 4 occurences because of a restart
# should 'should have config variable modified' "newvar: 'true'" 4

0 comments on commit 157b106

Please sign in to comment.