|
10 | 10 |
|
11 | 11 | from django.test import SimpleTestCase |
12 | 12 |
|
| 13 | +from core.runtime_identity import read_runtime_identity |
13 | 14 | from deploy.aws_gateway import AwsReleaseConfig, AwsReleaseGateway |
14 | 15 | from deploy.contracts import ( |
15 | 16 | ReleaseContractError, |
@@ -292,6 +293,50 @@ def observed_binding() -> WebRuntimeBinding: |
292 | 293 |
|
293 | 294 |
|
294 | 295 | class WebRuntimeCoherenceTests(SimpleTestCase): |
| 296 | + def test_deployed_browser_smoke_receives_complete_runtime_identity(self) -> None: |
| 297 | + gateway = AwsReleaseGateway.__new__(AwsReleaseGateway) |
| 298 | + gateway.config = config() |
| 299 | + observed: dict[str, Any] = {} |
| 300 | + |
| 301 | + def collect_subprocess( |
| 302 | + command: list[str], |
| 303 | + *, |
| 304 | + check: bool, |
| 305 | + env: dict[str, str], |
| 306 | + timeout: int, |
| 307 | + ) -> None: |
| 308 | + observed.update( |
| 309 | + command=command, |
| 310 | + check=check, |
| 311 | + env=env, |
| 312 | + timeout=timeout, |
| 313 | + runtime_identity=read_runtime_identity(env), |
| 314 | + ) |
| 315 | + |
| 316 | + workflow_environment = { |
| 317 | + "VERSION": VERSION, |
| 318 | + "IMAGE_DIGEST": IMAGE_DIGEST, |
| 319 | + "RELEASE_SHA": SOURCE_SHA, |
| 320 | + } |
| 321 | + with ( |
| 322 | + patch.dict("os.environ", workflow_environment, clear=True), |
| 323 | + patch("deploy.aws_gateway.run_http_smoke"), |
| 324 | + patch("deploy.aws_gateway.subprocess.run", side_effect=collect_subprocess), |
| 325 | + ): |
| 326 | + gateway.run_deployed_smoke(identity()) |
| 327 | + |
| 328 | + runtime_identity = observed["runtime_identity"] |
| 329 | + self.assertEqual(runtime_identity.version, VERSION) |
| 330 | + self.assertEqual(runtime_identity.source_sha, SOURCE_SHA) |
| 331 | + self.assertEqual(runtime_identity.image_digest, IMAGE_DIGEST) |
| 332 | + environment = cast(dict[str, str], observed["env"]) |
| 333 | + self.assertEqual(environment["VERSION"], VERSION) |
| 334 | + self.assertEqual(environment["SOURCE_SHA"], SOURCE_SHA) |
| 335 | + self.assertEqual(environment["IMAGE_DIGEST"], IMAGE_DIGEST) |
| 336 | + self.assertEqual(environment["DTC_EXPECTED_VERSION"], VERSION) |
| 337 | + self.assertEqual(environment["DTC_EXPECTED_SOURCE_SHA"], SOURCE_SHA) |
| 338 | + self.assertEqual(environment["DTC_EXPECTED_IMAGE_DIGEST"], IMAGE_DIGEST) |
| 339 | + |
295 | 340 | def test_eventual_visibility_freezes_two_samples_around_public_health(self) -> None: |
296 | 341 | events: list[str] = [] |
297 | 342 | clock = FakeClock() |
|
0 commit comments