|
| 1 | +Node 10 Example |
| 2 | +=============== |
| 3 | + |
| 4 | +This example exists primarily to test the following documentation: |
| 5 | + |
| 6 | +* [Node 10-11 Service](https://docs.devwithlando.io/tutorials/node.html) |
| 7 | + |
| 8 | +Start up tests |
| 9 | +-------------- |
| 10 | + |
| 11 | +Run the following commands to get up and running with this example. |
| 12 | + |
| 13 | +```bash |
| 14 | +# Should start up successfully |
| 15 | +lando poweroff |
| 16 | +lando start |
| 17 | +``` |
| 18 | + |
| 19 | +Verification commands |
| 20 | +--------------------- |
| 21 | + |
| 22 | +Run the following commands to validate things are rolling as they should. |
| 23 | + |
| 24 | +```bash |
| 25 | +# Should use 10.x as the default version |
| 26 | +lando ssh -s defaults -c "env | grep NODE_VERSION=10." |
| 27 | + |
| 28 | +# Should use a user specified version if given |
| 29 | +lando ssh -s custom -c "env | grep NODE_VERSION=11." |
| 30 | + |
| 31 | +# Should use a user specified patch version if given |
| 32 | +lando ssh -s patch -c "env | grep NODE_VERSION=10.19.0" |
| 33 | + |
| 34 | +# Should serve over port 80 by default |
| 35 | +lando ssh -s defaults -c "curl http://localhost | grep tune" |
| 36 | + |
| 37 | +# Should set NODE_EXTRA_CA_CERTS with lando domain CA |
| 38 | +lando ssh -s defaults -c "env" | grep NODE_EXTRA_CA_CERTS | grep "$LANDO_CA_CERT" |
| 39 | + |
| 40 | +# Should only serve over http by default |
| 41 | +lando ssh -s defaults -c "curl https://localhost" || echo $? | grep 1 |
| 42 | + |
| 43 | +# Should serve over specified ports if given |
| 44 | +lando ssh -s custom -c "curl http://localhost:3000 | grep tune" |
| 45 | + |
| 46 | +# Should serve over https is ssl is set by user |
| 47 | +lando ssh -s custom -c "curl https://localhost | grep tune" |
| 48 | + |
| 49 | +# Should serve over a custom https port if ssl is set to a specific port |
| 50 | +lando ssh -s custom2 -c "curl https://localhost:4444 | grep DANCING" |
| 51 | + |
| 52 | +# Should run as root if it needs to |
| 53 | +lando ssh -s defaults -c "ps -a -u root" | grep "node" | wc -l | grep 2 |
| 54 | +lando ssh -s defaults -c "ls -lsa /certs" | grep "root root" | wc -l | grep 10 |
| 55 | +lando ssh -s custom -c "ps -a -u root" | grep "node" | wc -l | grep 2 |
| 56 | +lando ssh -s custom -c "ls -lsa /certs" | grep "root root" | wc -l | grep 10 |
| 57 | + |
| 58 | +# Should run as node if it can |
| 59 | +lando ssh -s custom2 -c "ps -a -u node" | grep "node" | wc -l | grep 2 |
| 60 | +lando ssh -s custom2 -c "ls -lsa /certs" | grep "node" | wc -l | grep 8 |
| 61 | + |
| 62 | +# Should install global dependencies if specified by user and have them available in PATH |
| 63 | +lando ssh -s custom -c "gulp -v" |
| 64 | +lando ssh -s custom -c "which gulp | grep /var/www/.npm-global" |
| 65 | + |
| 66 | +# Should PATH prefer node dependency binaries installed in /app/node_modules over global ones |
| 67 | +lando ssh -s custom -c "npm install gulp-cli --no-save" |
| 68 | +lando ssh -s custom -c "gulp -v" |
| 69 | +lando ssh -s custom -c "which gulp | grep /app/node_modules/.bin" |
| 70 | +lando ssh -s custom -c "npm uninstall gulp-cli" |
| 71 | +lando ssh -s custom -c "which gulp | grep /var/www/.npm-global" |
| 72 | + |
| 73 | +# Should not serve port for cli |
| 74 | +lando ssh -s cli -c "curl http://localhost" || echo $? | grep 1 |
| 75 | +``` |
| 76 | + |
| 77 | +Destroy tests |
| 78 | +------------- |
| 79 | + |
| 80 | +Run the following commands to trash this app like nothing ever happened. |
| 81 | + |
| 82 | +```bash |
| 83 | +# Should be destroyed with success |
| 84 | +lando destroy -y |
| 85 | +lando poweroff |
| 86 | +``` |
0 commit comments