Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
argotest
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Valentin Reis
argotest
Commits
fd233bbb
Commit
fd233bbb
authored
Jan 09, 2019
by
Valentin Reis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Updating the tests to allow CSV logging (+ reformatting)
parent
50ffa445
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
50 additions
and
27 deletions
+50
-27
argo/src/Argo/Args.hs
argo/src/Argo/Args.hs
+2
-2
argo/src/Argo/Stack.hs
argo/src/Argo/Stack.hs
+0
-2
argotk/argotk.hs
argotk/argotk.hs
+48
-23
No files found.
argo/src/Argo/Args.hs
View file @
fd233bbb
...
...
@@ -52,8 +52,8 @@ behaviorOption = option behavior
instance
Default
StackArgs
where
def
=
StackArgs
{
app
=
AppName
"
echo
"
,
args
=
AppArgs
[
"foobar"
]
{
app
=
AppName
"
ls
"
,
args
=
AppArgs
[]
,
containerName
=
ContainerName
"testContainer"
,
workingDirectory
=
WorkingDirectory
"_output"
,
manifestDir
=
ManifestDir
"manifests"
...
...
argo/src/Argo/Stack.hs
View file @
fd233bbb
...
...
@@ -176,7 +176,6 @@ cmdListenPowerI (ContainerName cn) pb =
data
StackOutput
=
FoundMessage
|
MessageNotFound
|
Died
StackI
ExitCode
data
StackI
=
Daemon
|
Run
|
Listen
|
Progress
|
Power
deriving
(
Show
)
...
...
@@ -211,7 +210,6 @@ runStack a@StackArgs {..} = do
out
<-
liftIO
$
waitAnyCancel
asyncs
return
$
case
snd
out
of
(
_
,
Left
PatternMatched
)
->
FoundMessage
(
Run
,
Right
(
ExitSuccess
,
_
,
_
))
->
MessageNotFound
(
stacki
,
Right
(
e
,
_
,
_
)
)
->
Died
stacki
e
where
tupleToAsync
...
...
argotk/argotk.hs
View file @
fd233bbb
...
...
@@ -17,15 +17,10 @@ opts :: StackArgs -> Parser (Shell ())
opts
sa
=
hsubparser
(
command
"clean"
(
info
(
pure
$
clean
sa
)
(
progDesc
"Clean sockets, logfiles."
))
<>
commandTest
DaemonOnly
<>
commandTest
DaemonAndApp
<>
commandTest
TestHello
<>
commandTest
TestListen
<>
commandTest
TestPerfwrapper
<>
commandTest
TestPower
<>
(
mconcat
$
fmap
commandTest
[(
minBound
::
TestType
)
..
])
<>
commandTests
[
TestHello
,
TestListen
,
TestPerfwrapper
]
"tests"
"Run
all
tests"
"Run
hardware-independent CI
tests"
<>
help
"Type of test to run. There are extensive options under each action,
\
\
but be careful, these do not all have the same defaults. The default
\
...
...
@@ -40,10 +35,18 @@ opts sa = hsubparser
commandTests
ttypes
cmdStr
descStr
=
command
cmdStr
$
info
(
pure
$
mapM_
(
doTest
sa
)
ttypes
)
(
progDesc
descStr
)
data
TestType
=
DaemonOnly
|
DaemonAndApp
|
TestHello
|
TestListen
|
TestPerfwrapper
|
TestPower
deriving
Show
data
TestType
=
DaemonOnly
|
DaemonAndApp
|
CsvLogs
|
TestHello
|
TestListen
|
TestPerfwrapper
|
TestPower
deriving
(
Enum
,
Bounded
,
Show
)
data
TestSpec
=
TestSpec
{
stackArgsUpdate
::
StackArgs
->
StackArgs
,
isTest
::
IsTest
,
description
::
String
}
doTest
::
StackArgs
->
TestType
->
Shell
()
...
...
@@ -57,7 +60,7 @@ doOverridenTest ttype = doSpec spec where spec = configureTest ttype
doSpec
::
TestSpec
->
StackArgs
->
Shell
()
doSpec
spec
stackArgs
=
do
printTest
$
T
.
pack
$
description
spec
fullStack
stackArgs
fullStack
(
isTest
spec
)
stackArgs
printSuccess
"Test Successful."
configureTest
::
TestType
->
TestSpec
...
...
@@ -65,11 +68,24 @@ configureTest = \case
DaemonOnly
->
TestSpec
{
stackArgsUpdate
=
\
sa
->
sa
{
daemon
=
daemonBehavior
}
,
description
=
"Set up and launch the daemon in synchronous mode."
,
isTest
=
IsTest
False
}
DaemonAndApp
->
TestSpec
{
stackArgsUpdate
=
\
sa
->
sa
{
daemon
=
daemonBehavior
,
cmdrun
=
runBehavior
,
cmdlistenprogress
=
JustRun
(
StdOutLog
"progress.csv"
)
(
StdErrLog
"progress.log"
)
,
cmdlistenpower
=
JustRun
(
StdOutLog
"power.csv"
)
(
StdErrLog
"power.log"
)
}
,
description
=
"Set up and start daemon, run a command in a container."
,
isTest
=
IsTest
False
}
CsvLogs
->
TestSpec
{
stackArgsUpdate
=
\
sa
->
sa
{
daemon
=
daemonBehavior
,
cmdrun
=
runBehavior
}
,
description
=
"Set up and start daemon, run a command in a container."
,
isTest
=
IsTest
False
}
TestHello
->
TestSpec
{
stackArgsUpdate
=
\
sa
->
sa
...
...
@@ -82,6 +98,7 @@ configureTest = \case
}
,
description
=
"1: Setup stack and check that a hello world app sends
\
\
message back to cmd."
,
isTest
=
IsTest
True
}
TestListen
->
TestSpec
{
stackArgsUpdate
=
\
sa
->
sa
...
...
@@ -93,6 +110,7 @@ configureTest = \case
}
,
description
=
"2: Setup stack and check that argo-perf-wrapper sends
\
\
at least one message to the daemon."
,
isTest
=
IsTest
True
}
TestPerfwrapper
->
TestSpec
{
stackArgsUpdate
=
\
sa
->
sa
...
...
@@ -106,6 +124,7 @@ configureTest = \case
,
description
=
"3: Setup stack and check that argo-perf-wrapper sends
\
\
at least one *performance* message to cmd listen through the
\
\
daemon."
,
isTest
=
IsTest
True
}
TestPower
->
TestSpec
{
stackArgsUpdate
=
\
sa
->
sa
...
...
@@ -118,28 +137,34 @@ configureTest = \case
,
description
=
"4: Setup stack and check that argo-perf-wrapper sends
\
\
at least one *power* message to cmd listen through the
\
\
daemon."
,
isTest
=
IsTest
True
}
where
msg
=
"someComplicatedMessage"
daemonBehavior
=
JustRun
(
StdOutLog
"daemon_out.log"
)
(
StdErrLog
"daemon_err.log"
)
runBehavior
=
JustRun
(
StdOutLog
"cmd_run_out.log"
)
(
StdErrLog
"cmd_run_err.log"
)
daemonBehavior
=
JustRun
(
StdOutLog
"daemon_out.log"
)
(
StdErrLog
"daemon_err.log"
)
runBehavior
=
JustRun
(
StdOutLog
"cmd_run_out.log"
)
(
StdErrLog
"cmd_run_err.log"
)
listentestBehavior
t
=
SucceedTestOnMessage
t
(
StdOutLog
"cmd_listen_out.log"
)
(
StdErrLog
"cmd_listen_err.log"
)
fullStack
::
StackArgs
->
Shell
()
fullStack
a
@
StackArgs
{
..
}
=
runStack
a
>>=
\
case
newtype
IsTest
=
IsTest
Bool
fullStack
::
IsTest
->
StackArgs
->
Shell
()
fullStack
(
IsTest
b
)
a
@
StackArgs
{
..
}
=
runStack
a
>>=
\
case
FoundMessage
->
printSuccess
"Found message!
\n
"
MessageNotFound
->
printError
"Message not found.
\n
"
>>
exit
(
ExitFailure
1
)
Died
stacki
ExitSuccess
->
printError
(
repr
stacki
<>
" died before a message could be found.
\n
"
)
>>
exit
(
ExitFailure
1
)
Died
stacki
(
ExitFailure
errcode
)
->
printError
Died
stacki
errorcode
->
if
b
then
printError
(
repr
stacki
<>
"`daemon` died unexpectedly with error code.
\n
"
<>
repr
errcode
<>
" died before a message could be found:"
<>
repr
errorcode
<>
"
\n
"
)
>>
exit
(
ExitFailure
1
)
else
exit
(
ExitSuccess
)
clean
::
StackArgs
->
Shell
()
clean
StackArgs
{
..
}
=
cleanLeftovers
workingDirectory
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment