Project

General

Profile

Running tests » History » Version 29

Tom Clegg, 03/27/2019 07:01 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 29 Tom Clegg
Follow instructions at [[Hacking prerequisites]]: "Install dev environment", etc. Don't miss creating the Postgres database, docker groups, etc.
14 1 Tom Clegg
15 29 Tom Clegg
h2. If you're Jenkins
16
17
Run all tests from a clean slate (slow, but more immune to leaks)
18
19
<pre>
20
~/arvados/build/run-tests.sh WORKSPACE=~/arvados
21 1 Tom Clegg
</pre>
22
23 29 Tom Clegg
h2. If you're a developer
24 1 Tom Clegg
25 29 Tom Clegg
Cache everything needed to run test suites:
26 1 Tom Clegg
27 29 Tom Clegg
<pre>
28
mkdir ~/.cache/arvados-build
29
~/arvados/build/run-tests.sh WORKSPACE=~/arvados --temp ~/.cache/arvados-build --only install
30
</pre>
31 1 Tom Clegg
32 29 Tom Clegg
Start interactive mode:
33
34 1 Tom Clegg
<pre>
35 29 Tom Clegg
$ ~/arvados/build/run-tests.sh WORKSPACE=~/arvados --temp ~/.cache/arvados-build --interactive
36 1 Tom Clegg
</pre>
37
38 29 Tom Clegg
When prompted, choose a test suite to run:
39 1 Tom Clegg
40 29 Tom Clegg
<pre>
41
== Interactive commands:
42
TARGET                 (short for 'test DIR')
43
test TARGET
44
test TARGET:py3        (test with python3)
45
test TARGET -check.vv  (pass arguments to test)
46
install TARGET
47
install env            (go/python libs)
48
install deps           (go/python libs + arvados components needed for integration tests)
49
reset                  (...services used by integration tests)
50
exit
51
== Test targets:
52
cmd/arvados-client              lib/dispatchcloud/container     sdk/go/auth                     sdk/pam:py3                     services/fuse                   tools/crunchstat-summary
53
cmd/arvados-server              lib/dispatchcloud/scheduler     sdk/go/blockdigest              sdk/python                      services/fuse:py3               tools/crunchstat-summary:py3
54
lib/cli                         lib/dispatchcloud/ssh_executor  sdk/go/crunchrunner             sdk/python:py3                  services/health                 tools/keep-block-check
55
lib/cloud                       lib/dispatchcloud/worker        sdk/go/dispatch                 services/arv-git-httpd          services/keep-balance           tools/keep-exercise
56
lib/cloud/azure                 lib/service                     sdk/go/health                   services/crunch-dispatch-local  services/keepproxy              tools/keep-rsync
57
lib/cloud/ec2                   sdk/cwl                         sdk/go/httpserver               services/crunch-dispatch-slurm  services/keepstore              tools/sync-groups
58
lib/cmd                         sdk/cwl:py3                     sdk/go/keepclient               services/crunch-run             services/keep-web
59
lib/controller                  sdk/go/arvados                  sdk/go/manifest                 services/crunchstat             services/nodemanager
60
lib/crunchstat                  sdk/go/arvadosclient            sdk/go/stats                    services/dockercleaner          services/nodemanager:py3
61
lib/dispatchcloud               sdk/go/asyncbuf                 sdk/pam                         services/dockercleaner:py3      services/ws
62
What next? 
63
</pre>
64 1 Tom Clegg
65 29 Tom Clegg
Example: testing lib/dispatchcloud/container, showing verbose/debug logs:
66 1 Tom Clegg
67
<pre>
68 29 Tom Clegg
What next? test lib/dispatchcloud/container/ -check.vv
69
======= test lib/dispatchcloud/container
70
START: queue_test.go:99: IntegrationSuite.TestCancelIfNoInstanceType
71
WARN[0000] cancel container with no suitable instance type  ContainerUUID=zzzzz-dz642-queuedcontainer error="no suitable instance type"
72
WARN[0000] cancel container with no suitable instance type  ContainerUUID=zzzzz-dz642-queuedcontainer error="no suitable instance type"
73
START: queue_test.go:37: IntegrationSuite.TearDownTest
74
PASS: queue_test.go:37: IntegrationSuite.TearDownTest   0.846s
75
76
PASS: queue_test.go:99: IntegrationSuite.TestCancelIfNoInstanceType     0.223s
77
78
START: queue_test.go:42: IntegrationSuite.TestGetLockUnlockCancel
79
INFO[0001] adding container to queue                     ContainerUUID=zzzzz-dz642-queuedcontainer InstanceType=testType Priority=1 State=Queued
80
START: queue_test.go:37: IntegrationSuite.TearDownTest
81
PASS: queue_test.go:37: IntegrationSuite.TearDownTest   0.901s
82
83
PASS: queue_test.go:42: IntegrationSuite.TestGetLockUnlockCancel        0.177s
84
85
OK: 2 passed
86
PASS
87
ok      git.curoverse.com/arvados.git/lib/dispatchcloud/container       2.150s
88
======= test lib/dispatchcloud/container -- 3s
89
Pass: lib/dispatchcloud/container tests (3s)
90
All test suites passed.
91 1 Tom Clegg
</pre>
92
93 29 Tom Clegg
h3. Running individual test cases
94 1 Tom Clegg
95 29 Tom Clegg
Most Go packages use gocheck. Use gocheck command line args like -check.f.
96
97 1 Tom Clegg
<pre>
98 29 Tom Clegg
What next? test lib/dispatchcloud/container -check.vv -check.f=LockUnlock
99
======= test lib/dispatchcloud/container
100
START: queue_test.go:42: IntegrationSuite.TestGetLockUnlockCancel
101
INFO[0000] adding container to queue                     ContainerUUID=zzzzz-dz642-queuedcontainer InstanceType=testType Priority=1 State=Queued
102
START: queue_test.go:37: IntegrationSuite.TearDownTest
103
PASS: queue_test.go:37: IntegrationSuite.TearDownTest   0.812s
104
105
PASS: queue_test.go:42: IntegrationSuite.TestGetLockUnlockCancel        0.184s
106
107
OK: 1 passed
108
PASS
109
ok      git.curoverse.com/arvados.git/lib/dispatchcloud/container       1.000s
110
======= test lib/dispatchcloud/container -- 2s
111 1 Tom Clegg
</pre>
112
113 29 Tom Clegg
Python
114 1 Tom Clegg
115
<pre>
116 29 Tom Clegg
What next? test sdk/python --test-suite=tests.test_collections.TextModes.test_read_sailboat_across_block_boundary
117
======= test sdk/python
118
running test
119
running egg_info
120
writing requirements to arvados_python_client.egg-info/requires.txt
121
writing arvados_python_client.egg-info/PKG-INFO
122
writing top-level names to arvados_python_client.egg-info/top_level.txt
123
writing dependency_links to arvados_python_client.egg-info/dependency_links.txt
124
writing pbr to arvados_python_client.egg-info/pbr.json
125
reading manifest file 'arvados_python_client.egg-info/SOURCES.txt'
126
reading manifest template 'MANIFEST.in'
127
writing manifest file 'arvados_python_client.egg-info/SOURCES.txt'
128
running build_ext
129
test_read_sailboat_across_block_boundary (tests.test_collections.TextModes) ... ok
130
131
----------------------------------------------------------------------
132
Ran 1 test in 0.014s
133
134
OK
135
======= test sdk/python -- 1s
136 1 Tom Clegg
</pre>
137
138 29 Tom Clegg
Ruby/Rails
139 23 Ward Vandewege
140 29 Tom Clegg
<pre>
141
What next? test sdk/python TESTOPTS=--name=/.*signed.locators.*/
142
</pre>
143 20 Tom Clegg
144 29 Tom Clegg
h3. Restarting services for integration tests
145 20 Tom Clegg
146 29 Tom Clegg
If you have changed services/api code, and you want to check whether it breaks the lib/dispatchcloud/container integration tests:
147 20 Tom Clegg
148 29 Tom Clegg
<pre>
149
What next? reset                                # teardown the integration-testing environment
150
What next? install services/api                 # (only needed if you've updated dependencies)
151
What next? test lib/dispatchcloud/container     # bring up the integration-testing environment and run tests
152
What next? test lib/dispatchcloud/container     # leave the integration-testing environment up and run tests
153
</pre>
154 20 Tom Clegg
155 29 Tom Clegg
h3. Updating cache after pulling master
156 3 Tom Clegg
157 29 Tom Clegg
Always quit interactive mode and restart after modifying run-tests.sh (via git-pull, git-checkout, editing, etc).
158 3 Tom Clegg
159 29 Tom Clegg
When you start, run "install all" to get the latest gem/python dependencies, install updated versions of Arvados services used by integration tests, etc.
160 3 Tom Clegg
161 29 Tom Clegg
Then you can resume your cycle of "test lib/controller", etc.
162
163
h3. Other options
164
165 24 Radhika Chippada
For more usage info, try:
166
167
<pre>
168 26 Radhika Chippada
~/arvados/build/run-tests.sh --help
169 24 Radhika Chippada
</pre>
170
171
h2. Running workbench diagnostics tests
172
173
You can run workbench diagnostics tests against any production server. 
174
175 26 Radhika Chippada
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.
176 24 Radhika Chippada
177
<pre>
178
diagnostics:
179
  secret_token: useanicelongrandomlygeneratedsecrettokenstring
180
  arvados_workbench_url: https://workbench.qr1hi.arvadosapi.com
181
  user_tokens:
182
    active: yourcurrenttokenintheenvironmenttowhichyouarepointing
183 26 Radhika Chippada
  pipelines_to_test:
184 24 Radhika Chippada
    pipeline_1:
185
      template_uuid: qr1hi-p5p6p-ftcb0o61u4yd2zr
186 25 Radhika Chippada
      input_paths: []
187 24 Radhika Chippada
      max_wait_seconds: 300
188
</pre>
189 5 Tom Clegg
190
You can now run the "qr1hi" diagnostics tests using the following command:
191
<pre>
192
  cd $ARVADOS_HOME
193
  RAILS_ENV=diagnostics bundle exec rake TEST=test/diagnostics/pipeline_test.rb
194
</pre>