mirror of
https://github.com/meteor/meteor.git
synced 2026-05-02 03:01:46 -04:00
UX Changes:
- Added a `--galaxy` option to selftest to run tests against galaxy.
Self-test will NOT run those tests without this option. Self-test will not run any
other tests WITH this option.
The motivation here is two-fold:
- We want to make it easy to use self-test to test Galaxy without running a bunch
of extra tests. At least, we want this right now, while Galaxy is still in development.
- Galaxy is currently pretty unstable&slow; we don't want to run our regular test suite against
Galaxy all the time and slow down the tool development process. Additionally, the environment
variables required by Galaxy are a pain to set.
This is a TEMPORARY situation. Eventually, we will want to either merge the two tests together
(especially once we rotate out Mother...) or we will have a separate unrelated Galaxy test suite
and move a lot of this stuff here. With time, it will also become more obvious what a better default
(run Galaxy tests always/run Galaxy tests never/run non-Galaxy-specific tests against Galaxy) is.
The changes should be pretty self-contained.
- Added some number of environment variables to use with --galaxy tests. This is a bit complicated
and will be documented in
https://mdg.hackpad.com/GalaxyECS-Admin-tasks-RTXJ5YW8pDv#:h=Testing-Galaxy-with-selftest.
Walkthrough:
- galaxy-utls.js contains basic utils for running Galaxy tests. Use environment variables, etc.
- galaxy.js contains the acutal test
- simple-app is an app that responds to HTTP requests and serves some html that we can test to be running
- minor changes to config.js to allow overriding of the domain name
- minor changes to auth.js to allow us to automatically login as the (new) test user and use that
login to start a DDP collection.
- move a function out of deploy-settings.js into test-utils.js
- some minor additions to test-utils.js
Reviewed in https://github.com/meteor/meteor/pull/4997.
Tools testing
Running end-to-end tests happens through the Self-Test. To run the tests:
./meteor self-test <regexp>
A very-very useful environment variable to set, in case you are running on a slow machine:
# set the multiplier for time-outs
set TIMEOUT_SCALE_FACTOR=3
Writing tests
All tests are currently stored at /tools/tests/, each JS file can register a
self-test. Example:
selftest.define("mongo failover", [/* tags */], function () {
var s = new Sandbox();
s.set('METEOR_TEST_MULTIPLE_MONGOD_REPLSET', 't');
s.createApp("failover-test", "failover-test");
s.cd("failover-test");
var run = s.run("--once", "--raw-logs");
run.waitSecs(120);
run.match("SUCCESS\n");
run.expectEnd();
run.expectExit(0);
});
The example above demonstrates how to define a test, create a Sandbox, create an app from a template and run the Meteor commands.
Templates for apps and packages are kept in /tools/tests, too.
Testing with Phantom/Browserstack
The sandbox has a testWithAllClients method that runs the clients like Phantom
or Browserstack pointed to the page of the app (localhost:3000 by default).
Tags
Tags are arbitrary. To make tags do anything, you should edit the selftest.js
code.
Examples of some tags that exist today:
slow- the test is skipped, unless the--slowflag is passedwindows- the test is not run unless on Windowsnet- the test is talking to external Internet services, thus requires an Internet connection to run
There are others.
Self-test gotchas
- The docs for self-test is reading the code of self-test
run.forbid(regexp)forbids the regexp from the entire output, not from the point it was called. It happens, because the output is matched asynchronously.