-
Notifications
You must be signed in to change notification settings - Fork 22
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
1 parent
ca8c2d0
commit 2ad77e2
Showing
4 changed files
with
62 additions
and
1 deletion.
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
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
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,33 @@ | ||
import os | ||
|
||
import pytest | ||
from pytest_container import DerivedContainer | ||
from pytest_container.container import ContainerLauncher | ||
from pytest_container.runtime import OciRuntimeBase | ||
from bci_tester.data import KUBECTL_CONTAINERS | ||
|
||
@pytest.mark.parametrize("ctr_image", KUBECTL_CONTAINERS) | ||
def test_kubectl_binary( | ||
container_runtime: OciRuntimeBase, | ||
pytestconfig: pytest.Config, | ||
ctr_image: DerivedContainer, | ||
) -> None: | ||
kubectl_ctr = DerivedContainer( | ||
base=ctr_image, | ||
custom_entry_point="/bin/bash", | ||
) | ||
|
||
with ContainerLauncher.from_pytestconfig( | ||
kubectl_ctr, container_runtime, pytestconfig | ||
) as kubectl_launcher: | ||
kubectl_launcher.launch_container() | ||
kubectl_con = kubectl_launcher.container_data.connection | ||
output = kubectl_con.check_output( | ||
"kubectl create deployment nginx --image=nginx --dry-run=client -o yaml" | ||
).strip() | ||
assert len(output) == 383 | ||
assert ( | ||
output | ||
== "apiVersion: apps/v1\nkind: Deployment\nmetadata:\n creationTimestamp: null\n labels:\n app: nginx\n name: nginx\nspec:\n replicas: 1\n selector:\n matchLabels:\n app: nginx\n strategy: {}\n template:\n metadata:\n creationTimestamp: null\n labels:\n app: nginx\n spec:\n containers:\n - image: nginx\n name: nginx\n resources: {}\nstatus: {}" | ||
) | ||
|
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