infrahub-testcontainers 1.3.6__tar.gz → 1.4.0b1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (16) hide show
  1. {infrahub_testcontainers-1.3.6 → infrahub_testcontainers-1.4.0b1}/PKG-INFO +2 -2
  2. {infrahub_testcontainers-1.3.6 → infrahub_testcontainers-1.4.0b1}/infrahub_testcontainers/container.py +17 -0
  3. {infrahub_testcontainers-1.3.6 → infrahub_testcontainers-1.4.0b1}/infrahub_testcontainers/docker-compose-cluster.test.yml +56 -1
  4. {infrahub_testcontainers-1.3.6 → infrahub_testcontainers-1.4.0b1}/infrahub_testcontainers/docker-compose.test.yml +56 -1
  5. {infrahub_testcontainers-1.3.6 → infrahub_testcontainers-1.4.0b1}/infrahub_testcontainers/helpers.py +4 -1
  6. {infrahub_testcontainers-1.3.6 → infrahub_testcontainers-1.4.0b1}/pyproject.toml +3 -3
  7. {infrahub_testcontainers-1.3.6 → infrahub_testcontainers-1.4.0b1}/README.md +0 -0
  8. {infrahub_testcontainers-1.3.6 → infrahub_testcontainers-1.4.0b1}/infrahub_testcontainers/__init__.py +0 -0
  9. {infrahub_testcontainers-1.3.6 → infrahub_testcontainers-1.4.0b1}/infrahub_testcontainers/constants.py +0 -0
  10. {infrahub_testcontainers-1.3.6 → infrahub_testcontainers-1.4.0b1}/infrahub_testcontainers/haproxy.cfg +0 -0
  11. {infrahub_testcontainers-1.3.6 → infrahub_testcontainers-1.4.0b1}/infrahub_testcontainers/host.py +0 -0
  12. {infrahub_testcontainers-1.3.6 → infrahub_testcontainers-1.4.0b1}/infrahub_testcontainers/measurements.py +0 -0
  13. {infrahub_testcontainers-1.3.6 → infrahub_testcontainers-1.4.0b1}/infrahub_testcontainers/models.py +0 -0
  14. {infrahub_testcontainers-1.3.6 → infrahub_testcontainers-1.4.0b1}/infrahub_testcontainers/performance_test.py +0 -0
  15. {infrahub_testcontainers-1.3.6 → infrahub_testcontainers-1.4.0b1}/infrahub_testcontainers/plugin.py +0 -0
  16. {infrahub_testcontainers-1.3.6 → infrahub_testcontainers-1.4.0b1}/infrahub_testcontainers/prometheus.yml +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: infrahub-testcontainers
3
- Version: 1.3.6
3
+ Version: 1.4.0b1
4
4
  Summary: Testcontainers instance for Infrahub to easily build integration tests
5
5
  License: Apache-2.0
6
6
  Author: OpsMill
@@ -15,7 +15,7 @@ Classifier: Programming Language :: Python :: 3.11
15
15
  Classifier: Programming Language :: Python :: 3.12
16
16
  Classifier: Programming Language :: Python :: 3.13
17
17
  Requires-Dist: httpx (>=0.28.1,<0.29.0)
18
- Requires-Dist: prefect-client (==3.4.1)
18
+ Requires-Dist: prefect-client (==3.4.11)
19
19
  Requires-Dist: psutil
20
20
  Requires-Dist: pydantic (>=2.10.6,<3.0.0)
21
21
  Requires-Dist: pytest
@@ -59,6 +59,8 @@ PROJECT_ENV_VARIABLES: dict[str, str] = {
59
59
  "INFRAHUB_TESTING_PREFECT_UI_ENABLED": "true",
60
60
  "INFRAHUB_TESTING_DOCKER_PULL": "true",
61
61
  "INFRAHUB_TESTING_SCHEMA_STRICT_MODE": "true",
62
+ "INFRAHUB_TESTING_TASKMGR_API_WORKERS": "1",
63
+ "INFRAHUB_TESTING_TASKMGR_BACKGROUND_SVC_REPLICAS": "0",
62
64
  }
63
65
 
64
66
 
