tools/run-all-tests.sh now also tests a fake installed version of meteor

This commit is contained in:
Avital Oliver
2013-02-11 23:46:59 -08:00
committed by David Glasser
parent d730b9f658
commit 8fdb40c58b
3 changed files with 49 additions and 12 deletions

View File

@@ -31,6 +31,10 @@ var warehouse = module.exports = {
// $HOME/.meteor. If we're running a checkout, found at
// $CHECKOUT/.meteor.
getWarehouseDir: function () {
// a hook for tests
if (process.env.TEST_WAREHOUSE_DIR)
return process.env.TEST_WAREHOUSE_DIR;
if (files.in_checkout())
return path.join(files.get_core_dir(), '.meteor');
else

View File

@@ -1,10 +1,15 @@
#!/bin/bash
# NOTE: by default this tests the working copy, not the installed meteor.
# To test the installed meteor, pass in --global
# NOTE: by default this tests the working copy, not the installed
# meteor. To test the installed meteor, pass in --global. To test a
# version of meteor installed in a specific directory, set the
# METEOR_DIR environment variable.
cd `dirname $0`
METEOR_DIR=`pwd`/..
if [ -z "$METEOR_DIR" ]; then
METEOR_DIR=`pwd`/..
fi
METEOR=$METEOR_DIR/meteor
if [ -z "$NODE" ]; then
@@ -135,7 +140,12 @@ sleep 2 # need to make sure these kills take effect
echo "... test-packages"
$METEOR test-packages -p $PORT >> $OUTPUT 2>&1 &
if [ ! $TEST_INSTALLED_METEOR ]; then
$METEOR test-packages -p $PORT >> $OUTPUT 2>&1 &
else
$METEOR test-packages --release=0.0.1 -p $PORT >> $OUTPUT 2>&1 &
fi
METEOR_PID=$!
sleep 2 # XXX XXX lame

View File

@@ -1,22 +1,45 @@
#!/bin/bash
## Setup
METEOR_DIR=`pwd`/..
# Die with message on failure, print commands being executed
trap 'echo FAILED' EXIT
# Die on failure, print commands being executed
set -e -x
# Test the Meteor CLI
## Test the Meteor CLI from a checkout
./cli-test.sh
# Run bundler unit tests
## Test the Meteor CLI from an installed engine (tests loading packages
## into the warehouse)
TMPDIR=$(mktemp -d -t meteor-installed-cli-tests)
export ENGINE_DIR=$TMPDIR/engine-tree
TARGET_DIR=$ENGINE_DIR admin/build-engine-tree.sh
export TEST_INSTALLED_METEOR=1 # to use the --release option on `meteor test-packages`
export TEST_WAREHOUSE_DIR=$(mktemp -d -t meteor-installed-cli-tests-warehouse) # run with empty warehouse
METEOR_DIR=$ENGINE_DIR/bin ./cli-test.sh
## Run bundler unit tests
./bundler-test.sh
# Test all packages, adding 'kill-server-on-test-completion'
(sleep 1; open http://localhost:3000) &
PACKAGE_DIRS=$METEOR_DIR/tools/cli-test-packages/ $METEOR_DIR/meteor test-packages --once
## Test all packages on installed version, adding 'kill-server-on-test-completion'
export TEST_WAREHOUSE_DIR=$(mktemp -d -t meteor-installed-cli-tests-warehouse) # run with empty warehouse
# We sleep for 30 seconds since we fetch packages on the first run,
# and only then do we listen on port 3000. In a fully installed
# version, we will have run 'meteor update' after installing the
# engine so this wouldn't happen. XXX should we test the full
# installer?
(sleep 30; open http://localhost:3000) &
PACKAGE_DIRS=$METEOR_DIR/tools/cli-test-packages/ $METEOR_DIR/meteor test-packages --once --release=0.0.1
## Done
trap - EXIT
echo PASSED