Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions src/lib/test-outbound/TestCaseRunner.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,17 @@ const SKIP_EMPTY_EXECUTION_ORDER = false // skip testCases without executionOrde
class TestCaseRunner {
constructor (config, logger) {
this.config = config
this.logger = logger || loggerFactory('TestCaseRunner')
this.logger = logger || loggerFactory({ context: 'TTK', system: 'TestCaseRunner' })
}

static lib = inputTemplate => inputTemplate.test_cases.reduce((acc, testCase) =>
testCase.options?.lib ? testCase.requests.reduce((acc, request) => ({ ...acc, [`${testCase.id}.${request.id}`]: request }), acc) : acc
, {})

async runAll ({
processTestCase, inputTemplate, traceID, variableData, dfspId, globalConfig, metrics
}) {
const lib = TestCaseRunner.lib(inputTemplate)
const runOneTestCase = (testCase, index) => () => {
globalConfig.totalProgress.testCasesProcessed++
return processTestCase(
Expand All @@ -59,7 +64,8 @@ class TestCaseRunner {
metrics,
inputTemplate.name,
inputTemplate.saveReport,
index
index,
lib
)
}

Expand Down
13 changes: 11 additions & 2 deletions src/lib/test-outbound/outbound-initiator.js
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@ const OutboundSendLoop = async (inputTemplate, traceID, dfspId, iterations, metr
const startedTimeStamp = new Date()
// Deep copy the template
const tmpTemplate = JSON.parse(JSON.stringify(inputTemplate))
const lib = TestCaseRunner.lib(tmpTemplate)
// Execute all the test cases in the template
for (const i in tmpTemplate.test_cases) {
await processTestCase(
Expand All @@ -194,7 +195,8 @@ const OutboundSendLoop = async (inputTemplate, traceID, dfspId, iterations, metr
metrics,
tmpTemplate.name,
tmpTemplate.saveReport,
i
i,
lib
)
}
const completedTimeStamp = new Date()
Expand Down Expand Up @@ -254,7 +256,8 @@ const processTestCase = async (
metrics,
templateName,
saveReport,
testCaseIndex
testCaseIndex,
lib
) => {
const tracing = getTracing(traceID)
const testCaseStartedTime = new Date()
Expand All @@ -264,6 +267,12 @@ const processTestCase = async (
// Store the request ids into a new array
const templateIDArr = []
for (const i in testCase.requests) {
if (testCase.requests[i].call) {
testCase.requests[i] = _.merge(
structuredClone(requestsObj[testCase.requests[i].call] ?? lib[testCase.requests[i].call]),
testCase.requests[i]
)
}
requestsObj[testCase.requests[i].id] = testCase.requests[i]
templateIDArr.push(testCase.requests[i].id)
}
Expand Down