@@ -17,52 +17,52 @@ import (
1717
1818func TestBlobClient_CancelUpload (t * testing.T ) {
1919 startRecording (t )
20- cred , options := getCredAndClientOptions (t )
20+ endpoint , cred , options := getEndpointCredAndClientOptions (t )
2121 ctx := context .Background ()
22- client , err := NewBlobClient ("https://azacrlivetest.azurecr.io" , cred , & BlobClientOptions {ClientOptions : options })
22+ client , err := NewBlobClient (endpoint , cred , & BlobClientOptions {ClientOptions : options })
2323 require .NoError (t , err )
24- startRes , err := client .StartUpload (ctx , "hello-world-test " , nil )
24+ startRes , err := client .StartUpload (ctx , "hello-world" , nil )
2525 require .NoError (t , err )
2626 _ , err = client .CancelUpload (ctx , * startRes .Location , nil )
2727 require .NoError (t , err )
2828}
2929
3030func TestBlobClient_CheckBlobExists (t * testing.T ) {
3131 startRecording (t )
32- cred , options := getCredAndClientOptions (t )
32+ endpoint , cred , options := getEndpointCredAndClientOptions (t )
3333 ctx := context .Background ()
34- client , err := NewBlobClient ("https://azacrlivetest.azurecr.io" , cred , & BlobClientOptions {ClientOptions : options })
34+ client , err := NewBlobClient (endpoint , cred , & BlobClientOptions {ClientOptions : options })
3535 require .NoError (t , err )
36- digest := "sha256:2db29710123e3e53a794f2694094b9b4338aa9ee5c40b930cb8063a1be392c54 "
37- res , err := client .CheckBlobExists (ctx , "hello-world " , digest , nil )
36+ digest := "sha256:042a816809aac8d0f7d7cacac7965782ee2ecac3f21bcf9f24b1de1a7387b769 "
37+ res , err := client .CheckBlobExists (ctx , "alpine " , digest , nil )
3838 require .NoError (t , err )
3939 require .Equal (t , digest , * res .DockerContentDigest )
4040}
4141
4242func TestBlobClient_CheckChunkExists (t * testing.T ) {
4343 startRecording (t )
44- cred , options := getCredAndClientOptions (t )
44+ endpoint , cred , options := getEndpointCredAndClientOptions (t )
4545 ctx := context .Background ()
46- client , err := NewBlobClient ("https://azacrlivetest.azurecr.io" , cred , & BlobClientOptions {ClientOptions : options })
46+ client , err := NewBlobClient (endpoint , cred , & BlobClientOptions {ClientOptions : options })
4747 require .NoError (t , err )
48- digest := "sha256:2db29710123e3e53a794f2694094b9b4338aa9ee5c40b930cb8063a1be392c54 "
49- res , err := client .CheckChunkExists (ctx , "hello-world " , digest , "bytes=0-299" , nil )
48+ digest := "sha256:042a816809aac8d0f7d7cacac7965782ee2ecac3f21bcf9f24b1de1a7387b769 "
49+ res , err := client .CheckChunkExists (ctx , "alpine " , digest , "bytes=0-299" , nil )
5050 require .NoError (t , err )
5151 require .NotEmpty (t , * res .ContentLength )
5252}
5353
5454func TestBlobClient_completeUpload_wrongDigest (t * testing.T ) {
5555 startRecording (t )
56- cred , options := getCredAndClientOptions (t )
56+ endpoint , cred , options := getEndpointCredAndClientOptions (t )
5757 ctx := context .Background ()
58- client , err := NewBlobClient ("https://azacrlivetest.azurecr.io" , cred , & BlobClientOptions {ClientOptions : options })
58+ client , err := NewBlobClient (endpoint , cred , & BlobClientOptions {ClientOptions : options })
5959 require .NoError (t , err )
60- digest := "sha256:2db29710123e3e53a794f2694094b9b4338aa9ee5c40b930cb8063a1be392c54 "
61- getRes , err := client .GetBlob (ctx , "hello-world " , digest , nil )
60+ digest := "sha256:042a816809aac8d0f7d7cacac7965782ee2ecac3f21bcf9f24b1de1a7387b769 "
61+ getRes , err := client .GetBlob (ctx , "alpine " , digest , nil )
6262 require .NoError (t , err )
6363 blob , err := io .ReadAll (getRes .BlobData )
6464 require .NoError (t , err )
65- startRes , err := client .StartUpload (ctx , "hello-world-test " , nil )
65+ startRes , err := client .StartUpload (ctx , "hello-world" , nil )
6666 require .NoError (t , err )
6767 uploadResp , err := client .uploadChunk (ctx , * startRes .Location , streaming .NopCloser (bytes .NewReader (blob )), nil )
6868 require .NoError (t , err )
@@ -72,46 +72,46 @@ func TestBlobClient_completeUpload_wrongDigest(t *testing.T) {
7272
7373func TestBlobClient_DeleteBlob (t * testing.T ) {
7474 startRecording (t )
75- cred , options := getCredAndClientOptions (t )
75+ endpoint , cred , options := getEndpointCredAndClientOptions (t )
7676 ctx := context .Background ()
77- client , err := NewBlobClient ("https://azacrlivetest.azurecr.io" , cred , & BlobClientOptions {ClientOptions : options })
77+ client , err := NewBlobClient (endpoint , cred , & BlobClientOptions {ClientOptions : options })
7878 require .NoError (t , err )
79- digest := "sha256:2db29710123e3e53a794f2694094b9b4338aa9ee5c40b930cb8063a1be392c54 "
80- _ , err = client .DeleteBlob (ctx , "hello-world-test " , digest , nil )
79+ digest := "sha256:042a816809aac8d0f7d7cacac7965782ee2ecac3f21bcf9f24b1de1a7387b769 "
80+ _ , err = client .DeleteBlob (ctx , "alpine " , digest , nil )
8181 require .NoError (t , err )
8282}
8383
8484func TestBlobClient_GetBlob (t * testing.T ) {
8585 startRecording (t )
86- cred , options := getCredAndClientOptions (t )
86+ endpoint , cred , options := getEndpointCredAndClientOptions (t )
8787 ctx := context .Background ()
88- client , err := NewBlobClient ("https://azacrlivetest.azurecr.io" , cred , & BlobClientOptions {ClientOptions : options })
88+ client , err := NewBlobClient (endpoint , cred , & BlobClientOptions {ClientOptions : options })
8989 require .NoError (t , err )
90- digest := "sha256:2db29710123e3e53a794f2694094b9b4338aa9ee5c40b930cb8063a1be392c54 "
91- res , err := client .GetBlob (ctx , "hello-world " , digest , nil )
90+ digest := "sha256:042a816809aac8d0f7d7cacac7965782ee2ecac3f21bcf9f24b1de1a7387b769 "
91+ res , err := client .GetBlob (ctx , "alpine " , digest , nil )
9292 require .NoError (t , err )
9393 require .NotEmpty (t , * res .ContentLength )
9494}
9595
9696func TestBlobClient_GetChunk (t * testing.T ) {
9797 startRecording (t )
98- cred , options := getCredAndClientOptions (t )
98+ endpoint , cred , options := getEndpointCredAndClientOptions (t )
9999 ctx := context .Background ()
100- client , err := NewBlobClient ("https://azacrlivetest.azurecr.io" , cred , & BlobClientOptions {ClientOptions : options })
100+ client , err := NewBlobClient (endpoint , cred , & BlobClientOptions {ClientOptions : options })
101101 require .NoError (t , err )
102- digest := "sha256:feac5306138255e28a9862d3f3d29025d0a4d0648855afe1acd6131af07138ac "
103- res , err := client .GetChunk (ctx , "ubuntu " , digest , "bytes=0-1000 " , nil )
102+ digest := "sha256:042a816809aac8d0f7d7cacac7965782ee2ecac3f21bcf9f24b1de1a7387b769 "
103+ res , err := client .GetChunk (ctx , "alpine " , digest , "bytes=0-999 " , nil )
104104 require .NoError (t , err )
105- require .NotEmpty (t , * res .ContentLength )
105+ require .Equal (t , * res .ContentLength , int64 ( 1000 ) )
106106}
107107
108108func TestBlobClient_GetUploadStatus (t * testing.T ) {
109109 startRecording (t )
110- cred , options := getCredAndClientOptions (t )
110+ endpoint , cred , options := getEndpointCredAndClientOptions (t )
111111 ctx := context .Background ()
112- client , err := NewBlobClient ("https://azacrlivetest.azurecr.io" , cred , & BlobClientOptions {ClientOptions : options })
112+ client , err := NewBlobClient (endpoint , cred , & BlobClientOptions {ClientOptions : options })
113113 require .NoError (t , err )
114- startRes , err := client .StartUpload (ctx , "hello-world-test " , nil )
114+ startRes , err := client .StartUpload (ctx , "hello-world" , nil )
115115 require .NoError (t , err )
116116 checkResp , err := client .GetUploadStatus (ctx , * startRes .Location , nil )
117117 require .NoError (t , err )
@@ -122,23 +122,23 @@ func TestBlobClient_GetUploadStatus(t *testing.T) {
122122
123123func TestBlobClient_MountBlob (t * testing.T ) {
124124 startRecording (t )
125- cred , options := getCredAndClientOptions (t )
125+ endpoint , cred , options := getEndpointCredAndClientOptions (t )
126126 ctx := context .Background ()
127- client , err := NewBlobClient ("https://azacrlivetest.azurecr.io" , cred , & BlobClientOptions {ClientOptions : options })
127+ client , err := NewBlobClient (endpoint , cred , & BlobClientOptions {ClientOptions : options })
128128 require .NoError (t , err )
129- digest := "sha256:2db29710123e3e53a794f2694094b9b4338aa9ee5c40b930cb8063a1be392c54 "
130- res , err := client .MountBlob (ctx , "hello-world" , "hello-world-test " , digest , nil )
129+ digest := "sha256:042a816809aac8d0f7d7cacac7965782ee2ecac3f21bcf9f24b1de1a7387b769 "
130+ res , err := client .MountBlob (ctx , "hello-world" , "alpine " , digest , nil )
131131 require .NoError (t , err )
132132 require .NotEmpty (t , res .Location )
133133}
134134
135135func TestBlobClient_StartUpload (t * testing.T ) {
136136 startRecording (t )
137- cred , options := getCredAndClientOptions (t )
137+ endpoint , cred , options := getEndpointCredAndClientOptions (t )
138138 ctx := context .Background ()
139- client , err := NewBlobClient ("https://azacrlivetest.azurecr.io" , cred , & BlobClientOptions {ClientOptions : options })
139+ client , err := NewBlobClient (endpoint , cred , & BlobClientOptions {ClientOptions : options })
140140 require .NoError (t , err )
141- startRes , err := client .StartUpload (ctx , "hello-world-test " , nil )
141+ startRes , err := client .StartUpload (ctx , "hello-world" , nil )
142142 require .NoError (t , err )
143143 require .NotEmpty (t , * startRes .Location )
144144 _ , err = client .CancelUpload (ctx , * startRes .Location , nil )
0 commit comments