-
Notifications
You must be signed in to change notification settings - Fork 1
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
3 changed files
with
42 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 |
---|---|---|
|
@@ -31,6 +31,17 @@ jobs: | |
- uses: Swatinem/[email protected] | ||
with: | ||
key: test_${{ matrix.settings.host }}_${{ matrix.settings.target }} | ||
- uses: docker/login-action@v3 | ||
with: | ||
registry: quay.io | ||
username: fossa+sparkle | ||
password: ${{ secrets.QUAY_API_KEY }} | ||
- uses: docker/login-action@v3 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ github.token }} | ||
|
||
- run: cargo nextest run --all-targets | ||
- run: cargo test --doc | ||
|
||
|
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,30 @@ | ||
use async_tempfile::TempDir; | ||
use circe_lib::{registry::Registry, Authentication, Reference}; | ||
use color_eyre::Result; | ||
use simple_test_case::test_case; | ||
|
||
// These tests require that your local docker instance is authenticated with the servers. | ||
// This is performed before tests are run in CI, but you may need to `docker login` locally. | ||
#[test_case("quay.io/fossa/hubble-api:latest"; "quay.io/fossa/hubble-api:latest")] | ||
#[test_case("ghcr.io/fossas/sherlock/server:latest"; "ghcr.io/fossas/sherlock/server:latest")] | ||
#[test_log::test(tokio::test)] | ||
async fn pull_authed(image: &str) -> Result<()> { | ||
let reference = image.parse::<Reference>()?; | ||
let auth = Authentication::docker(&reference).await?; | ||
let registry = Registry::builder() | ||
.auth(auth) | ||
.reference(reference) | ||
.build() | ||
.await?; | ||
|
||
let layers = registry.layers().await?; | ||
assert!(!layers.is_empty(), "image should have at least one layer"); | ||
|
||
let tmp = TempDir::new().await?; | ||
for layer in layers { | ||
let path = tmp.dir_path().join(layer.digest.as_hex()); | ||
registry.apply_layer(&layer, &path).await?; | ||
} | ||
|
||
Ok(()) | ||
} |
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 |
---|---|---|
@@ -1,3 +1,4 @@ | ||
mod docker; | ||
mod platform; | ||
mod reference; | ||
mod registry; | ||
|