Skip to content

Commit 5d20434

Browse files
committed
Add 'args' to docs
1 parent 9572fa9 commit 5d20434

File tree

2 files changed

+23
-11
lines changed

2 files changed

+23
-11
lines changed

docs/itest.md

+8-2
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ itest_service(<a href="#itest_service-name">name</a>, <a href="#itest_service-au
3333

3434
An itest_service is a binary that is intended to run for the duration of the integration test. Examples include databases, HTTP/RPC servers, queue consumers, external service mocks, etc.
3535

36+
All [common binary attributes](https://bazel.build/reference/be/common-definitions#common-attributes-binaries) are supported including `args`.
37+
3638
**ATTRIBUTES**
3739

3840

@@ -48,7 +50,7 @@ An itest_service is a binary that is intended to run for the duration of the int
4850
| <a id="itest_service-health_check_args"></a>health_check_args | Arguments to pass to the health_check binary. The various defined ports will be substituted prior to being given to the health_check binary. | List of strings | optional | <code>[]</code> |
4951
| <a id="itest_service-health_check_interval"></a>health_check_interval | The duration between each health check. The syntax is based on common time duration with a number, followed by the time unit. For example, <code>200ms</code>, <code>1s</code>, <code>2m</code>, <code>3h</code>, <code>4d</code>. | String | optional | <code>"200ms"</code> |
5052
| <a id="itest_service-health_check_timeout"></a>health_check_timeout | The timeout to wait for the health check. The syntax is based on common time duration with a number, followed by the time unit. For example, <code>200ms</code>, <code>1s</code>, <code>2m</code>, <code>3h</code>, <code>4d</code>. If empty or not set, the health check will not have a timeout. | String | optional | <code>""</code> |
51-
| <a id="itest_service-hot_reloadable"></a>hot_reloadable | If set to True, the service manager will propagate ibazel's reload notificaiton over stdin instead of restarting the service. See the ruleset docstring for more info on using ibazel | Boolean | optional | <code>False</code> |
53+
| <a id="itest_service-hot_reloadable"></a>hot_reloadable | If set to True, the service manager will propagate ibazel's reload notification over stdin instead of restarting the service. See the ruleset docstring for more info on using ibazel | Boolean | optional | <code>False</code> |
5254
| <a id="itest_service-http_health_check_address"></a>http_health_check_address | If set, the service manager will send an HTTP request to this address to check if the service came up in a healthy state. This check will be retried until it returns a 200 HTTP code. When used in conjunction with autoassigned ports, <code>$${@@//label/for:service:port_name}</code> can be used in the address. Example: <code>http_health_check_address = "http://127.0.0.1:$${@@//label/for:service:port_name}",</code> | String | optional | <code>""</code> |
5355
| <a id="itest_service-named_ports"></a>named_ports | For each element of the list, the service manager will pick a free port and assign it to the service. The port's fully-qualified name is the service's fully-qualified label and the port name, separated by a colon. For example, a port assigned with <code>names_ports = ["http_port"]</code> will be assigned a fully-qualified name of <code>@@//label/for:service:http_port</code>.<br><br> Named ports are accessible through the service-port mapping. For more details, see <code>autoassign_port</code>. | List of strings | optional | <code>[]</code> |
5456
| <a id="itest_service-so_reuseport_aware"></a>so_reuseport_aware | If set, the service manager will not release the autoassigned port. The service binary must use SO_REUSEPORT when binding it. This reduces the possibility of port collisions when running many service_tests in parallel, or when code binds port 0 without being aware of the port assignment mechanism.<br><br> Must only be set when autoassign_port is enabled. | Boolean | optional | <code>False</code> |
@@ -88,7 +90,9 @@ itest_task(<a href="#itest_task-name">name</a>, <a href="#itest_task-data">data<
8890
</pre>
8991

9092
A task is a one-shot (not long-running binary) that is intended to be executed as part of the itest scenario creation.
91-
Examples include: filesystem setup, dynamic config file generation (especially if it depends on ports), DB migrations or seed data creation
93+
Examples include: filesystem setup, dynamic config file generation (especially if it depends on ports), DB migrations or seed data creation.
94+
95+
All [common binary attributes](https://bazel.build/reference/be/common-definitions#common-attributes-binaries) are supported including `args`.
9296

9397
**ATTRIBUTES**
9498

@@ -134,6 +138,8 @@ service_test(
134138

135139
Typically this would be wrapped into a macro.
136140

141+
All [common binary attributes](https://bazel.build/reference/be/common-definitions#common-attributes-binaries) are supported including `args`.
142+
137143
**ATTRIBUTES**
138144

139145

private/itest.bzl

+15-9
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ query:enable-reload --@rules_itest//:enable_per_service_reload
1515
1616
`ibazel run --config enable-reload //path/to:target`
1717
18-
In addition, if can set the `hot_reloadable` attribute on an `itest_service`, the service manager will
18+
In addition, if the `hot_reloadable` attribute is set on an `itest_service`, the service manager will
1919
forward the ibazel hot-reload notification over stdin instead of restarting the service.
2020
"""
2121

@@ -205,7 +205,7 @@ _itest_service_attrs = _itest_binary_attrs | {
205205
"named_ports": attr.string_list(
206206
doc = """For each element of the list, the service manager will pick a free port and assign it to the service.
207207
The port's fully-qualified name is the service's fully-qualified label and the port name, separated by a colon.
208-
For example, a port assigned with `names_ports = ["http_port"]` will be assigned a fully-qualified name of `@@//label/for:service:http_port`.
208+
For example, a port assigned with `named_ports = ["http_port"]` will be assigned a fully-qualified name of `@@//label/for:service:http_port`.
209209
210210
Named ports are accessible through the service-port mapping. For more details, see `autoassign_port`.""",
211211
),
@@ -229,7 +229,7 @@ _itest_service_attrs = _itest_binary_attrs | {
229229
doc = "The timeout to wait for the health check. The syntax is based on common time duration with a number, followed by the time unit. For example, `200ms`, `1s`, `2m`, `3h`, `4d`. If empty or not set, the health check will not have a timeout.",
230230
),
231231
"hot_reloadable": attr.bool(
232-
doc = """If set to True, the service manager will propagate ibazel's reload notificaiton over stdin instead of restarting the service.
232+
doc = """If set to True, the service manager will propagate ibazel's reload notification over stdin instead of restarting the service.
233233
See the ruleset docstring for more info on using ibazel""",
234234
),
235235
"http_health_check_address": attr.string(
@@ -242,15 +242,17 @@ _itest_service_attrs = _itest_binary_attrs | {
242242
This reduces the possibility of port collisions when running many service_tests in parallel, or when code binds port 0 without being
243243
aware of the port assignment mechanism.
244244
245-
Must only be set when autoassign_port is enabled.""",
245+
Must only be set when `autoassign_port` is enabled or `named_ports` are used.""",
246246
),
247247
}
248248

249249
itest_service = rule(
250250
implementation = _itest_service_impl,
251251
attrs = _itest_service_attrs,
252252
executable = True,
253-
doc = "An itest_service is a binary that is intended to run for the duration of the integration test. Examples include databases, HTTP/RPC servers, queue consumers, external service mocks, etc.",
253+
doc = """An itest_service is a binary that is intended to run for the duration of the integration test. Examples include databases, HTTP/RPC servers, queue consumers, external service mocks, etc.
254+
255+
All [common binary attributes](https://bazel.build/reference/be/common-definitions#common-attributes-binaries) are supported including `args`.""",
254256
)
255257

256258
def _itest_task_impl(ctx):
@@ -262,8 +264,10 @@ itest_task = rule(
262264
implementation = _itest_task_impl,
263265
attrs = _itest_binary_attrs,
264266
executable = True,
265-
doc = """A task is a one-shot (not long-running binary) that is intended to be executed as part of the itest scenario creation.
266-
Examples include: filesystem setup, dynamic config file generation (especially if it depends on ports), DB migrations or seed data creation""",
267+
doc = """A task is a one-shot execution of a binary that is intended to run as part of the itest scenario creation.
268+
Examples include: filesystem setup, dynamic config file generation (especially if it depends on ports), DB migrations or seed data creation.
269+
270+
All [common binary attributes](https://bazel.build/reference/be/common-definitions#common-attributes-binaries) are supported including `args`.""",
267271
)
268272

269273
def _itest_service_group_impl(ctx):
@@ -302,7 +306,7 @@ itest_service_group = rule(
302306
It serves as a convenient way for a downstream target to depend on multiple services with a single label, without
303307
forcing the services within the group to define a specific startup ordering with their `deps`.
304308
305-
It is also useful to bring up multiple services with a single `bazel run` command, which is useful for creating
309+
It can bring up multiple services with a single `bazel run` command, which is useful for creating
306310
dev environments.""",
307311
)
308312

@@ -397,7 +401,9 @@ service_test(
397401
)
398402
```
399403
400-
Typically this would be wrapped into a macro.""",
404+
Typically this would be wrapped into a macro.
405+
406+
All [common binary attributes](https://bazel.build/reference/be/common-definitions#common-attributes-binaries) are supported including `args`.""",
401407
)
402408

403409
def _create_version_file(ctx, inputs):

0 commit comments

Comments
 (0)