Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
Signed-off-by: Aviram Hassan <[email protected]>
  • Loading branch information
aviramha committed Feb 6, 2024
1 parent a288295 commit 3574da4
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion examples/get-manifest/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ pub async fn main() {
let auth = build_auth(&reference, &cli);

let client_config = build_client_config(&cli);
let mut client = Client::new(client_config);
let client = Client::new(client_config);

let (manifest, _) = client
.pull_manifest(&reference, &auth)
Expand Down
10 changes: 10 additions & 0 deletions src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -534,6 +534,8 @@ impl Client {
authentication: &RegistryAuth,
operation: RegistryOperation,
) -> Result<Option<String>> {
self.store_auth_if_needed(image.resolve_registry(), authentication)
.await;
// preserve old caching behavior
match self._auth(image, authentication, operation).await {
Ok(Some(RegistryTokenType::Bearer(token))) => {
Expand Down Expand Up @@ -1802,6 +1804,14 @@ mod test {
.as_str()
.to_string();

// we have to have it in the stored auth so we'll get to the token cache check.
client
.store_auth(
&Reference::try_from(HELLO_IMAGE_TAG)?.resolve_registry(),
RegistryAuth::Anonymous,
)
.await;

client
.tokens
.insert(
Expand Down

0 comments on commit 3574da4

Please sign in to comment.