1
1
// Copyright (c) Microsoft Corporation.
2
2
// Licensed under the MIT license.
3
3
4
- import { Recorder , assertEnvironmentVariable } from "@azure-tools/test-recorder" ;
4
+ import { Recorder , assertEnvironmentVariable , isPlaybackMode } from "@azure-tools/test-recorder" ;
5
5
import { ContainerRegistryBlobClient , OciManifest } from "@azure/container-registry" ;
6
6
import { assert , versionsToTest } from "@azure/test-utils" ;
7
7
import { Context } from "mocha" ;
@@ -70,23 +70,6 @@ versionsToTest(serviceVersions, {}, (serviceVersion, onVersions): void => {
70
70
await client . uploadBlob ( config ) ;
71
71
} ;
72
72
73
- /**
74
- * The test proxy goes to the liberty of trimming whitespace from JSON (including our manifests) when responding to
75
- * requests. This means that the recorded Docker-Content-Digest header from the does not match the digest our client
76
- * computes, causing test failures.
77
- *
78
- * We use a transform to substitute in the digest of the whitespace-trimmed JSON so that our client doesn't reject
79
- * the played back request.
80
- */
81
- const mockDockerContentDigestHeader = ( ) =>
82
- recorder . addTransform ( {
83
- type : "HeaderTransform" ,
84
- params : {
85
- key : "Docker-Content-Digest" ,
86
- value : "sha256:70e2ffca8e79adc4bd34b67363a972522d75933e435084826d39a19f958579ed" ,
87
- } ,
88
- } ) ;
89
-
90
73
it ( "can upload OCI manifest" , async ( ) => {
91
74
await uploadManifestPrerequisites ( ) ;
92
75
@@ -99,11 +82,13 @@ versionsToTest(serviceVersions, {}, (serviceVersion, onVersions): void => {
99
82
await client . deleteManifest ( uploadResult . digest ) ;
100
83
} ) ;
101
84
102
- // Tempoarily skip while dealing with recorder issue
103
- it . skip ( "can upload OCI manifest from stream" , async ( ) => {
104
- await uploadManifestPrerequisites ( ) ;
85
+ it ( "can upload OCI manifest from stream" , async function ( this : Mocha . Context ) {
86
+ if ( isPlaybackMode ( ) ) {
87
+ // Temporarily skip during playback while dealing with recorder issue
88
+ this . skip ( ) ;
89
+ }
105
90
106
- await mockDockerContentDigestHeader ( ) ;
91
+ await uploadManifestPrerequisites ( ) ;
107
92
108
93
const manifestStream = fs . createReadStream ( "test/data/oci-artifact/manifest.json" ) ;
109
94
const uploadResult = await client . uploadManifest ( manifestStream ) ;
@@ -127,10 +112,13 @@ versionsToTest(serviceVersions, {}, (serviceVersion, onVersions): void => {
127
112
await client . deleteManifest ( uploadResult . digest ) ;
128
113
} ) ;
129
114
130
- it ( "can upload OCI manifest stream with tag" , async ( ) => {
131
- await uploadManifestPrerequisites ( ) ;
115
+ it . skip ( "can upload OCI manifest stream with tag" , async function ( this : Mocha . Context ) {
116
+ if ( isPlaybackMode ( ) ) {
117
+ // Temporarily skip during playback while dealing with recorder issue
118
+ this . skip ( ) ;
119
+ }
132
120
133
- await mockDockerContentDigestHeader ( ) ;
121
+ await uploadManifestPrerequisites ( ) ;
134
122
135
123
const manifestStream = fs . createReadStream ( "test/data/oci-artifact/manifest.json" ) ;
136
124
const uploadResult = await client . uploadManifest ( manifestStream , { tag : "my_artifact" } ) ;
0 commit comments