@@ -144,6 +146,21 @@ class InfrahubDockerCompose(DockerCompose):
144
146
  "NEO4J_DOCKER_IMAGE": "neo4j:2025.03.0-enterprise",
145
147
  }
146
148
  )
149
+ if os.environ.get("INFRAHUB_TESTING_TASKMGR_SCALEOUT"):
150
+ PROJECT_ENV_VARIABLES.update(
151
+ {
152
+ "INFRAHUB_TESTING_TASKMGR_BACKGROUND_SVC_REPLICAS": "1",
153
+ "PREFECT_MESSAGING_BROKER": "prefect_redis.messaging",
154
+ "PREFECT_MESSAGING_CACHE": "prefect_redis.messaging",
155
+ "PREFECT__SERVER_WEBSERVER_ONLY": "true",
156
+ "PREFECT_API_DATABASE_MIGRATE_ON_START": "false",
157
+ "PREFECT_API_BLOCKS_REGISTER_ON_START": "false",
158
+ "PREFECT_SERVER_SERVICES_EVENT_LOGGER_ENABLED": "false",
159
+ "PREFECT_SERVER_SERVICES_EVENT_PERSISTER_ENABLED": "false",
160
+ "PREFECT_SERVER_SERVICES_TRIGGERS_ENABLED": "false",
161
+ "PREFECT_SERVER_SERVICES_TASK_RUN_RECORDER_ENABLED": "false",
162
+ }
163
+ )
147
164
 
148
165
  with env_file.open(mode="w", encoding="utf-8") as file:
149
166
  for key, value in PROJECT_ENV_VARIABLES.items():
@@ -166,13 +166,33 @@ services:
166
166
 
167
167
  task-manager:
168
168
  image: "${INFRAHUB_TESTING_DOCKER_IMAGE}:${INFRAHUB_TESTING_IMAGE_VERSION}"
169
- command: uvicorn --host 0.0.0.0 --port 4200 --factory infrahub.prefect_server.app:create_infrahub_prefect
169
+ command: "${PREFECT_SERVER_COMMAND:-gunicorn -k uvicorn.workers.UvicornWorker -b 0.0.0.0:4200 'infrahub.prefect_server.app:create_infrahub_prefect()'}"
170
170
  depends_on:
171
171
  task-manager-db:
172
172
  condition: service_healthy
173
+ cache:
174
+ condition: service_healthy
173
175
  environment:
174
176
  PREFECT_UI_ENABLED: "${INFRAHUB_TESTING_PREFECT_UI_ENABLED}" # enabling UI requires permissions, run container as root to enable UI
175
177
  PREFECT_API_DATABASE_CONNECTION_URL: postgresql+asyncpg://postgres:postgres@task-manager-db:5432/prefect
178
+
179
+ INFRAHUB_CACHE_ADDRESS: ${INFRAHUB_TESTING_CACHE_ADDRESS}
180
+ PREFECT_REDIS_MESSAGING_HOST: "${INFRAHUB_TESTING_CACHE_ADDRESS:-cache}"
181
+ PREFECT_REDIS_MESSAGING_DB: "1"
182
+ PREFECT_REDIS_MESSAGING_CONSUMER_MIN_IDLE_TIME: "30"
183
+ PREFECT_REDIS_MESSAGING_PUBLISHER_BATCH_SIZE: "1"
184
+
185
+ PREFECT_MESSAGING_BROKER:
186
+ PREFECT_MESSAGING_CACHE:
187
+ PREFECT__SERVER_WEBSERVER_ONLY:
188
+ PREFECT_API_DATABASE_MIGRATE_ON_START:
189
+ PREFECT_API_BLOCKS_REGISTER_ON_START:
190
+ PREFECT_SERVER_SERVICES_EVENT_LOGGER_ENABLED:
191
+ PREFECT_SERVER_SERVICES_EVENT_PERSISTER_ENABLED:
192
+ PREFECT_SERVER_SERVICES_TRIGGERS_ENABLED:
193
+ PREFECT_SERVER_SERVICES_TASK_RUN_RECORDER_ENABLED:
194
+
195
+ WEB_CONCURRENCY: ${INFRAHUB_TESTING_TASKMGR_API_WORKERS:-1}
176
196
  healthcheck:
