Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
T
tarantool
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
core
tarantool
Commits
c502b00d
Commit
c502b00d
authored
11 years ago
by
Eugine Blikh
Browse files
Options
Downloads
Patches
Plain Diff
first try of admin.test.lua
parent
e7f6f936
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
test/box/admin.test.lua
+130
-0
130 additions, 0 deletions
test/box/admin.test.lua
with
130 additions
and
0 deletions
test/box/admin.test.lua
0 → 100644
+
130
−
0
View file @
c502b00d
--# stop server default
--# start server default
space
=
box
.
schema
.
create_space
(
'tweedledum'
,
{
id
=
0
})
space
:
create_index
(
'primary'
,
'hash'
,
{
parts
=
{
0
,
'num'
}})
box
.
stat
()
help
()
box
.
cfg
()
box
.
stat
()
box
.
insert
(
0
,
1
,
'tuple'
)
box
.
snapshot
()
box
.
delete
(
0
,
1
)
--# setopt delimiter ';'
function
check_type
(
arg
,
typeof
)
if
arg
==
nil
then
return
false
elseif
type
(
arg
)
==
typeof
then
return
true
else
return
false
end
end
;
function
test_box_info
()
local
tmp
=
box
.
info
()
local
num
=
{
'pid'
,
'lsn'
,
'snapshot_pid'
,
'recovery_last_update'
,
'recovery_lag'
,
'uptime'
,
'logger_pid'
}
local
buildstr
=
{
'flags'
,
'target'
,
'compiler'
,
'options'
}
local
str
=
{
'version'
,
'status'
,
'config'
}
failed
=
{}
for
k
,
v
in
ipairs
(
num
)
do
if
check_type
(
tmp
[
v
],
'number'
)
==
false
then
table.insert
(
failed
,
'box.info().'
..
v
)
end
end
for
k
,
v
in
ipairs
(
str
)
do
if
check_type
(
tmp
[
v
],
'string'
)
==
false
then
table.insert
(
failed
,
'box.info().'
..
v
)
end
end
for
k
,
v
in
ipairs
(
buildstr
)
do
if
check_type
(
tmp
.
build
[
v
],
'string'
)
==
false
then
table.insert
(
failed
,
'box.info().build.'
..
v
)
end
end
if
#
failed
==
0
then
return
'box.info() is ok.'
else
return
'box.info() is not ok.'
,
'failed: '
,
failed
end
;
function
test_slab
(
tbl
)
if
type
(
tbl
.
items
)
==
'number'
then
tbl
.
items
=
nil
end
if
type
(
tbl
.
bytes_used
)
==
'number'
then
tbl
.
bytes_used
=
nil
end
if
type
(
tbl
.
item_size
)
==
'number'
then
tbl
.
item_size
=
nil
end
if
type
(
tbl
.
slabs
)
==
'number'
then
tbl
.
slabs
=
nil
end
if
type
(
tbl
.
bytes_free
)
==
'number'
then
tbl
.
bytes_free
=
nil
end
if
#
tbl
>
0
then
return
false
else
return
true
end
end
;
function
test_box_slab_info
()
local
tmp
=
box
.
slab
.
info
()
for
name
,
tbl
in
ipairs
(
tmp
.
slabs
)
do
if
test_slab
(
tbl
)
==
true
then
tmp
[
name
]
=
nil
end
if
#
tmp
.
slabs
==
0
then
tmp
.
slabs
=
nil
end
if
type
(
tmp
.
arena_size
)
==
'number'
then
tmp
.
arena_size
=
nil
end
if
type
(
tmp
.
arena_used
)
==
'number'
then
tmp
.
arena_used
=
nil
end
if
#
tmp
>
0
then
return
tmp
else
return
"box.slab.info() is ok"
end
;
function
test_fiber
(
tbl
)
if
type
(
tbl
.
fid
)
==
'number'
then
tbl
.
fid
=
nil
end
if
type
(
tbl
.
csw
)
==
'number'
then
tbl
.
csw
=
nil
end
if
type
(
tbl
.
backtrace
)
==
'table'
and
#
tbl
.
backtrace
>
0
then
tbl
.
backtrace
=
nil
end
if
#
tbl
>
0
then
return
false
else
return
true
end
end
;
function
test_box_fiber_info
()
local
tmp
=
box
.
fiber
.
info
()
for
name
,
tbl
in
ipairs
(
tmp
)
do
if
test_fiber
(
tbl
)
==
true
then
tmp
[
name
]
=
nil
end
end
if
#
tmp
>
0
then
return
tmp
else
return
"box.fiber.info() is ok"
end
end
;
test_box_info
();
test_box_slab_info
();
test_box_fiber_info
();
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment