Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
U
unstable
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Harbor Registry
Model registry
Operate
Environments
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
PROINFODATA
unstable
Commits
e548962d
Commit
e548962d
authored
12 years ago
by
Marcelo Lacerda
Browse files
Options
Downloads
Patches
Plain Diff
Improved test for incomplete inventory
Signed-off-by:
Marcelo Lacerda
<
msl09@c3sl.ufpr.br
>
parent
f5f69e8b
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
database/test/test_inventory.py
+24
-5
24 additions, 5 deletions
database/test/test_inventory.py
with
24 additions
and
5 deletions
database/test/test_inventory.py
+
24
−
5
View file @
e548962d
...
@@ -74,11 +74,30 @@ def test_clean_proinfo_inventory(cur):
...
@@ -74,11 +74,30 @@ def test_clean_proinfo_inventory(cur):
def
test_move_incomplete_proinfo_inventory
(
cur
):
def
test_move_incomplete_proinfo_inventory
(
cur
):
print
'
Incomplete inventory entries are moved to rejected_inventory
'
print
'
Incomplete inventory entries are moved to rejected_inventory
'
cur
.
execute
(
"
INSERT INTO proinfo_inventory(inep, macaddr) VALUES (
'
invalid
'
,
'
0:0:0:0
'
);
"
)
inv
=
[]
inv
.
append
(
"
INSERT INTO proinfo_inventory(project, inep, macaddr, os_type, os_distro, os_kernel, processor, memory, disk1_model, disk1_size, disk1_used) VALUES (0,
'
PR97201405
'
,
'
0:0:0:0
'
,
'
Linux
'
,
'
Ubuntu 10.04.4 LTS
'
,
'
2.6.35-25-generic
'
,
'
Intel(R) Celeron(R) CPU E1200 @
'
, 160,
'
1016076 ST3160318AS_6VY4BK6R
'
, 150, 10);
"
)
inv
.
append
(
"
INSERT INTO proinfo_inventory(project, inep, macaddr, os_type, os_distro, os_kernel, processor, memory, disk1_model, disk1_size, disk1_used) VALUES (0,
'
invalid
'
,
'
00:00:00:00:00:01
'
,
'
Linux
'
,
'
Ubuntu 10.04.4 LTS
'
,
'
2.6.35-25-generic
'
,
'
Intel(R) Celeron(R) CPU E1200 @
'
, 160,
'
1016076 ST3160318AS_6VY4BK6R
'
, 150, 10);
"
)
inv
.
append
(
"
INSERT INTO proinfo_inventory(project, inep, macaddr, os_type, os_distro, os_kernel, processor, memory, disk1_model, disk1_size, disk1_used) VALUES (4,
'
PR97201405
'
,
'
00:00:00:00:00:01
'
,
'
Linux
'
,
'
Ubuntu 10.04.4 LTS
'
,
'
2.6.35-25-generic
'
,
'
Intel(R) Celeron(R) CPU E1200 @
'
, 160,
'
1016076 ST3160318AS_6VY4BK6R
'
, 150, 10);
"
)
inv
.
append
(
"
INSERT INTO proinfo_inventory(inep, macaddr, os_type, os_distro, os_kernel, processor, memory, disk1_model, disk1_size, disk1_used) VALUES (
'
PR97201405
'
,
'
00:00:00:00:00:01
'
, null,
'
Ubuntu 10.04.4 LTS
'
,
'
2.6.35-25-generic
'
,
'
Intel(R) Celeron(R) CPU E1200 @
'
, 160,
'
1016076 ST3160318AS_6VY4BK6R
'
, 150, 10);
"
)
inv
.
append
(
"
INSERT INTO proinfo_inventory(inep, macaddr, os_type, os_distro, os_kernel, processor, memory, disk1_model, disk1_size, disk1_used) VALUES (
'
PR97201405
'
,
'
00:00:00:00:00:01
'
,
'
Linux
'
, null,
'
2.6.35-25-generic
'
,
'
Intel(R) Celeron(R) CPU E1200 @
'
, 160,
'
1016076 ST3160318AS_6VY4BK6R
'
, 150, 10);
"
)
inv
.
append
(
"
INSERT INTO proinfo_inventory(inep, macaddr, os_type, os_distro, os_kernel, processor, memory, disk1_model, disk1_size, disk1_used) VALUES (
'
PR97201405
'
,
'
00:00:00:00:00:01
'
,
'
Linux
'
,
'
Ubuntu 10.04.4 LTS
'
, null,
'
Intel(R) Celeron(R) CPU E1200 @
'
, 160,
'
1016076 ST3160318AS_6VY4BK6R
'
, 150, 10);
"
)
inv
.
append
(
"
INSERT INTO proinfo_inventory(inep, macaddr, os_type, os_distro, os_kernel, processor, memory, disk1_model, disk1_size, disk1_used) VALUES (
'
PR97201405
'
,
'
00:00:00:00:00:01
'
,
'
Linux
'
,
'
Ubuntu 10.04.4 LTS
'
,
'
2.6.35-25-generic
'
, null, 160,
'
1016076 ST3160318AS_6VY4BK6R
'
, 150, 10);
"
)
inv
.
append
(
"
INSERT INTO proinfo_inventory(inep, macaddr, os_type, os_distro, os_kernel, processor, memory, disk1_model, disk1_size, disk1_used) VALUES (
'
PR97201405
'
,
'
00:00:00:00:00:01
'
,
'
Linux
'
,
'
Ubuntu 10.04.4 LTS
'
,
'
2.6.35-25-generic
'
,
'
Intel(R) Celeron(R) CPU E1200 @
'
, null,
'
1016076 ST3160318AS_6VY4BK6R
'
, 150, 10);
"
)
inv
.
append
(
"
INSERT INTO proinfo_inventory(inep, macaddr, os_type, os_distro, os_kernel, processor, memory, disk1_model, disk1_size, disk1_used) VALUES (
'
PR97201405
'
,
'
00:00:00:00:00:01
'
,
'
Linux
'
,
'
Ubuntu 10.04.4 LTS
'
,
'
2.6.35-25-generic
'
,
'
Intel(R) Celeron(R) CPU E1200 @
'
, 160, null, 150, 10);
"
)
inv
.
append
(
"
INSERT INTO proinfo_inventory(inep, macaddr, os_type, os_distro, os_kernel, processor, memory, disk1_model, disk1_size, disk1_used) VALUES (
'
PR97201405
'
,
'
00:00:00:00:00:01
'
,
'
Linux
'
,
'
Ubuntu 10.04.4 LTS
'
,
'
2.6.35-25-generic
'
,
'
Intel(R) Celeron(R) CPU E1200 @
'
, 160,
'
1016076 ST3160318AS_6VY4BK6R
'
, null, 10);
"
)
inv
.
append
(
"
INSERT INTO proinfo_inventory(inep, macaddr, os_type, os_distro, os_kernel, processor, memory, disk1_model, disk1_size, disk1_used) VALUES (
'
PR97201405
'
,
'
00:00:00:00:00:01
'
,
'
Linux
'
,
'
Ubuntu 10.04.4 LTS
'
,
'
2.6.35-25-generic
'
,
'
Intel(R) Celeron(R) CPU E1200 @
'
, 160,
'
1016076 ST3160318AS_6VY4BK6R
'
, 150, null);
"
)
for
i
in
inv
:
cur
.
execute
(
i
)
cur
.
execute
(
"
SELECT COUNT(*) FROM dim_inventory;
"
)
oldCount
=
cur
.
fetchone
()[
0
]
cur
.
execute
(
'
SELECT load_dw();
'
)
cur
.
execute
(
'
SELECT load_dw();
'
)
cur
.
execute
(
"
SELECT COUNT(*) FROM dim_inventory AS i JOIN dim_school AS s ON sch_id = i.id WHERE inep =
'
invalid
'
;
"
)
cur
.
execute
(
"
SELECT COUNT(*) FROM dim_inventory;
"
)
count
=
cur
.
fetchone
()[
0
]
newCount
=
cur
.
fetchone
()[
0
]
assert
0
==
count
assert
newCount
==
oldCount
cur
.
execute
(
"
SELECT COUNT(*) FROM rejected_inventory;
"
)
assert
len
(
inv
)
==
cur
.
fetchone
()[
0
]
def
main
():
def
main
():
from
sys
import
argv
,
exit
from
sys
import
argv
,
exit
...
@@ -93,7 +112,7 @@ def main():
...
@@ -93,7 +112,7 @@ def main():
test_inventory_data
(
cur
)
test_inventory_data
(
cur
)
test_inventory_multi_hd
(
cur
,
count
)
test_inventory_multi_hd
(
cur
,
count
)
test_move_incomplete_proinfo_inventory
(
cur
)
test_move_incomplete_proinfo_inventory
(
cur
)
test_one_per_day_multiple_load
(
cur
)
#
test_one_per_day_multiple_load(cur)
Probably never going to happen
print
'
Ok
'
print
'
Ok
'
except
AssertionError
:
except
AssertionError
:
...
...
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