1
1
import * as path from 'path' ;
2
2
3
3
import { loadSpecTests } from '../../spec' ;
4
+ import { ClientSideEncryptionFilter } from '../../tools/runner/filters/client_encryption_filter' ;
4
5
import { installNodeDNSWorkaroundHooks } from '../../tools/runner/hooks/configuration' ;
5
6
import {
6
7
gatherTestSuites ,
@@ -60,6 +61,8 @@ const SKIPPED_TESTS = new Set([
60
61
61
62
const isServerless = ! ! process . env . SERVERLESS ;
62
63
64
+ const filter = new ClientSideEncryptionFilter ( ) ;
65
+
63
66
describe ( 'Client Side Encryption (Legacy)' , function ( ) {
64
67
const testContext = new TestRunnerContext ( { requiresCSFLE : true } ) ;
65
68
const testSuites = gatherTestSuites (
@@ -75,6 +78,10 @@ describe('Client Side Encryption (Legacy)', function () {
75
78
return testContext . setup ( this . configuration ) ;
76
79
} ) ;
77
80
81
+ before ( async function ( ) {
82
+ await filter . initializeFilter ( { } as any , { } ) ;
83
+ } ) ;
84
+
78
85
generateTopologyTests ( testSuites , testContext , ( { description } ) => {
79
86
if ( SKIPPED_TESTS . has ( description ) ) {
80
87
return false ;
@@ -89,13 +96,51 @@ describe('Client Side Encryption (Legacy)', function () {
89
96
return ! isSkippedTest ;
90
97
}
91
98
99
+ if (
100
+ description === 'Insert a document with auto encryption using KMIP delegated KMS provider'
101
+ ) {
102
+ if (
103
+ typeof filter . filter ( {
104
+ metadata : { requires : { clientSideEncryption : '>=6.0.1' } }
105
+ } ) === 'string'
106
+ ) {
107
+ return false ;
108
+ }
109
+ }
110
+
92
111
return true ;
93
112
} ) ;
94
113
} ) ;
95
114
96
115
describe ( 'Client Side Encryption (Unified)' , function ( ) {
97
116
installNodeDNSWorkaroundHooks ( ) ;
98
- runUnifiedSuite ( loadSpecTests ( path . join ( 'client-side-encryption' , 'tests' , 'unified' ) ) , ( ) =>
99
- isServerless ? 'Unified CSFLE tests to not run on serverless' : false
117
+
118
+ before ( async function ( ) {
119
+ await filter . initializeFilter ( { } as any , { } ) ;
120
+ } ) ;
121
+
122
+ runUnifiedSuite (
123
+ loadSpecTests ( path . join ( 'client-side-encryption' , 'tests' , 'unified' ) ) ,
124
+ ( { description } ) => {
125
+ const delegatedKMIPTests = [
126
+ 'rewrap with current KMS provider' ,
127
+ 'rewrap with new local KMS provider' ,
128
+ 'rewrap with new KMIP delegated KMS provider' ,
129
+ 'rewrap with new KMIP KMS provider' ,
130
+ 'rewrap with new GCP KMS provider' ,
131
+ 'rewrap with new Azure KMS provider' ,
132
+ 'rewrap with new AWS KMS provider' ,
133
+ 'create datakey with KMIP delegated KMS provider' ,
134
+ 'Insert a document with auto encryption using KMIP delegated KMS provider'
135
+ ] ;
136
+ if ( delegatedKMIPTests . includes ( description ) ) {
137
+ const shouldSkip = filter . filter ( {
138
+ metadata : { requires : { clientSideEncryption : '>=6.0.1' } }
139
+ } ) ;
140
+ if ( typeof shouldSkip === 'string' ) return shouldSkip ;
141
+ }
142
+
143
+ return isServerless ? 'Unified CSFLE tests to not run on serverless' : false ;
144
+ }
100
145
) ;
101
146
} ) ;
0 commit comments