|
2 | 2 | # SPDX-License-Identifier: Apache-2.0 |
3 | 3 | """Auth tests for Iris controller with static token authentication.""" |
4 | 4 |
|
5 | | -from pathlib import Path |
6 | | - |
7 | 5 | import pytest |
8 | | -from iris.cluster.config import load_config, make_local_config |
9 | 6 | from iris.cluster.local_cluster import LocalCluster |
10 | 7 | from iris.cluster.types import Entrypoint, ResourceSpec |
11 | | -from iris.rpc import cluster_pb2, config_pb2 |
| 8 | +from iris.rpc import cluster_pb2 |
12 | 9 | from iris.rpc.cluster_connect import ControllerServiceClientSync |
13 | 10 |
|
14 | | -IRIS_ROOT = Path(__file__).resolve().parents[1] |
15 | | -DEFAULT_CONFIG = IRIS_ROOT / "examples" / "test.yaml" |
| 11 | +from .conftest import _make_controller_only_config |
16 | 12 |
|
17 | 13 | _AUTH_TOKEN = "e2e-test-token" |
18 | 14 | _AUTH_USER = "test-user" |
19 | 15 |
|
20 | 16 |
|
21 | | -def _make_controller_only_config() -> config_pb2.IrisClusterConfig: |
22 | | - """Build a local config with no auto-scaled workers.""" |
23 | | - config = load_config(DEFAULT_CONFIG) |
24 | | - config.scale_groups.clear() |
25 | | - sg = config.scale_groups["placeholder"] |
26 | | - sg.name = "placeholder" |
27 | | - sg.num_vms = 1 |
28 | | - sg.min_slices = 0 |
29 | | - sg.max_slices = 0 |
30 | | - sg.resources.cpu_millicores = 1000 |
31 | | - sg.resources.memory_bytes = 1 * 1024**3 |
32 | | - sg.resources.disk_bytes = 10 * 1024**3 |
33 | | - sg.resources.device_type = config_pb2.ACCELERATOR_TYPE_CPU |
34 | | - sg.slice_template.local.SetInParent() |
35 | | - return make_local_config(config) |
36 | | - |
37 | | - |
38 | 17 | def _login_for_jwt(url: str, identity_token: str) -> str: |
39 | 18 | """Exchange a raw identity token for a JWT via the Login RPC.""" |
40 | 19 | client = ControllerServiceClientSync(address=url, timeout_ms=10000) |
|
0 commit comments