1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
|
diff --git a/test/hs/Test/Ganeti/Runtime.hs b/test/hs/Test/Ganeti/Runtime.hs
index b15aa36..7aa75ca 100644
--- a/test/hs/Test/Ganeti/Runtime.hs
+++ b/test/hs/Test/Ganeti/Runtime.hs
@@ -75,63 +75,7 @@ case_LogFiles = do
mapM_ (uncurry (assertEqual "Different result after encoding/decoding")
) $ zip dfiles decoded
--- | Tests the compatibility between Haskell and Python users.
-case_UsersGroups :: Assertion
-case_UsersGroups = do
- -- note: we don't have here a programatic way to list all users, so
- -- we harcode some parts of the two (hs/py) lists
- let daemons = [minBound..maxBound]::[GanetiDaemon]
- users = map daemonUser daemons
- groups = map daemonGroup $
- map DaemonGroup daemons ++ map ExtraGroup [minBound..maxBound]
- py_stdout <-
- runPython "from ganeti import constants\n\
- \from ganeti import serializer\n\
- \import sys\n\
- \users = [constants.MASTERD_USER,\n\
- \ constants.NODED_USER,\n\
- \ constants.RAPI_USER,\n\
- \ constants.CONFD_USER,\n\
- \ constants.WCONFD_USER,\n\
- \ constants.KVMD_USER,\n\
- \ constants.LUXID_USER,\n\
- \ constants.METAD_USER,\n\
- \ constants.MOND_USER,\n\
- \ ]\n\
- \groups = [constants.MASTERD_GROUP,\n\
- \ constants.NODED_GROUP,\n\
- \ constants.RAPI_GROUP,\n\
- \ constants.CONFD_GROUP,\n\
- \ constants.WCONFD_GROUP,\n\
- \ constants.KVMD_GROUP,\n\
- \ constants.LUXID_GROUP,\n\
- \ constants.METAD_GROUP,\n\
- \ constants.MOND_GROUP,\n\
- \ constants.DAEMONS_GROUP,\n\
- \ constants.ADMIN_GROUP,\n\
- \ ]\n\
- \encoded = (users, groups)\n\
- \print serializer.Dump(encoded)" ""
- >>= checkPythonResult
- let deserialised = J.decode py_stdout::J.Result ([String], [String])
- (py_users, py_groups) <-
- case deserialised of
- J.Ok ops -> return ops
- J.Error msg ->
- assertFailure ("Unable to decode users/groups: " ++ msg)
- -- this already raised an expection, but we need it for proper
- -- types
- >> fail "Unable to decode users/groups"
- assertEqual "Mismatch in number of returned users"
- (length py_users) (length users)
- assertEqual "Mismatch in number of returned users"
- (length py_groups) (length groups)
- mapM_ (uncurry (assertEqual "Different result for users")
- ) $ zip users py_users
- mapM_ (uncurry (assertEqual "Different result for groups")
- ) $ zip groups py_groups
testSuite "Runtime"
[ 'case_LogFiles
- , 'case_UsersGroups
]
|