Skip to content

Commit

Permalink
chore: create interfaces for conformance test API results (#1728)
Browse files Browse the repository at this point in the history
  • Loading branch information
ddelgrosso1 committed Dec 1, 2021
1 parent 09af838 commit 1457404
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions conformance-test/retryStrategy.ts
Expand Up @@ -47,6 +47,14 @@ interface RetryTestCase {
expectSuccess: boolean;
}

interface ConformanceTestCreationResult {
id: string;
}

interface ConformanceTestResult {
completed: boolean;
}

type LibraryMethodsModuleType = typeof import('./libraryMethods');

const retryTestCases: RetryTestCase[] = testFile.retryStrategyTests;
Expand Down Expand Up @@ -248,22 +256,24 @@ function generateName(storageMethodString: String, bucketOrFile: string) {
async function createTestBenchRetryTest(
instructions: String[],
methodName: string
) {
): Promise<ConformanceTestCreationResult> {
const requestBody = {instructions: {[methodName]: instructions}};
const response = await fetch(`${TESTBENCH_HOST}retry_test`, {
method: 'POST',
body: JSON.stringify(requestBody),
headers: {'Content-Type': 'application/json'},
});
return response.json();
return response.json() as Promise<ConformanceTestCreationResult>;
}

async function getTestBenchRetryTest(testId: string) {
async function getTestBenchRetryTest(
testId: string
): Promise<ConformanceTestResult> {
const response = await fetch(`${TESTBENCH_HOST}retry_test/${testId}`, {
method: 'GET',
});

return response.json();
return response.json() as Promise<ConformanceTestResult>;
}

function shortUUID() {
Expand Down

0 comments on commit 1457404

Please sign in to comment.