Revision 3a3c1eb4
b/Ganeti/HTools/Container.hs | ||
---|---|---|
69 | 69 |
|
70 | 70 |
-- | Locate a key in the map (must exist). |
71 | 71 |
find :: Key -> Container a -> a |
72 |
find k c = c IntMap.! k
|
|
72 |
find k = (IntMap.! k)
|
|
73 | 73 |
|
74 | 74 |
-- | Add or update one element to the map. |
75 | 75 |
add :: Key -> a -> Container a -> Container a |
b/Ganeti/HTools/QC.hs | ||
---|---|---|
170 | 170 |
let run_st = Instance.running inst |
171 | 171 |
run_tx = Instance.runSt inst |
172 | 172 |
in |
173 |
run_tx == "running" || run_tx == "ERROR_up" ==> run_st == True
|
|
173 |
run_tx == "running" || run_tx == "ERROR_up" ==> run_st |
|
174 | 174 |
|
175 | 175 |
prop_Instance_runStatus_False inst = |
176 | 176 |
let run_st = Instance.running inst |
177 | 177 |
run_tx = Instance.runSt inst |
178 | 178 |
in |
179 |
run_tx /= "running" && run_tx /= "ERROR_up" ==> run_st == False
|
|
179 |
run_tx /= "running" && run_tx /= "ERROR_up" ==> not run_st
|
|
180 | 180 |
|
181 | 181 |
testInstance = |
182 | 182 |
[ run prop_Instance_setIdx |
... | ... | |
200 | 200 |
else sdx |
201 | 201 |
ndx = [(pnode, pdx), (rsnode, rsdx)] |
202 | 202 |
inst = Text.loadInst ndx |
203 |
(name:mem_s:dsk_s:vcpus_s:status:pnode:rsnode:[])::
|
|
203 |
[name, mem_s, dsk_s, vcpus_s, status, pnode, rsnode]::
|
|
204 | 204 |
Maybe (String, Instance.Instance) |
205 | 205 |
_types = ( name::String, mem::Int, dsk::Int |
206 | 206 |
, vcpus::Int, status::String |
... | ... | |
249 | 249 |
|
250 | 250 |
-- | Check that the cluster score is close to zero for a homogeneous cluster |
251 | 251 |
prop_Score_Zero node count = |
252 |
((not $ Node.offline node) && (not $ Node.failN1 node) && (count > 0) &&
|
|
252 |
(not (Node.offline node) && not (Node.failN1 node) && (count > 0) &&
|
|
253 | 253 |
(Node.tDsk node > 0) && (Node.tMem node > 0)) ==> |
254 | 254 |
let fn = Node.buildPeers node Container.empty |
255 |
nlst = (zip [1..] $ replicate count fn)::[(Types.Ndx, Node.Node)]
|
|
255 |
nlst = zip [1..] $ replicate count fn::[(Types.Ndx, Node.Node)]
|
|
256 | 256 |
nl = Container.fromAssocList nlst |
257 | 257 |
score = Cluster.compCV nl |
258 | 258 |
-- we can't say == 0 here as the floating point errors accumulate; |
b/Ganeti/Luxi.hs | ||
---|---|---|
114 | 114 |
sbytes <- withTimeout queryTimeout |
115 | 115 |
"sending luxi message" $ |
116 | 116 |
S.send (socket s) obuf |
117 |
(if sbytes == length obuf |
|
118 |
then return () |
|
119 |
else _send (drop sbytes obuf)) |
|
117 |
unless (sbytes == length obuf) $ _send (drop sbytes obuf) |
|
120 | 118 |
in _send (buf ++ [eOM]) |
121 | 119 |
|
122 | 120 |
-- | Waits for a message over a luxi transport. |
b/test.hs | ||
---|---|---|
58 | 58 |
main :: IO () |
59 | 59 |
main = do |
60 | 60 |
errs <- newIORef 0 |
61 |
let wrap lst = map (wrapTest errs) lst
|
|
61 |
let wrap = map (wrapTest errs)
|
|
62 | 62 |
runTests "PeerMap" options $ wrap testPeerMap |
63 | 63 |
runTests "Container" options $ wrap testContainer |
64 | 64 |
runTests "Instance" options $ wrap testInstance |
... | ... | |
66 | 66 |
runTests "Text" options $ wrap testText |
67 | 67 |
runTests "Cluster" options $ wrap testCluster |
68 | 68 |
terr <- readIORef errs |
69 |
(if (terr > 0)
|
|
69 |
(if terr > 0
|
|
70 | 70 |
then do |
71 | 71 |
hPutStrLn stderr $ "A total of " ++ show terr ++ " tests failed." |
72 | 72 |
exitWith $ ExitFailure 1 |
Also available in: Unified diff