177
197
  test: /usr/local/bin/httpx http://localhost:4200/api/health || exit 1
178
198
  interval: 5s
@@ -182,8 +202,42 @@ services:
182
202
  ports:
183
203
  - ${INFRAHUB_TESTING_TASK_MANAGER_PORT:-0}:4200
184
204
 
205
+ task-manager-background-svc:
206
+ deploy:
207
+ mode: replicated
208
+ replicas: ${INFRAHUB_TESTING_TASKMGR_BACKGROUND_SVC_REPLICAS:-0}
209
+ image: "${INFRAHUB_TESTING_DOCKER_IMAGE}:${INFRAHUB_TESTING_IMAGE_VERSION}"
210
+ command: prefect server services start
211
+ restart: unless-stopped
212
+ depends_on:
213
+ task-manager:
214
+ condition: service_healthy
215
+ task-manager-db:
216
+ condition: service_healthy
217
+ cache:
218
+ condition: service_healthy
219
+ environment:
220
+ PREFECT_UI_ENABLED: "${INFRAHUB_TESTING_PREFECT_UI_ENABLED}" # This might be required because triggers actions service depends on an in-memory API server
221
+ PREFECT_API_DATABASE_CONNECTION_URL: postgresql+asyncpg://postgres:postgres@task-manager-db:5432/prefect
222
+
223
+ PREFECT_API_DATABASE_MIGRATE_ON_START: "false"
224
+ PREFECT_API_BLOCKS_REGISTER_ON_START: "false"
225
+ INFRAHUB_CACHE_ADDRESS: ${INFRAHUB_TESTING_CACHE_ADDRESS}
226
+ PREFECT_MESSAGING_BROKER: prefect_redis.messaging
227
+ PREFECT_MESSAGING_CACHE: prefect_redis.messaging
228
+ PREFECT_REDIS_MESSAGING_HOST: "${INFRAHUB_TESTING_CACHE_ADDRESS:-cache}"
229
+ PREFECT_REDIS_MESSAGING_DB: "1"
230
+ PREFECT_REDIS_MESSAGING_CONSUMER_MIN_IDLE_TIME: "30"
231
+ PREFECT_REDIS_MESSAGING_PUBLISHER_BATCH_SIZE: "1"
232
+
233
+ PREFECT_SERVER_SERVICES_EVENT_LOGGER_ENABLED: "true"
234
+ PREFECT_SERVER_SERVICES_EVENT_PERSISTER_ENABLED: "true"
235
+ PREFECT_SERVER_SERVICES_TRIGGERS_ENABLED: "true"
236
+ PREFECT_SERVER_SERVICES_TASK_RUN_RECORDER_ENABLED: "true"
237
+
185
238
  task-manager-db:
186
239
  image: "${POSTGRES_DOCKER_IMAGE:-postgres:16-alpine}"
240
+ command: postgres -c 'max_connections=${INFRAHUB_TESTING_TASK_MANAGER_DB_MAX_CONNECTIONS:-100}'
187
241
  environment:
188
242
  - POSTGRES_USER=postgres
189
243
  - POSTGRES_PASSWORD=postgres
@@ -265,6 +319,7 @@ services:
265
319
  INFRAHUB_DB_PROTOCOL: ${INFRAHUB_TESTING_DB_PROTOCOL:-neo4j}
266
320
  INFRAHUB_WORKFLOW_ADDRESS: ${INFRAHUB_TESTING_WORKFLOW_ADDRESS}
267
321
  INFRAHUB_TIMEOUT: ${INFRAHUB_TESTING_TIMEOUT}
322
+ INFRAHUB_PAGINATION_SIZE: ${INFRAHUB_TESTING_PAGINATION_SIZE:-50}
268
323
  PREFECT_API_URL: ${INFRAHUB_TESTING_PREFECT_API}
269
324
  # Tracing
270
325
  INFRAHUB_TRACE_ENABLE: ${INFRAHUB_TRACE_ENABLE:-false}
@@ -77,13 +77,33 @@ services:
77
77
 
78
78
  task-manager:
79
79
  image: "${INFRAHUB_TESTING_DOCKER_IMAGE}:${INFRAHUB_TESTING_IMAGE_VERSION}"
