-
Notifications
You must be signed in to change notification settings - Fork 174
/
Copy pathTiltfile
32 lines (25 loc) · 1.13 KB
/
Tiltfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# Some common test configurations to easily get up and running with Tilt for Tests
# (see docs: https://docs.tilt.dev/tests_in_tilt.html)
def test_go(name, package, deps, timeout='', tags=None, mod='', recursive=False, ignore=None, extra_args=None, **kwargs):
if recursive and not package.endswith('...'):
package = package.rstrip('/')
package = package + '/...'
timeout_str = ''
if timeout: # expects a go-parsable dur
timeout_str = '-timeout {}'.format(timeout)
tags_str = ''
if tags:
tags_str = '-tags {}'.format(','.join(tags))
mod_str = ''
if mod:
mod_str = '-mod {}'.format(mod)
extra_args_str = ''
if extra_args:
extra_args_str = ' '.join(extra_args)
if not ignore:
ignore=[]
# TODO: ability to pass multiple packages (as in `go test`)
cmd = 'go test {mod_str} {tags_str} {timeout_str} {extra_args_str} {package}'.format(
mod_str=mod_str, tags_str=tags_str, timeout_str=timeout_str,
extra_args_str=extra_args_str, package=package)
local_resource(name, cmd, deps=deps, ignore=ignore, allow_parallel=True, **kwargs)