Skip to content

Commit

Permalink
Revert "Check the variable set by the tester script for recording tes…
Browse files Browse the repository at this point in the history
…tcases"

This reverts commit a32fd21.

Signed-off-by: Mike Ponomarenko <[email protected]>
  • Loading branch information
mponomar committed Aug 16, 2024
1 parent 49b9009 commit 97f1b43
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions tests/testutils
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash

function testdb_start_run {
[[ -z "$TESTCASEDB" || -z "$TESTCASETIER" || -z "$TESTCASEUUID" ]] && return 0
[[ -z "$TESTCASEDB" || -z "$TESTCASETIER" || -z "$TESTUUID" ]] && return 0
repo=$(git remote get-url origin | sed "s/'/''/")
if [[ -z "$repo" ]]; then
exit 0
Expand All @@ -16,31 +16,31 @@ function testdb_start_run {
fi
version=${TESTVERSION:-NULL}
[[ ${version} != "NULL" ]] && version=$(echo $version | sed "s/'/''/")
/opt/bb/bin/cdb2sql $TESTCASEDB $TESTCASETIER "insert into runs(start, end, testid, repo, branch, sha, version) values(now(), NULL, '$TESTCASEUUID', '$repo', '$branch', '$commit', '$version')" >/dev/null
/opt/bb/bin/cdb2sql $TESTCASEDB $TESTCASETIER "insert into runs(start, end, testid, repo, branch, sha, version) values(now(), NULL, '$TESTUUID', '$repo', '$branch', '$commit', '$version')" >/dev/null
}

function testdb_start_testcase {
[[ -z "$TESTCASEDB" || -z "$TESTCASETIER" || -z "$TESTCASEUUID" || -z "$TESTCASE" ]] && return 0
/opt/bb/bin/cdb2sql $TESTCASEDB $TESTCASETIER "insert into testcases(start, end, testcase, testid, result) values(now(), NULL, '$TESTCASE', '$TESTCASEUUID', NULL)" >/dev/null
[[ -z "$TESTCASEDB" || -z "$TESTCASETIER" || -z "$TESTUUID" || -z "$TESTCASE" ]] && return 0
/opt/bb/bin/cdb2sql $TESTCASEDB $TESTCASETIER "insert into testcases(start, end, testcase, testid, result) values(now(), NULL, '$TESTCASE', '$TESTUUID', NULL)" >/dev/null
}

function testdb_end_testcase {
[[ -z "$TESTCASEDB" || -z "$TESTCASETIER" || -z "$TESTCASEUUID" || -z "$TESTCASE" ]] && return 0
[[ -z "$TESTCASEDB" || -z "$TESTCASETIER" || -z "$TESTUUID" || -z "$TESTCASE" ]] && return 0
local status=$1
shift
[[ -z "$status" ]] && return 0
/opt/bb/bin/cdb2sql $TESTCASEDB $TESTCASETIER "update testcases set end=now(), result=$status where testid='$TESTCASEUUID' and testcase='$TESTCASE'" >/dev/null
/opt/bb/bin/cdb2sql $TESTCASEDB $TESTCASETIER "update testcases set end=now(), result=$status where testid='$TESTUUID' and testcase='$TESTCASE'" >/dev/null
}

function testdb_note {
[[ -z "$TESTCASEDB" || -z "$TESTCASETIER" || -z "$TESTCASEUUID" || -z "$TESTCASE" ]] && return 0
[[ -z "$TESTCASEDB" || -z "$TESTCASETIER" || -z "$TESTUUID" || -z "$TESTCASE" ]] && return 0
local note=$1
[[ -z "$note" ]] && return 0
note=$(echo "$note" | sed "s/'/''/")
/opt/bb/bin/cdb2sql $TESTCASEDB $TESTCASETIER "insert into notes(testid, testcase, timestamp, id, note) values('$TESTCASEUUID', '$TESTCASE', now(), coalesce((select max(id) from notes where testid='$TESTCASEUUID' and testcase='$TESTCASE'), 0)+1, '$note')" >/dev/null
/opt/bb/bin/cdb2sql $TESTCASEDB $TESTCASETIER "insert into notes(testid, testcase, timestamp, id, note) values('$TESTUUID', '$TESTCASE', now(), coalesce((select max(id) from notes where testid='$TESTUUID' and testcase='$TESTCASE'), 0)+1, '$note')" >/dev/null
}

function testdb_end_run {
[[ -z "$TESTCASEDB" || -z "$TESTCASETIER" || -z "$TESTCASEUUID" || -z "$TESTCASE" ]] && return 0
/opt/bb/bin/cdb2sql $TESTCASEDB $TESTCASETIER "update runs set end=now() where testid='$TESTCASEUUID'" >/dev/null
[[ -z "$TESTCASEDB" || -z "$TESTCASETIER" || -z "$TESTUUID" || -z "$TESTCASE" ]] && return 0
/opt/bb/bin/cdb2sql $TESTCASEDB $TESTCASETIER "update runs set end=now() where testid='$TESTUUID'" >/dev/null
}

0 comments on commit 97f1b43

Please sign in to comment.