Skip to content

Commit

Permalink
Update oJobTest.yaml with debug option
Browse files Browse the repository at this point in the history
  • Loading branch information
nmaguiar committed Mar 31, 2024
1 parent e922f93 commit b114b95
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .package.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ filesHash:
oJobSQL.yaml: c7d0ab718f87470f83c07c85b6c4074a810ea3ef
oJobSSH.yaml: 6dbefb7028a6be855ee4d3cc93e971eeee563d5b
oJobSVN.yaml: 10920575ac4c337fe99448b8a04a0689c2bde77f
oJobTest.yaml: 8cdead5a3d98bf31929697ae88e7488857888324
oJobTest.yaml: 04c59c59121e9f468627d65127d424644b316686
oJobWatchDog.yaml: d1dbeab36784bd6722daa27e572425c84ebbc36b
oJobXLS.yaml: 00def6b195d7487989d7aa2c774b584a0e0b01a0
oJobs.yaml: 83d8406c43b4a5325686467ed80911a9c1e26d49
Expand Down
12 changes: 12 additions & 0 deletions oJobTest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ jobs:
job : job
count : count
asserts: asserts
debug : debug
help:
text : This job will test an args.func (function) or an args.job provided. The test will use the current oJob job name. Optionally you can specify args.count (defaults to 1) to test more than one time.
expects:
Expand All @@ -55,6 +56,8 @@ jobs:
desc: The number of test repeats (defaults to 1).
- name: asserts
desc: Array of asserts maps to test the results (composed of 'path', 'value' and 'msg')
- name: debug
desc: If true will output debug information.
exec: |
if (isUnDef(args.func) && isUnDef(args.job)) throw "Please define args.func or an args.job."
var count = _$(args.count, "count").toNumber().isNumber().default(1)
Expand All @@ -66,6 +69,10 @@ jobs:
args.asserts = _$(args.asserts, "asserts").isArray().default([])
for(var c = 0; c < count; c++) {
var _r = ow.test.test(jname, args.func)
if (args.debug) {
print("DEBUG | test function:")
cprint(_r)
}
args.asserts.forEach(a => {
a.path = _$(a.path, "path").isString().default("@")
a.msg = _$(a.msg, "msg").isString().default("Assert failed " + af.toSLON(a))
Expand All @@ -78,6 +85,11 @@ jobs:
id = "|" + genUUID()
var _r = $job(args.job, __, id)
if (args.debug) {
print("DEBUG | test function:")
cprint(_r)
}
if (!isMap(_r)) throw $from( ow.oJob.getLogCh().get({ ojobId: ow.oJob.getID() + id, name: args.job }).log ).last().error
args.asserts.forEach(a => {
Expand Down

0 comments on commit b114b95

Please sign in to comment.