Running tests » History » Version 24
Radhika Chippada, 10/13/2016 05:19 PM
1 | 1 | Tom Clegg | h1. Running tests |
---|---|---|---|
2 | |||
3 | 3 | Tom Clegg | {{toc}} |
4 | |||
5 | 23 | Ward Vandewege | The arvados git repository has a @run-tests.sh@ script which tests (nearly) all of the components in the source tree. Jenkins at https://ci.curoverse.com uses this exact script, so running it _before pushing a new master_ is a good way to predict whether Jenkins will fail your build and start pestering you by IRC. |
6 | 1 | Tom Clegg | |
7 | h2. Background |
||
8 | |||
9 | You have the arvados source tree at @~/arvados@ and you might have local modifications. |
||
10 | |||
11 | h2. Install prerequisites |
||
12 | |||
13 | The test script doesn't (yet) check for all prerequisites up front, so you'll save some time by installing these things before going any attempting to run tests: |
||
14 | * [[Go]] |
||
15 | 13 | Nico César | * "API server dependencies": http://doc.arvados.org/install/install-api-server.html |
16 | ** Install debian packages, ruby, bundler. Create "arvados" postgres user with permission to create databases. You don't need to run "bundle install", though.) <pre>createuser arvados --createdb --pwprompt</pre> |
||
17 | |||
18 | 1 | Tom Clegg | * "Workbench dependencies":http://doc.arvados.org/install/install-workbench-app.html (Currently just graphviz. Skip "bundle install".) |
19 | 17 | Joshua Randall | ** make sure that the user who will run the tests can successfully start nginx (write access may be required for /var/log/nginx and /var/lib/nginx) |
20 | 4 | Tom Clegg | * doc build dependencies: <pre>sudo apt-get install python-epydoc linkchecker</pre> |
21 | 8 | Ward Vandewege | * "FUSE driver dependencies":https://arvados.org/projects/arvados/wiki/Hacking_Python_SDK#Prerequisites |
22 | 4 | Tom Clegg | * Workbench test suite dependencies (see [[Hacking Workbench]]): <pre> |
23 | sudo apt-get install xvfb iceweasel |
||
24 | (set -e |
||
25 | 1 | Tom Clegg | PJS=phantomjs-1.9.7-linux-x86_64 |
26 | 4 | Tom Clegg | wget -P /tmp https://bitbucket.org/ariya/phantomjs/downloads/$PJS.tar.bz2 |
27 | sudo tar -C /usr/local -xjf /tmp/$PJS.tar.bz2 |
||
28 | sudo ln -s ../$PJS/bin/phantomjs /usr/local/bin/ |
||
29 | ) |
||
30 | </pre> |
||
31 | 2 | Tom Clegg | ** version 2.0.x is missdetected see https://github.com/teampoltergeist/poltergeist/issues/595 |
32 | 14 | Nico César | * Dependencies specific to testing |
33 | 16 | Joshua Randall | ** debian package: lsof (used to configure test environment such as ARVADOS_API_HOST) |
34 | ** debian package: gitolite3 (required by the sanity checks before testing can start) |
||
35 | |||
36 | 1 | Tom Clegg | |
37 | 16 | Joshua Randall | h2. Run all tests |
38 | 1 | Tom Clegg | |
39 | Basic usage: |
||
40 | |||
41 | <pre> |
||
42 | 23 | Ward Vandewege | ~/arvados/build/run-tests.sh WORKSPACE=~/arvados |
43 | 1 | Tom Clegg | </pre> |
44 | |||
45 | h2. Save time by skipping install |
||
46 | |||
47 | Normally, even when you're running only one component's test suite, @run-tests.sh@ still runs the _install_ recipe for all of the components. This addresses dependencies between components: for example, Workbench tests expect the Python and CLI SDKs to be installed. It also installs third party dependencies (e.g., ruby gems and python modules). |
||
48 | 20 | Tom Clegg | |
49 | 1 | Tom Clegg | When you're not worried about these dependencies going out of sync (e.g., you're only touching Workbench tests) you can save time by preserving your install dir between test runs. Install everything once this way: |
50 | 21 | Tom Clegg | |
51 | 18 | Tom Clegg | <pre> |
52 | 1 | Tom Clegg | mkdir -p ~/.cache/arvados-build |
53 | 23 | Ward Vandewege | ~/arvados/build/run-tests.sh WORKSPACE=~/arvados --temp ~/.cache/arvados-build --only install |
54 | 22 | Joshua Randall | </pre> |
55 | 1 | Tom Clegg | |
56 | On subsequent tests, you can add @--skip-install@ and choose a single test suite to run, like this: |
||
57 | |||
58 | <pre> |
||
59 | 23 | Ward Vandewege | ~/arvados/build/run-tests.sh WORKSPACE=~/arvados --temp ~/.cache/arvados-build --skip-install --only apps/workbench |
60 | 1 | Tom Clegg | </pre> |
61 | |||
62 | Or: |
||
63 | |||
64 | <pre> |
||
65 | 23 | Ward Vandewege | ~/arvados/build/run-tests.sh WORKSPACE=~/arvados --temp ~/.cache/arvados-build --only-install apps/workbench --only apps/workbench |
66 | 1 | Tom Clegg | </pre> |
67 | 18 | Tom Clegg | |
68 | 20 | Tom Clegg | h2. Save time by skipping some tests |
69 | |||
70 | Running all tests takes a while. You don't want to do this after each tiny change. You can use the --skip and --only arguments to select specific components. Some components also accept component-specific arguments to select specific test classes/cases. |
||
71 | |||
72 | run-tests.sh [...] --skip-install --only apps/workbench apps/workbench_test="TEST=test/integration/websock*rb" |
||
73 | |||
74 | run-tests.sh [...] --skip-install --only apps/workbench apps/workbench_test="TESTOPTS=--name=/#6640/" |
||
75 | |||
76 | run-tests.sh [...] --skip-install --only sdk/python sdk/python_test="--test-suite tests.test_keep_locator" |
||
77 | |||
78 | run-tests.sh [...] --skip-install --only sdk/python sdk/python_test="--test-suite tests.test_keep_locator.ArvadosKeepLocatorTest.base_locators" |
||
79 | |||
80 | Presumably @[...]@ here includes a @--temp@ argument (see above). |
||
81 | |||
82 | 3 | Tom Clegg | h2. Other options |
83 | |||
84 | For more usage info, try: |
||
85 | |||
86 | <pre> |
||
87 | 23 | Ward Vandewege | ~/arvados/build/run-tests.sh --help |
88 | 1 | Tom Clegg | </pre> |
89 | 5 | Tom Clegg | |
90 | 24 | Radhika Chippada | h2. Running workbench diagnostics tests |
91 | |||
92 | You can run workbench diagnostics tests against any production server. |
||
93 | |||
94 | Update your workbench application.yml to add a "diagnostics" section with the login token and pipeline details. The below example configuration is to run the qr1hi-p5p6p-ftcb0o61u4yd2zr pipeline in qr1hi environment. |
||
95 | |||
96 | <pre> |
||
97 | diagnostics: |
||
98 | secret_token: useanicelongrandomlygeneratedsecrettokenstring |
||
99 | arvados_workbench_url: https://workbench.qr1hi.arvadosapi.com |
||
100 | user_tokens: |
||
101 | active: yourcurrenttokenintheenvironmenttowhichyouarepoining |
||
102 | pipelines_to_test: |
||
103 | pipeline_1: |
||
104 | template_uuid: qr1hi-p5p6p-ftcb0o61u4yd2zr |
||
105 | input_paths: [] |
||
106 | max_wait_seconds: 300 |
||
107 | </pre> |
||
108 | |||
109 | You can now run the qr1hi diagnostics tests using the following command: |
||
110 | <pre> |
||
111 | cd $ARVADOS_HOME |
||
112 | RAILS_ENV=diagnostics bundle exec rake TEST=test/diagnostics/**/*.rb |
||
113 | </pre> |
||
114 | |||
115 | 5 | Tom Clegg | h1. Deficiencies |
116 | |||
117 | There's currently nowhere to add... |
||
118 | * Unit tests for Workbench JavaScript assets (see #4132) |
||
119 | * Unit/functional tests for crunch-job (see #4156) |
||
120 | * Tests for "arv-run-pipeline-instance" |