|
25 | 25 | from typing import Generator |
26 | 26 |
|
27 | 27 | import google |
28 | | -import pytest |
29 | 28 | import pytest_asyncio |
30 | 29 | from google.auth import compute_engine |
31 | 30 | from google.cloud import secretmanager, storage |
@@ -131,37 +130,21 @@ def auth_token2(project_id: str) -> str: |
131 | 130 |
|
132 | 131 |
|
133 | 132 | @pytest_asyncio.fixture(scope="session") |
134 | | -def toolbox_server( |
135 | | - tmp_path_factory: pytest.TempPathFactory, toolbox_version: str, tools_file_path: str |
136 | | -) -> Generator[None]: |
| 133 | +def toolbox_server(toolbox_version: str, tools_file_path: str) -> Generator[None]: |
137 | 134 | """Starts the toolbox server as a subprocess.""" |
138 | | - # Get a temp dir for toolbox data |
139 | | - tmp_path = tmp_path_factory.mktemp("toolbox_data") |
140 | | - toolbox_binary_path = str(tmp_path) + "/toolbox" |
141 | | - |
142 | | - # Get toolbox binary |
143 | | - if toolbox_version == "dev": |
144 | | - print("Compiling the current dev toolbox version...") |
145 | | - subprocess.Popen(["go", "get", "./..."]) |
146 | | - subprocess.Popen(["go", "build", "-o", toolbox_binary_path]) |
147 | | - # Wait for compilation |
148 | | - time.sleep(5) |
149 | | - print("Toolbox binary compiled successfully.") |
150 | | - else: |
151 | | - print("Downloading toolbox binary from gcs bucket...") |
152 | | - source_blob_name = get_toolbox_binary_url(toolbox_version) |
153 | | - download_blob("genai-toolbox", source_blob_name, toolbox_binary_path) |
154 | | - print("Toolbox binary downloaded successfully.") |
155 | | - |
156 | | - # Run toolbox binary |
| 135 | + print("Downloading toolbox binary from gcs bucket...") |
| 136 | + source_blob_name = get_toolbox_binary_url(toolbox_version) |
| 137 | + download_blob("genai-toolbox", source_blob_name, "toolbox") |
| 138 | + print("Toolbox binary downloaded successfully.") |
157 | 139 | try: |
158 | 140 | print("Opening toolbox server process...") |
159 | 141 | # Make toolbox executable |
160 | | - os.chmod(toolbox_binary_path, 0o700) |
| 142 | + os.chmod("toolbox", 0o700) |
161 | 143 | # Run toolbox binary |
162 | 144 | toolbox_server = subprocess.Popen( |
163 | | - [toolbox_binary_path, "--tools_file", tools_file_path] |
| 145 | + ["./toolbox", "--tools_file", tools_file_path] |
164 | 146 | ) |
| 147 | + |
165 | 148 | # Wait for server to start |
166 | 149 | # Retry logic with a timeout |
167 | 150 | for _ in range(5): # retries |
|
0 commit comments