Debian Codegraph @

test/lib/ansible_test/_internal/commands/integration/posix.py

raw
1 """POSIX integration testing."""
2
3 from __future__ import annotations
4
5 import os
6
7 from ...util_common import (
8 handle_layout_messages,
9 )
10
11 from ...containers import (
12 create_container_hooks,
13 local_ssh,
14 root_ssh,
15 )
16
17 from ...target import (
18 walk_posix_integration_targets,
19 )
20
21 from ...config import (
22 PosixIntegrationConfig,
23 )
24
25 from . import (
26 command_integration_filter,
27 command_integration_filtered,
28 get_inventory_relative_path,
29 )
30
31 from ...data import (
32 data_context,
33 )
34
35
36 def command_posix_integration(args: PosixIntegrationConfig) -> None:
37 """Entry point for the `integration` command."""
38 handle_layout_messages(data_context().content.integration_messages)
39
40 inventory_relative_path = get_inventory_relative_path(args)
41 inventory_path = os.path.join(data_context().content.root, inventory_relative_path)
42
43 all_targets = tuple(walk_posix_integration_targets(include_hidden=True))
44 host_state, internal_targets = command_integration_filter(args, all_targets)
45 control_connections = [local_ssh(args, host_state.controller_profile.python)]
46 managed_connections = [root_ssh(ssh) for ssh in host_state.get_controller_target_connections()]
47 pre_target, post_target = create_container_hooks(args, control_connections, managed_connections)
48
49 command_integration_filtered(args, host_state, internal_targets, all_targets, inventory_path, pre_target=pre_target, post_target=post_target)