|
14 | 14 | limitations under the License. |
15 | 15 | """ |
16 | 16 |
|
17 | | -from argparse import Namespace |
18 | 17 | from dataclasses import dataclass |
19 | | -from typing import Any |
20 | 18 | from unittest.mock import MagicMock |
21 | 19 | import pytest |
22 | 20 | from xpk.commands.managed_ml_diagnostics import install_mldiagnostics_prerequisites |
@@ -50,78 +48,21 @@ def mocks(mocker) -> _Mocks: |
50 | 48 | commands_print_mock=commands_print_mock, |
51 | 49 | commands_tester=CommandsTester( |
52 | 50 | mocker, |
53 | | - # run_command_with_updates_path=( |
54 | | - # 'xpk.commands.managed_ml_diagnostics.run_command_with_updates' |
55 | | - # ), |
56 | | - # run_command_for_value_path=( |
57 | | - # 'xpk.commands.managed_ml_diagnostics.run_command_for_value' |
58 | | - # ), |
| 51 | + run_command_with_updates_path=( |
| 52 | + 'xpk.commands.managed_ml_diagnostics.run_command_with_updates' |
| 53 | + ), |
| 54 | + run_command_for_value_path=( |
| 55 | + 'xpk.commands.managed_ml_diagnostics.run_command_for_value' |
| 56 | + ), |
59 | 57 | ), |
60 | 58 | ) |
61 | 59 |
|
| 60 | + |
62 | 61 | def test_install_mldiagnostics_prerequisites_commands_executed( |
63 | 62 | mocks: _Mocks, |
64 | 63 | mocker, |
65 | 64 | ): |
66 | 65 |
|
67 | | - mocks.commands_tester.set_result_for_command( |
68 | | - (0, ''), |
69 | | - 'kubectl', |
70 | | - 'rollout', |
71 | | - 'status', |
72 | | - 'deployment/kueue-controller-manager', |
73 | | - ) |
74 | | - |
75 | | - mocks.commands_tester.set_result_for_command( |
76 | | - (0, ''), |
77 | | - 'kubectl', |
78 | | - 'rollout', |
79 | | - 'status', |
80 | | - 'deployment/cert-manager-webhook', |
81 | | - ) |
82 | | - |
83 | | - mocks.commands_tester.set_result_for_command( |
84 | | - (0, ''), |
85 | | - 'kubectl', |
86 | | - 'apply', |
87 | | - '-f', |
88 | | - 'https://github.com/cert-manager/cert-manager/releases/', |
89 | | - ) |
90 | | - |
91 | | - mocks.commands_tester.set_result_for_command( |
92 | | - (0, ''), |
93 | | - 'gcloud', |
94 | | - 'artifacts', |
95 | | - 'generic', |
96 | | - 'download', |
97 | | - ) |
98 | | - |
99 | | - mocks.commands_tester.set_result_for_command( |
100 | | - (0, ''), |
101 | | - 'kubectl', |
102 | | - 'create', |
103 | | - 'namespace', |
104 | | - 'gke-mldiagnostics', |
105 | | - ) |
106 | | - |
107 | | - mocks.commands_tester.set_result_for_command( |
108 | | - (0, ''), |
109 | | - 'kubectl', |
110 | | - 'apply', |
111 | | - '-f', |
112 | | - '-n', |
113 | | - 'gke-mldiagnostics', |
114 | | - ) |
115 | | - |
116 | | - mocks.commands_tester.set_result_for_command( |
117 | | - (0, ''), |
118 | | - 'kubectl', |
119 | | - 'label', |
120 | | - 'namespace', |
121 | | - 'default', |
122 | | - 'managed-mldiagnostics-gke=true', |
123 | | - ) |
124 | | - |
125 | 66 | install_mldiagnostics_prerequisites() |
126 | 67 |
|
127 | 68 | mocks.commands_tester.assert_command_run( |
|
0 commit comments