Skip to content

Commit

Permalink
update test script
Browse files Browse the repository at this point in the history
  • Loading branch information
jacqueline-57b committed Sep 26, 2024
1 parent a2ac320 commit f1a5021
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions sdk_load_test/load_create_ip_with_existing_collection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ const keyCollectionAddress: { [key: string]: any } = {};

const sourceFilePath = './sdk_load_test/wallets_privateKeys.json';
const destinationFilePath = './sdk_load_test/wallets_privateKey_test.json';
const numberOfEntriesToCopy = 100;
const numberOfExecutions = 20;
const numberOfEntriesToCopy = 10;
const numberOfExecutions = 10;

async function createCollection(privateKey: string) {
const testAccount = privateKeyToAccount(privateKey as Address);
Expand Down Expand Up @@ -46,8 +46,6 @@ async function createIpAssetWithExistingCollection(privateKey: string) {

const testClient = StoryClient.newClient(config);
const nftCollectionAddress = keyCollectionAddress[privateKey];
console.log(`NFT Collection address: ${nftCollectionAddress}`);


const publicshAssetResponse =await testClient.ipAsset.mintAndRegisterIpAssetWithPilTerms({
nftContract: nftCollectionAddress,
Expand Down Expand Up @@ -141,8 +139,8 @@ async function executePromises() {
const totalRequests = durations.length;
const longRequestPercentage = (longRequestCount / totalRequests) * 100;

console.log(`Number of requests taking longer than 6 seconds: ${longRequestCount}`);
console.log(`Percentage of requests taking longer than 6 seconds: ${longRequestPercentage.toFixed(2)}%`);
console.log(`Number of requests taking longer than 8 seconds: ${longRequestCount}`);
console.log(`Percentage of requests taking longer than 8 seconds: ${longRequestPercentage.toFixed(2)}%`);

results.forEach((result, index) => {
console.log(`Result of promise ${index + 1}:`, result);
Expand Down Expand Up @@ -187,11 +185,15 @@ function analyzeDurations(results: any[]) {
// Total number of requests
const totalRequests = results.length;

// Calculate percentage of long durations
const longDurationPercentage = (longDurationCount / totalRequests) * 100;
const shortDurationPercentage = (shortDurationCount / totalRequests) * 100;

console.log(`Total Requests: ${totalRequests}`);
console.log(`Total Duration: ${totalDuration} ms`);
console.log(`Average Duration: ${averageDuration.toFixed(2)} ms`);
console.log(`Count of durations > 8000 ms: ${longDurationCount}`);
console.log(`Count of durations <= 8000 ms: ${shortDurationCount}`);
console.log(`Count of durations > 8000 ms: ${longDurationCount}, ${longDurationPercentage.toFixed(2)}%`);
console.log(`Count of durations <= 8000 ms: ${shortDurationCount}, ${shortDurationPercentage.toFixed(2)}%`);
};

// Main function to execute the merging and analysis
Expand Down

0 comments on commit f1a5021

Please sign in to comment.