-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tickHF:initial implementation of issue #44
(not yet tested)
- Loading branch information
1 parent
5089248
commit d4c7e33
Showing
10 changed files
with
322 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
### Executing tests | ||
|
||
Executing tests (assuming ec is deployed in the bin direcotory): | ||
|
||
- prepare env on linux: | ||
```bash | ||
KdbSystemDir> source bin/ec/components/tickHF/test/etc/env.sh | ||
``` | ||
- prepare env on windows: | ||
```bash | ||
KdbSystemDir> bin\ec\components\tickHF\test\etc\env.bat | ||
``` | ||
|
||
- execute tests: | ||
```bash | ||
> # start tests | ||
> yak start t.run | ||
> # check progress | ||
> yak log t.run | ||
> # check errors and test failures | ||
> yak err t.run | ||
``` | ||
|
||
- inspect results once the tests are completed: | ||
```q | ||
q)//on the t.run | ||
q).test.report[] | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
[technicalUser:tu] | ||
pass = 0x5f5e005b4a5858 | ||
usergroups = admin | ||
#---------------------------- user groups ------------------------------------# | ||
[userGroup:admin] | ||
[[ALL]] | ||
namespaces = ALL | ||
checkLevel = NONE | ||
#-----------------------------------------------------------------------------# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
[template:marketData] | ||
[[t0.tickHF]] | ||
[[t1.tickHF]] | ||
[[t0.rdb]] | ||
subSrc = t0.tick | ||
eodClear = FALSE | ||
eodPerform = FALSE | ||
[[t1.rdb]] | ||
subSrc = t1.tick | ||
eodClear = FALSE | ||
eodPerform = FALSE | ||
|
||
#---------------------------- market data tables -----------------------------# | ||
[table:quote] | ||
template = marketData | ||
model = time(TIME), sym(SYMBOL), bid(FLOAT), bidSize(LONG), ask(FLOAT), askSize(LONG), flag(STRING) | ||
|
||
#---------------------------- system tables ----------------------------------# | ||
[sysTable:dummy] | ||
modelSrc = NULL | ||
#-----------------------------------------------------------------------------# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
@ECHO OFF | ||
IF NOT EXIST BIN GOTO NOBIN | ||
|
||
SET EC_SYS_PATH=%CD% | ||
|
||
REM ---- q enviroment ---- | ||
IF EXIST %EC_SYS_PATH%\bin\q\w32\q.exe SET QHOME=%EC_SYS_PATH%\bin\q | ||
IF EXIST %EC_SYS_PATH%\bin\q\w64\q.exe SET QHOME=%EC_SYS_PATH%\bin\q | ||
SET PATH=%QHOME%\w64;%QHOME%\w32;%PATH% | ||
WHERE /q q.exe || GOTO NOQ | ||
REM in case of q64bit - it is recommended to SET QLIC as following: QLIC=%EC_SYS_PATH%\etc | ||
|
||
REM ---- ec enviroment ---- | ||
SET EC_QSL_PATH=%EC_SYS_PATH%/bin/ec/libraries/qsl/ | ||
SET EC_ETC_PATH=%EC_SYS_PATH%/bin/ec/components/tickHF/test/etc/ | ||
|
||
SET EC_SYS_ID="tickHFTest" | ||
SET EC_SYS_TYPE="FUNC_TEST" | ||
|
||
REM ---- yak enviroment ---- | ||
SET YAK_PATH=%EC_SYS_PATH%\bin\yak | ||
SET YAK_OPTS=-c %EC_ETC_PATH%/system.cfg -s %EC_SYS_PATH%/data/test/%EC_SYS_ID%/yak/yak.status -l %EC_SYS_PATH%/log/test/%EC_SYS_ID%/yak/yak.log | ||
SET PATH=%YAK_PATH%;%PATH% | ||
|
||
ECHO env for system %EC_SYS_ID%/%EC_SYS_TYPE% loaded | ||
|
||
|
||
GOTO END | ||
:NOBIN | ||
ECHO Expected to find %EC_SYS_PATH%\bin directory. Expecting to run env.bat from the top level ec system directory. | ||
GOTO END | ||
:NOQ | ||
ECHO Missing q binary. Please install q in %EC_SYS_PATH%\bin\q\ directory, see ec\tutorial\Installation.md for instructions. | ||
:END |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
if [ ! -d "bin" ]; then | ||
echo "Expecting bin subdirectory" && return | ||
fi | ||
export EC_SYS_PATH=${PWD} | ||
|
||
# ---- cmd prompt decoration ---- # | ||
EC_SYS_ID="tickHFTest" | ||
EC_SYS_TYPE="FUNC_TEST" | ||
export EC_SYS_ID EC_SYS_TYPE | ||
PS1='[${EC_SYS_ID}(${EC_SYS_TYPE})][\u@\h:\w]\$ ' | ||
export PS1 | ||
|
||
# ---- ec environment ---- # | ||
EC_QSL_PATH=${EC_SYS_PATH}/bin/ec/libraries/qsl/ | ||
EC_ETC_PATH=${EC_SYS_PATH}/bin/ec/components/tickHF/test/etc/ | ||
export EC_QSL_PATH EC_ETC_PATH | ||
|
||
# ---- yak environment ---- # | ||
YAK_PATH=$EC_SYS_PATH/bin/yak/ | ||
YAK_OPTS="-c $EC_ETC_PATH/system.cfg -v less -s $EC_SYS_PATH/data/test/${EC_SYS_ID}/yak/yak.status -l $EC_SYS_PATH/log/test/${EC_SYS_ID}/yak/yak.log" | ||
export YAK_OPTS | ||
. $YAK_PATH/yak_complete_bash.sh | ||
NEWPATH=$YAK_PATH | ||
|
||
# ---- q environment ---- # | ||
# search for q binary in bin/q/ (cover MacOS and Linux) | ||
if [ "$(uname)" == "Darwin" ]; then OS_LETTER=m; else OS_LETTER=l; fi | ||
if [ -f "$EC_SYS_PATH/bin/q/${OS_LETTER}32/q" ]; then QHOME=$EC_SYS_PATH/bin/q/ && NEWPATH=$QHOME/${OS_LETTER}32/:$NEWPATH; fi | ||
if [ -f "$EC_SYS_PATH/bin/q/${OS_LETTER}64/q" ]; then QHOME=$EC_SYS_PATH/bin/q/ && NEWPATH=$QHOME/${OS_LETTER}64/:$NEWPATH; fi | ||
# QLIC set to etc/, in case of q64, k4.lic should be placed in $QLIC directory | ||
QLIC=$EC_SYS_PATH/etc/ | ||
export QHOME QLIC | ||
|
||
# ---- path ---- # | ||
export OLDPATH=${OLDPATH:-$PATH} | ||
PATH=$NEWPATH:$OLDPATH | ||
export PATH | ||
#check if q is available on PATH | ||
which q >/dev/null || echo "Missing q binary. Please install q in $EC_SYS_PATH/bin/q/ directory, see ec/tutorial/Installation.md for instructions." | ||
|
||
echo env for system ${EC_SYS_ID}/${EC_SYS_TYPE} loaded |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
export = libPath, dllPath, logDest, logPath, logRotate, logLevel, eventPath | ||
#---------------------------------- paths ------------------------------------# | ||
etcPath = ${EC_SYS_PATH}/bin/ec/components/hdbWriter/test/etc/ | ||
binPath = ${EC_SYS_PATH}/bin/ec/components/${EC_COMPONENT_PKG} | ||
libPath = ${EC_SYS_PATH}/bin/ec/components/${EC_COMPONENT_PKG}, ${EC_SYS_PATH}/bin/ec/libraries/ | ||
dllPath = ${EC_SYS_PATH}/bin/ec/components/${EC_COMPONENT_PKG}, ${EC_SYS_PATH}/bin/ec/libraries/ | ||
dataPath = ${EC_SYS_PATH}/data/test/tickHFTest/${EC_COMPONENT_ID} | ||
logPath = ${EC_SYS_PATH}/log/test/tickHFTest/${EC_COMPONENT_ID} | ||
eventPath = ${EC_SYS_PATH}/data/test/tickHFTest/shared/events/ | ||
#---------------------------------- process ----------------------------------# | ||
basePort = 18000 | ||
startWait = 1 | ||
stopWait = 1 | ||
cpuAffinity = 0 | ||
#---------------------------------- logging ----------------------------------# | ||
logLevel = INFO | ||
logDest = FILE,STDERR | ||
logRotate = 01:00:00 | ||
#---------------------------------- housekeeping -----------------------------# | ||
housekeeping = () | ||
#---------------------------------- components -------------------------------# | ||
[group:t] | ||
[[t.run]] | ||
command = "q qtestRunner.q" | ||
type = q:qtest/qtestRunner | ||
port = ${basePort} | ||
memCap = 10000 | ||
testFiles = ${EC_SYS_PATH}/bin/ec/components/tickHF/test/tickHF_functionalTests.q | ||
testNamespaces = .testTickHF | ||
|
||
[[t0.tickHF]] | ||
command = "q tickHF.q" | ||
type = q:tickHF/tickHF | ||
port = ${basePort} + 1 | ||
memCap = 10000 | ||
|
||
[[t1.tickHF]] | ||
command = "q tickHF.q" | ||
type = q:tickHF/tickHF | ||
port = ${basePort} + 2 | ||
memCap = 10000 | ||
|
||
|
||
[[t0.rdb]] | ||
command = "q rdb.q" | ||
type = q:rdb/rdb | ||
port = ${basePort} + 11 | ||
memCap = 10000 | ||
|
||
[[t1.rdb]] | ||
command = "q rdb.q" | ||
type = q:rdb/rdb | ||
port = ${basePort} + 12 | ||
memCap = 10000 | ||
#-----------------------------------------------------------------------------# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
/L/ Copyright (c) 2011-2014 Exxeleron GmbH | ||
/L/ | ||
/L/ Licensed under the Apache License, Version 2.0 (the "License"); | ||
/L/ you may not use this file except in compliance with the License. | ||
/L/ You may obtain a copy of the License at | ||
/L/ | ||
/L/ http://www.apache.org/licenses/LICENSE-2.0 | ||
/L/ | ||
/L/ Unless required by applicable law or agreed to in writing, software | ||
/L/ distributed under the License is distributed on an "AS IS" BASIS, | ||
/L/ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
/L/ See the License for the specific language governing permissions and | ||
/L/ limitations under the License. | ||
|
||
/A/ DEVnet: Joanna Wdowiak | ||
/V/ 3.0 | ||
|
||
// Functional tests of the tickHF component | ||
// See README.md for details | ||
|
||
.testTickHF.testSuite:"tickHF functional tests"; | ||
|
||
.testTickHF.setUp:{ | ||
}; | ||
|
||
.testTickHF.tearDown:{ | ||
.test.stop `t0.tickHF`t1.tickHF`t0.rdb`t1.rdb; | ||
.test.clearProcDir `t0.tickHF`t1.tickHF`t0.rdb`t1.rdb; | ||
}; | ||
|
||
//----------------------------------------------------------------------------// | ||
.testTickHF.genQuote:{[cnt] | ||
([]time:`time$til cnt; sym:cnt#`aaa`bbb;bid:`float$til cnt; bidSize:til cnt;ask:`float$til cnt; askSize:til cnt; flag:cnt?("flagA";"flagB")) | ||
}; | ||
|
||
//----------------------------------------------------------------------------// | ||
// test tickHF // | ||
//----------------------------------------------------------------------------// | ||
.testTickHF.test.tickHF_start_with_ok_journal:{[] | ||
// insert data to journal | ||
data:.testTickHF.genQuote 5; | ||
jrn:.Q.dd[.cr.getCfgField[`t0.tickHF;`group;`dataPath];`$"t0.tickHF",string[.z.d]]; | ||
.[jrn;();:;()]; | ||
h:hopen jrn; | ||
h enlist (`jUpd;`quote;value flip data); | ||
// run tick | ||
.test.start[`t0.tickHF]; | ||
// sub from rdb | ||
.test.start[`t0.rdb]; | ||
.assert.match["rdb contains loaded quote table";rdb"select from quote"; `date`time xasc tradeChunk,tradeChunk]; | ||
}; | ||
|
||
.testTickHF.test.tickHF_start_with_bad_journal_abort:{[] | ||
|
||
}; | ||
|
||
.testTickHF.test.tickHF_start_with_bad_journal_archive:{[] | ||
|
||
}; | ||
|
||
.testTickHF.test.tickHF_start_with_bad_journal_truncate:{[] | ||
|
||
}; | ||
|
||
.testTickHF.test.tickHF_late_ticks_start_with_ok_journal:{[] | ||
|
||
}; | ||
|
||
.testTickHF.test.tickHF_late_ticks_start_with_bad_journal_abort:{[] | ||
|
||
}; | ||
|
||
.testTickHF.test.tickHF_late_ticks_start_with_bad_journal_archive:{[] | ||
|
||
}; | ||
|
||
.testTickHF.test.tickHF_late_ticks_start_with_bad_journal_truncate:{[] | ||
|
||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters