Skip to content

Commit

Permalink
ODIS E2E test fix (#10574)
Browse files Browse the repository at this point in the history
* prevent usedQuota from being increased
when bypassing quota

* make result warning optional

* add warning to E2E test
  • Loading branch information
soloseng authored Sep 22, 2023
1 parent 5e21031 commit 5bf6fd6
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
16 changes: 11 additions & 5 deletions packages/phone-number-privacy/combiner/test/end-to-end/pnp.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ describe(`Running against service deployed at ${combinerUrl} w/ blockchain provi
performedQueryCount: res.performedQueryCount,
totalQuota: res.totalQuota,
remainingQuota: res.totalQuota - res.performedQueryCount,
warnings: [],
warnings: res.warnings ?? [],
})
})

Expand All @@ -86,7 +86,7 @@ describe(`Running against service deployed at ${combinerUrl} w/ blockchain provi
performedQueryCount: res.performedQueryCount,
totalQuota: res.totalQuota,
remainingQuota: res.totalQuota - res.performedQueryCount,
warnings: [],
warnings: res.warnings ?? [],
})
})

Expand All @@ -101,7 +101,7 @@ describe(`Running against service deployed at ${combinerUrl} w/ blockchain provi
performedQueryCount: res1.performedQueryCount,
totalQuota: res1.totalQuota,
remainingQuota: res1.totalQuota - res1.performedQueryCount,
warnings: [],
warnings: res1.warnings ?? [],
}
expect(res1).toStrictEqual<PnpClientQuotaStatus>(expectedRes)
const res2 = await OdisUtils.Quota.getPnpQuotaStatus(
Expand Down Expand Up @@ -210,7 +210,10 @@ describe(`Running against service deployed at ${combinerUrl} w/ blockchain provi
performedQueryCount: startingPerformedQueryCount + 1,
totalQuota: startingTotalQuota,
remainingQuota: startingTotalQuota - (startingPerformedQueryCount + 1),
warnings: [],
warnings: [
'CELO_ODIS_WARN_17 SIGNER Discrepancies detected in signer responses',
'CELO_ODIS_WARN_18 SIGNER Discrepancy found in signers performed query count measurements',
],
})
})

Expand All @@ -233,7 +236,10 @@ describe(`Running against service deployed at ${combinerUrl} w/ blockchain provi
performedQueryCount: startingPerformedQueryCount + 1,
totalQuota: startingTotalQuota,
remainingQuota: startingTotalQuota - (startingPerformedQueryCount + 1),
warnings: [],
warnings: [
'CELO_ODIS_WARN_17 SIGNER Discrepancies detected in signer responses',
'CELO_ODIS_WARN_18 SIGNER Discrepancy found in signers performed query count measurements',
],
})
})
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,9 @@ export function pnpSign(
signature,
ctx
)
usedQuota++
if (!bypassQuotaForE2ETesting(config.test_quota_bypass_percentage, request.body)) {
usedQuota++
}
} else {
Counters.duplicateRequests.inc()
logger.info('Request already exists in db. Will service request without charging quota.')
Expand Down

0 comments on commit 5bf6fd6

Please sign in to comment.