coveo-testing-extras
Contains extra testing tools without dependency restrictions.
temporary resource implementation: Docker Container
The docker container temporary resource can be used to prepare short-lived containers.
- Supports building from a dockerfile
- Supports pulling images
- Can signal on AWS ECR logout
- Dynamic port mapping retrieval
- Saves log output before removing the container
Automatic AWS ECR login example
Here's how you can enhance TemporaryDockerContainerResource with automatic ECR login:
from base64 import b64decode
import boto3
from coveo_testing_extras.temporary_resource.docker_container import (
TemporaryDockerContainerResource,
ECRLogoutException,
get_docker_client
)
class WithECR(TemporaryDockerContainerResource):
def obtain_image(self) -> None:
try:
super().obtain_image()
except ECRLogoutException:
self._do_ecr_login()
super().obtain_image()
def _do_ecr_login(self) -> None:
""" Performs an ecr login through awscli. """
assert self.ecr_region
ecr = boto3.client('ecr')
account_id, *_ = self.image_name.split('.')
assert account_id.isdigit()
authorization_data = ecr.get_authorization_token(registryIds=[account_id])['authorizationData'][0]
username, password = b64decode(authorization_data['authorizationToken']).decode().split(':')
with get_docker_client() as client:
login = client.login(username=username, password=password, registry=authorization_data['proxyEndpoint'])
assert login['Status'] == 'Login Succeeded'
Release files for coveo-testing-extras 2.1.8
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| coveo_testing_extras-2.1.8.tar.gz | 5.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| coveo_testing_extras-2.1.8-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 11.2 kB
Release files / coveo_testing_extras-2.1.8.tar.gz
| Download URL | coveo_testing_extras-2.1.8.tar.gz |
|---|---|
| Size | 5.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e018d7f79ef2818c41620096b1c9abe2d85d60ae6ecf497ce9038131ae1a7f58
|
|
BLAKE2b-256 checksum How to use checksums |
08debe112dc9d0512264fa5d64ca015e5209e951587a286ea792d45ee7247d92
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.5.1 CPython/3.9.18 Linux/5.15.0-1050-azure
|
Release files / coveo_testing_extras-2.1.8-py3-none-any.whl
| Download URL | coveo_testing_extras-2.1.8-py3-none-any.whl |
|---|---|
| Size | 6.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
951c2a8d6db0f159194b451ed2092c6f92bcd48c13d52127e3da06e09825a490
|
|
BLAKE2b-256 checksum How to use checksums |
d7aadf2df3b877a7b457f6c4921c655f4b99a10ea39f6fbfb82123ab7cc8edd3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.5.1 CPython/3.9.18 Linux/5.15.0-1050-azure
|