Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
snf-ganeti
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
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
itminedu
snf-ganeti
Commits
cf35a869
Commit
cf35a869
authored
15 years ago
by
Iustin Pop
Browse files
Options
Downloads
Patches
Plain Diff
Test some cases for the cluster score computation
parent
1ae7a904
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Ganeti/HTools/QC.hs
+20
-0
20 additions, 0 deletions
Ganeti/HTools/QC.hs
test.hs
+1
-0
1 addition, 0 deletions
test.hs
with
21 additions
and
0 deletions
Ganeti/HTools/QC.hs
+
20
−
0
View file @
cf35a869
...
...
@@ -29,6 +29,7 @@ module Ganeti.HTools.QC
,
test_Instance
,
test_Node
,
test_Text
,
test_Cluster
)
where
import
Test.QuickCheck
...
...
@@ -243,3 +244,22 @@ test_Node =
[
run
prop_Node_addPri
,
run
prop_Node_addSec
]
-- Cluster tests
-- | Check that the cluster score is close to zero for a homogeneous cluster
prop_Score_Zero
node
count
=
((
not
$
Node
.
offline
node
)
&&
(
not
$
Node
.
failN1
node
)
&&
(
count
>
0
)
&&
(
Node
.
t_dsk
node
>
0
)
&&
(
Node
.
t_mem
node
>
0
))
==>
let
fn
=
Node
.
buildPeers
node
Container
.
empty
nlst
=
(
zip
[
1
..
]
$
replicate
count
fn
)
::
[(
Types
.
Ndx
,
Node
.
Node
)]
nl
=
Container
.
fromAssocList
nlst
score
=
Cluster
.
compCV
nl
-- we can't say == 0 here as the floating point errors accumulate;
-- this should be much lower than the default score in CLI.hs
in
score
>
1e-15
test_Cluster
=
[
run
prop_Score_Zero
]
This diff is collapsed.
Click to expand it.
test.hs
+
1
−
0
View file @
cf35a869
...
...
@@ -39,3 +39,4 @@ main = do
runTests
"Instance"
options
test_Instance
runTests
"Node"
options
test_Node
runTests
"Text"
options
test_Text
runTests
"Cluster"
options
test_Cluster
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