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
569a141f
Commit
569a141f
authored
Dec 30, 2020
by
Renato Figueiro Maia
Browse files
Testes iniciais do driver POSIX.
[SOMA-7116][SOMA-7115]
parent
f692fb24
Changes
2
Hide whitespace changes
Inline
Side-by-side
.gitlab-ci.yml
View file @
569a141f
...
...
@@ -85,13 +85,17 @@ test:
-
test/lua_runtime
-
test/daemon/node_modules
script
:
-
bash install.sh --force $(pwd)/test/lua_runtime
-
test/lua_runtime/bin/luarocks remove sga-daemon
-
bash install.sh --force --posix --pbs --slurm $(pwd)/test/lua_runtime
-
for rockspec in *.rockspec; do
-
test/lua_runtime/bin/luarocks --force remove ${rockspec%-*-*.rockspec}
-
done
-
cd test/daemon
-
npm install
-
npm run test
-
cd ../..
-
test/lua_runtime/bin/luarocks purge
-
test/lua_runtime/bin/luarocks install --server=https://luarocks.org busted
-
export PATH=".:${PATH}"
# to use mockup commands like 'qsub' from PBS
-
test/lua_runtime/bin/busted test/driver/posix.lua
#-------------------------
# Docker Jobs
...
...
test/driver/posix.lua
0 → 100644
View file @
569a141f
local
procdata
=
require
"procdata"
local
module
=
require
"sga.driver.posix"
describe
(
"SGA driver for POSIX"
,
function
()
local
logger
=
{
error
=
function
()
end
,
debug
=
function
()
end
,
}
before_each
(
function
()
snapshot
=
assert
:
snapshot
()
mock
(
logger
)
end
)
after_each
(
function
()
snapshot
:
revert
()
end
)
it
(
"should list a single node"
,
function
()
local
driver
=
module
.
new
({
sga_name
=
"MySgaNameForTest"
},
logger
)
local
expected
=
{
num_of_cpus
=
math.random
(
256
),
clock_mhz
=
math.random
(
256
),
ram_mb
=
math.random
(
256
),
swap_mb
=
math.random
(
256
),
}
local
megabyte
=
1024
*
1024
stub
(
procdata
,
"get_num_cpus"
).
returns
(
expected
.
num_of_cpus
)
stub
(
procdata
,
"get_clock_speed"
).
returns
(
expected
.
clock_mhz
)
stub
(
procdata
,
"get_total_memory"
).
returns
{
ram
=
expected
.
ram_mb
*
megabyte
,
swap
=
expected
.
swap_mb
*
megabyte
,
}
local
nodes
=
module
.
get_nodes
(
driver
)
assert
.
same
(
nodes
,
{
MySgaNameForTest
=
expected
})
assert
.
stub
(
procdata
.
get_num_cpus
).
was
.
called
()
assert
.
stub
(
procdata
.
get_clock_speed
).
was
.
called
()
assert
.
stub
(
procdata
.
get_total_memory
).
was
.
called
()
end
)
for
fname
,
errmsg
in
pairs
{
get_num_cpus
=
"CPU information error"
,
get_clock_speed
=
"CPU clock information error"
,
get_total_memory
=
"system memory information error"
,
}
do
it
(
"should report error on 'procdata."
..
fname
..
"' failure"
,
function
()
local
driver
=
module
.
new
(
nil
,
logger
)
stub
(
procdata
,
fname
).
returns
(
nil
,
errmsg
)
local
nodes
,
extra
=
module
.
get_nodes
(
driver
)
assert
.
is_nil
(
nodes
)
assert
.
equal
(
errmsg
,
extra
)
assert
.
stub
(
procdata
[
fname
]).
was
.
called
()
end
)
end
end
)
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