-
Notifications
You must be signed in to change notification settings - Fork 292
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
25 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
from testcontainers.custom import CustomContainer | ||
|
||
|
||
def test_custom_container(): | ||
"""Test that the settings are active on the instance. | ||
The functionality of spinning up containers are handled by other classes, | ||
so only make sure that configuration is set correctly. | ||
""" | ||
image = "google/cloud-sdk:latest" # Select a suitable image | ||
command = "echo 'test'" | ||
env = {"ENV1": "VAL1"} | ||
name = "my-container" | ||
ports = [8080, 8081] | ||
volumes = [("/dev/null", "/dev/null2", "ro")] | ||
|
||
with CustomContainer( | ||
image=image, command=command, env=env, name=name, ports=ports, volumes=volumes | ||
) as container: | ||
assert container.image == image | ||
assert container._command == command | ||
assert container.env == env | ||
assert container._name == name | ||
assert list(container.ports.keys()) == ports | ||
assert container.volumes == {"/dev/null": {"bind": "/dev/null2", "mode": "ro"}} |