Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
csbase-dev
sgarest-daemon
Commits
d08972da
Commit
d08972da
authored
Dec 21, 2020
by
Renato Figueiro Maia
Browse files
Testes da validação do arquivo de configuração.
[SOMA-6916][SOMA-6857]
parent
70c513fe
Changes
2
Hide whitespace changes
Inline
Side-by-side
test/spec/rest_spec.js
View file @
d08972da
...
...
@@ -4,6 +4,47 @@ const chakram = require("chakram");
const
events
=
require
(
"
events
"
);
const
utils
=
require
(
"
./utils
"
);
describe
(
"
Starting SGA
"
,
function
()
{
afterEach
(
utils
.
clearAllResources
);
const
invalidConfigVals
=
{
csbase_server
:
[
null
],
platform
:
[
null
],
sgad_host
:
[
null
],
sgad_port
:
[
-
1
,
0
,
65536
],
sga_name
:
[
null
,
"
sga-for-testing
"
,
"
sga.for.testing
"
,
"
sga/for/testing
"
],
status_interval_s
:
[
-
1
,
0
],
exec_polling_interval_s
:
[
-
1
,
0
],
register_retry_s
:
[
-
1
,
0
],
project_root_dir
:
[
null
],
algorithm_root_dir
:
[
null
],
runtime_data_dir
:
[
null
],
sandbox_root_dir
:
[
null
],
driver
:
[
null
],
resources
:
[
"
some resources
"
,
0
,
1
,
false
,
true
],
};
for
(
let
propName
in
invalidConfigVals
)
{
const
vals
=
invalidConfigVals
[
propName
];
for
(
let
i
=
0
;
i
<
vals
.
length
;
i
++
)
{
it
(
"
should exit with code 1 on invalid
"
+
propName
+
"
configuration
"
,
async
()
=>
{
const
config
=
{
csbase_server
:
"
http://localhost
"
};
config
[
propName
]
=
vals
[
i
];
utils
.
fillSgaConfig
(
config
);
const
sga
=
new
utils
.
SgaDaemon
(
config
);
await
sga
.
start
();
const
[
exitVal
]
=
await
sga
.
terminated
();
expect
(
exitVal
).
toEqual
(
1
);
}
);
}
}
});
describe
(
"
Registering SGA
"
,
function
()
{
afterEach
(
utils
.
clearAllResources
);
...
...
test/spec/utils.js
View file @
d08972da
...
...
@@ -52,7 +52,9 @@ function writeAsLua(stream, value, prefix = "") {
}
break
;
case
"
object
"
:
{
if
(
value
===
null
)
{
stream
.
write
(
"
nil
"
);
}
else
{
const
newPrefix
=
prefix
+
"
"
;
stream
.
write
(
"
{
\n
"
);
if
(
Array
.
isArray
(
value
))
{
...
...
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