-
Notifications
You must be signed in to change notification settings - Fork 15
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
82ed823
commit f40f9bb
Showing
6 changed files
with
82 additions
and
21 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
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
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,58 @@ | ||
import os | ||
import pathlib | ||
|
||
import pytest | ||
from helpers import RESOURCE_DIR | ||
|
||
from dcontainer.oci.oci_registry import OCIRegistry | ||
|
||
|
||
|
||
TEST_OCI_OBJECT = "ghcr.io/devcontainers-contrib/features/bash-command:1.0.0" | ||
|
||
|
||
@pytest.mark.parametrize( | ||
"oci_ref", | ||
[ | ||
TEST_OCI_OBJECT | ||
], | ||
) | ||
def test_oci_registry_get_manifest( | ||
shell, tmp_path: pathlib.Path, oci_ref: str | ||
) -> None: | ||
manifest = OCIRegistry.get_manifest(oci_ref) | ||
print(manifest) | ||
assert isinstance(manifest, dict) | ||
|
||
|
||
@pytest.mark.parametrize( | ||
"oci_ref", | ||
[ | ||
TEST_OCI_OBJECT | ||
], | ||
) | ||
def test_oci_registry_download_layer( | ||
shell, tmp_path: pathlib.Path, oci_ref: str | ||
) -> None: | ||
output_location = tmp_path.joinpath("layer.tgz") | ||
assert not output_location.exists() | ||
OCIRegistry.download_layer(oci_input=oci_ref,layer_num=0, output_file= output_location) | ||
assert output_location.exists() | ||
|
||
|
||
|
||
@pytest.mark.parametrize( | ||
"oci_ref", | ||
[ | ||
TEST_OCI_OBJECT | ||
], | ||
) | ||
def test_oci_registry_download_and_extract_layer( | ||
shell, tmp_path: pathlib.Path, oci_ref: str | ||
) -> None: | ||
output_location = tmp_path.joinpath("somedir") | ||
assert not output_location.exists() | ||
OCIRegistry.download_and_extract_layer(oci_input=oci_ref,layer_num=0, output_dir=output_location) | ||
assert output_location.exists() | ||
assert len(list(output_location.iterdir())) == 2 | ||
|