File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -734,9 +734,13 @@ private void handleError(HttpClient.ResponseWrapper<?> responseWrapper) {
734734 private void logResponse (HttpClient .ResponseWrapper <?> response ) {
735735 LOG .debug ("Status Code: {}" , response .statusCode ());
736736 LOG .debug ("Headers: {}" , response .headers ());
737+ String contentType = response .headers ().get (Const .CONTENT_TYPE_HEADER .toLowerCase ());
738+ boolean isBinaryResponse = contentType != null && contentType .contains ("octet-stream" );
737739 // Only log non-binary responses
738- if (response .response () instanceof String ) {
740+ if (response .response () instanceof String && ! isBinaryResponse ) {
739741 LOG .debug ("Response: {}" , response .response ());
742+ } else {
743+ LOG .debug ("Not logging binary response of content type: {}" , contentType );
740744 }
741745 }
742746
Original file line number Diff line number Diff line change @@ -391,9 +391,9 @@ public <T> TokenResponse refreshToken(
391391 "Response: {}" ,
392392 responseWrapper
393393 .response ()
394- .replaceAll ("\" token\" \\ s*:\\ s*\" ([A-Za-z0-9\\ -_\\ .]+)\" " , "\" token\" :\" <redacted>\" " )
394+ .replaceAll ("\" token\" \\ s*:\\ s*\" ([A-Za-z0-9\\ -_\\ .= ]+)\" " , "\" token\" :\" <redacted>\" " )
395395 .replaceAll (
396- "\" access_token\" \\ s*:\\ s*\" ([A-Za-z0-9\\ -_\\ .]+)\" " ,
396+ "\" access_token\" \\ s*:\\ s*\" ([A-Za-z0-9\\ -_\\ .= ]+)\" " ,
397397 "\" access_token\" :\" <redacted>\" " ));
398398 LOG .debug (
399399 "Headers: {}" ,
Original file line number Diff line number Diff line change 2222
2323import static org .junit .jupiter .api .Assertions .assertNotNull ;
2424
25+ import java .io .IOException ;
26+ import java .nio .file .Path ;
2527import org .junit .jupiter .api .Test ;
28+ import org .junit .jupiter .api .io .TempDir ;
2629import org .junit .jupiter .api .parallel .Execution ;
2730import org .junit .jupiter .api .parallel .ExecutionMode ;
2831
2932@ Execution (ExecutionMode .CONCURRENT )
3033class PublicAzureCRITCase {
3134
35+ @ TempDir
36+ private Path tempDir ;
37+
3238 @ Test
3339 void shouldPullAnonymousIndex () {
3440
@@ -57,4 +63,15 @@ void shouldPullAnonymousManifest() {
5763 Manifest manifest1 = registry .getManifest (containerRef1 );
5864 assertNotNull (manifest1 );
5965 }
66+
67+ @ Test
68+ void shouldPullOneBlob () throws IOException {
69+ Registry registry = Registry .builder ().build ();
70+ ContainerRef containerRef1 = ContainerRef .parse (
71+ "mcr.microsoft.com/azurelinux/busybox@sha256:ec5adfc87f57633da1feedb2361c06374020ab9c99d4a14b19319e57284b6656" );
72+ Manifest manifest = registry .getManifest (containerRef1 );
73+ Layer oneLayer = manifest .getLayers ().get (0 );
74+ registry .fetchBlob (containerRef1 .withDigest (oneLayer .getDigest ()), tempDir .resolve ("my-blob" ));
75+ assertNotNull (tempDir .resolve ("my-blob" ));
76+ }
6077}
Original file line number Diff line number Diff line change 2222
2323import static org .junit .jupiter .api .Assertions .assertNotNull ;
2424
25+ import java .io .IOException ;
26+ import java .nio .file .Path ;
2527import org .junit .jupiter .api .Test ;
28+ import org .junit .jupiter .api .io .TempDir ;
2629
2730class QuayIoITCase {
2831
32+ @ TempDir
33+ private Path tempDir ;
34+
2935 @ Test
30- void shouldPull () {
36+ void shouldPullIndex () {
3137 Registry registry = Registry .builder ().build ();
3238 ContainerRef containerRef1 = ContainerRef .parse ("quay.io/openshift/origin-cli:latest" );
3339 Index index = registry .getIndex (containerRef1 );
3440 assertNotNull (index );
3541 }
42+
43+ @ Test
44+ void shouldPullManifest () {
45+ Registry registry = Registry .builder ().build ();
46+ ContainerRef containerRef1 = ContainerRef .parse (
47+ "quay.io/openshift/origin-cli@sha256:58b3680e6f8141829412f3010477ed84ebc73da65665dcde988e0b2a1276ae1f" );
48+ Manifest manifest = registry .getManifest (containerRef1 );
49+ assertNotNull (manifest );
50+ }
51+
52+ @ Test
53+ void shouldPullOneBlob () throws IOException {
54+ Registry registry = Registry .builder ().build ();
55+ ContainerRef containerRef1 = ContainerRef .parse (
56+ "quay.io/openshift/origin-cli@sha256:58b3680e6f8141829412f3010477ed84ebc73da65665dcde988e0b2a1276ae1f" );
57+ Manifest manifest = registry .getManifest (containerRef1 );
58+ Layer oneLayer = manifest .getLayers ().get (0 );
59+ registry .fetchBlob (containerRef1 .withDigest (oneLayer .getDigest ()), tempDir .resolve ("my-blob" ));
60+ assertNotNull (tempDir .resolve ("my-blob" ));
61+ }
3662}
You can’t perform that action at this time.
0 commit comments