@@ -12,6 +12,7 @@ const clientKey = "";
1212const generateVUs = vus ;
1313const refreshVUs = vus ;
1414const identityMapVUs = vus ;
15+ const keySharingVUs = vus ;
1516const testDuration = '10m'
1617
1718//30 warm up on each
@@ -47,6 +48,14 @@ export const options = {
4748 { duration: '30s', target: identityMapVUs}
4849 ],
4950 gracefulRampDown: '0s',
51+ },
52+ keySharingWarmup: {
53+ executor: 'ramping-vus',
54+ exec: 'keySharing',
55+ stages: [
56+ { duration: '30s', target: keySharingVUs}
57+ ],
58+ gracefulRampDown: '0s',
5059 },*/
5160 // Actual testing scenarios
5261 tokenGenerate : {
@@ -73,6 +82,14 @@ export const options = {
7382 gracefulStop: '0s',
7483 startTime: '30s',
7584 },
85+ keySharing:{
86+ executor: 'constant-vus',
87+ exec: 'keySharing',
88+ vus: keySharingVUs,
89+ duration: testDuration,
90+ gracefulStop: '0s',
91+ startTime: '30s',
92+ }
7693 identityMapLargeBatchSequential: {
7794 executor: 'constant-vus',
7895 exec: 'identityMapLargeBatch',
@@ -213,6 +230,24 @@ export function identityBuckets(data) {
213230 execute ( bucketData , true ) ;
214231}
215232
233+ export async function keySharing ( data ) {
234+ const endpoint = '/v2/key/sharing' ;
235+ if ( data . keySharing == null ) {
236+ var newData = await generateKeySharingRequestWithTime ( ) ;
237+ data . keySharing = newData ;
238+ } else if ( data . keySharing . time < ( Date . now ( ) - 45000 ) ) {
239+ data . keySharing = await generateKeySharingRequestWithTime ( ) ;
240+ }
241+
242+ var requestBody = data . keySharing . requestBody ;
243+ var keySharingData = {
244+ endpoint : endpoint ,
245+ requestBody : requestBody ,
246+ }
247+
248+ execute ( keySharingData , true ) ;
249+ }
250+
216251// Helpers
217252async function createReqWithTimestamp ( timestampArr , obj ) {
218253 var envelope = getEnvelopeWithTimestamp ( timestampArr , obj ) ;
@@ -401,6 +436,11 @@ async function generateIdentityMapRequestWithTime(emailCount) {
401436 return await generateRequestWithTime ( emails ) ;
402437}
403438
439+ async function generateKeySharingRequestWithTime ( ) {
440+ let requestData = { } ;
441+ return await generateRequestWithTime ( requestData ) ;
442+ }
443+
404444const generateSinceTimestampStr = ( ) => {
405445 var date = new Date ( Date . now ( ) - 2 * 24 * 60 * 60 * 1000 /* 2 days ago */ ) ;
406446 var year = date . getFullYear ( ) ;
0 commit comments