80
- command: uvicorn --host 0.0.0.0 --port 4200 --factory infrahub.prefect_server.app:create_infrahub_prefect
80
+ command: "${PREFECT_SERVER_COMMAND:-gunicorn -k uvicorn.workers.UvicornWorker -b 0.0.0.0:4200 'infrahub.prefect_server.app:create_infrahub_prefect()'}"
81
81
  depends_on:
82
82
  task-manager-db:
83
83
  condition: service_healthy
84
+ cache:
85
+ condition: service_healthy
84
86
  environment:
85
87
  PREFECT_UI_ENABLED: "${INFRAHUB_TESTING_PREFECT_UI_ENABLED}" # enabling UI requires permissions, run container as root to enable UI
86
88
  PREFECT_API_DATABASE_CONNECTION_URL: postgresql+asyncpg://postgres:postgres@task-manager-db:5432/prefect
89
+
90
+ INFRAHUB_CACHE_ADDRESS: ${INFRAHUB_TESTING_CACHE_ADDRESS}
91
+ PREFECT_REDIS_MESSAGING_HOST: "${INFRAHUB_TESTING_CACHE_ADDRESS:-cache}"
92
+ PREFECT_REDIS_MESSAGING_DB: "1"
93
+ PREFECT_REDIS_MESSAGING_CONSUMER_MIN_IDLE_TIME: "30"
94
+ PREFECT_REDIS_MESSAGING_PUBLISHER_BATCH_SIZE: "1"
95
+
96
+ PREFECT_MESSAGING_BROKER:
97
+ PREFECT_MESSAGING_CACHE:
98
+ PREFECT__SERVER_WEBSERVER_ONLY:
99
+ PREFECT_API_DATABASE_MIGRATE_ON_START:
100
+ PREFECT_API_BLOCKS_REGISTER_ON_START:
101
+ PREFECT_SERVER_SERVICES_EVENT_LOGGER_ENABLED:
102
+ PREFECT_SERVER_SERVICES_EVENT_PERSISTER_ENABLED:
103
+ PREFECT_SERVER_SERVICES_TRIGGERS_ENABLED:
104
+ PREFECT_SERVER_SERVICES_TASK_RUN_RECORDER_ENABLED:
105
+
106
+ WEB_CONCURRENCY: ${INFRAHUB_TESTING_TASKMGR_API_WORKERS:-1}
87
107
  healthcheck:
88
108
  test: /usr/local/bin/httpx http://localhost:4200/api/health || exit 1
89
109
  interval: 5s
@@ -93,8 +113,42 @@ services:
93
113
  ports:
94
114
  - ${INFRAHUB_TESTING_TASK_MANAGER_PORT:-0}:4200
95
115
 
116
+ task-manager-background-svc:
117
+ deploy:
118
+ mode: replicated
119
+ replicas: ${INFRAHUB_TESTING_TASKMGR_BACKGROUND_SVC_REPLICAS:-0}
120
+ image: "${INFRAHUB_TESTING_DOCKER_IMAGE}:${INFRAHUB_TESTING_IMAGE_VERSION}"
121
+ command: prefect server services start
122
+ restart: unless-stopped
123
+ depends_on:
124
+ task-manager:
125
+ condition: service_healthy
126
+ task-manager-db:
127
+ condition: service_healthy
128
+ cache:
129
+ condition: service_healthy
130
+ environment:
131
+ PREFECT_UI_ENABLED: "${INFRAHUB_TESTING_PREFECT_UI_ENABLED}" # This might be required because triggers actions service depends on an in-memory API server
132
+ PREFECT_API_DATABASE_CONNECTION_URL: postgresql+asyncpg://postgres:postgres@task-manager-db:5432/prefect
133
+
134
+ PREFECT_API_DATABASE_MIGRATE_ON_START: "false"
135
+ PREFECT_API_BLOCKS_REGISTER_ON_START: "false"
136
+ INFRAHUB_CACHE_ADDRESS: ${INFRAHUB_TESTING_CACHE_ADDRESS}
137
+ PREFECT_MESSAGING_BROKER: prefect_redis.messaging
138
+ PREFECT_MESSAGING_CACHE: prefect_redis.messaging
139
+ PREFECT_REDIS_MESSAGING_HOST: "${INFRAHUB_TESTING_CACHE_ADDRESS:-cache}"
140
+ PREFECT_REDIS_MESSAGING_DB: "1"
141
+ PREFECT_REDIS_MESSAGING_CONSUMER_MIN_IDLE_TIME: "30"
142
+ PREFECT_REDIS_MESSAGING_PUBLISHER_BATCH_SIZE: "1"
143
+
144
+ PREFECT_SERVER_SERVICES_EVENT_LOGGER_ENABLED: "true"
145
+ PREFECT_SERVER_SERVICES_EVENT_PERSISTER_ENABLED: "true"
146
+ PREFECT_SERVER_SERVICES_TRIGGERS_ENABLED: "true"
147
+ PREFECT_SERVER_SERVICES_TASK_RUN_RECORDER_ENABLED: "true"
148
+
96
149
  task-manager-db:
97
150
  image: "${POSTGRES_DOCKER_IMAGE:-postgres:16-alpine}"
151
+ command: postgres -c 'max_connections=${INFRAHUB_TESTING_TASK_MANAGER_DB_MAX_CONNECTIONS:-100}'
98
152
  environment:
99
153
  - POSTGRES_USER=postgres
100
154
  - POSTGRES_PASSWORD=postgres
@@ -172,6 +226,7 @@ services:
172
226
  INFRAHUB_DB_ADDRESS: ${INFRAHUB_TESTING_DB_ADDRESS:-database}
173
227
  INFRAHUB_WORKFLOW_ADDRESS: ${INFRAHUB_TESTING_WORKFLOW_ADDRESS}
174
228
  INFRAHUB_TIMEOUT: ${INFRAHUB_TESTING_TIMEOUT}
229
+ INFRAHUB_PAGINATION_SIZE: ${INFRAHUB_TESTING_PAGINATION_SIZE:-50}
175
230
  PREFECT_API_URL: ${INFRAHUB_TESTING_PREFECT_API}
176
231
  INFRAHUB_EXPERIMENTAL_VALUE_DB_INDEX:
177
232
  # Tracing
@@ -29,11 +29,14 @@ class TestInfrahubDocker:
29
29
  return result.stdout
30
30
 
31
31
  @staticmethod
32
- def execute_command(command: str, address: str, concurrent_execution: int = 10) -> subprocess.CompletedProcess[str]:
32
+ def execute_command(
33
+ command: str, address: str, concurrent_execution: int = 10, pagination_size: int = 50
34
+ ) -> subprocess.CompletedProcess[str]:
33
35
  env = os.environ.copy()
34
36
  env["INFRAHUB_ADDRESS"] = address
35
37
  env["INFRAHUB_API_TOKEN"] = PROJECT_ENV_VARIABLES["INFRAHUB_TESTING_INITIAL_ADMIN_TOKEN"]
36
38
  env["INFRAHUB_MAX_CONCURRENT_EXECUTION"] = f"{concurrent_execution}"
39
+ env["INFRAHUB_PAGINATION_SIZE"] = f"{pagination_size}"
37
40
  result = subprocess.run( # noqa: S602
38
41
  command, shell=True, capture_output=True, text=True, env=env, check=False
39
42
  )
@@ -1,11 +1,11 @@
1
1
  [project]
2
2
  name = "infrahub-testcontainers"
3
- version = "1.3.6"
3
+ version = "1.4.0b1"
4
4
  requires-python = ">=3.9"
5
5
 
6
6
  [tool.poetry]
7
7
  name = "infrahub-testcontainers"
8
- version = "1.3.6"
8
+ version = "1.4.0b1"
9
9
  description = "Testcontainers instance for Infrahub to easily build integration tests"
10
10
  authors = ["OpsMill <info@opsmill.com>"]
11
11
  readme = "README.md"
@@ -39,7 +39,7 @@ psutil = "*"
39
39
  pytest = "*"
40
40
  httpx = "^0.28.1"
41
41
  pydantic = "^2.10.6"
42
- prefect-client = "3.4.1"
42
+ prefect-client = "3.4.11"
43
43
 
44
44
  [tool.poetry.group.dev.dependencies]
45
45
  rich = "^13.9.4"