Revision c5b4a186

b/htools/Ganeti/HTools/QC.hs
41 41
  , testCLI
42 42
  , testJSON
43 43
  , testLUXI
44
  , testSsconf
44 45
  ) where
45 46

  
46 47
import Test.QuickCheck
......
58 59
import qualified Ganeti.OpCodes as OpCodes
59 60
import qualified Ganeti.Jobs as Jobs
60 61
import qualified Ganeti.Luxi as Luxi
62
import qualified Ganeti.Ssconf as Ssconf
61 63
import qualified Ganeti.HTools.CLI as CLI
62 64
import qualified Ganeti.HTools.Cluster as Cluster
63 65
import qualified Ganeti.HTools.Container as Container
......
1731 1733
testSuite "LUXI"
1732 1734
          [ 'prop_Luxi_CallEncoding
1733 1735
          ]
1736

  
1737
-- * Ssconf tests
1738

  
1739
instance Arbitrary Ssconf.SSKey where
1740
  arbitrary = elements [minBound..maxBound]
1741

  
1742
prop_Ssconf_filename key =
1743
  printTestCase "Key doesn't start with correct prefix" $
1744
    Ssconf.sSFilePrefix `isPrefixOf` Ssconf.keyToFilename (Just "") key
1745

  
1746
testSuite "Ssconf"
1747
  [ 'prop_Ssconf_filename
1748
  ]
b/htools/Ganeti/Ssconf.hs
30 30
  , sSKeyToRaw
31 31
  , sSKeyFromRaw
32 32
  , getPrimaryIPFamily
33
  , keyToFilename
34
  , sSFilePrefix
33 35
  ) where
34 36

  
35 37
import Ganeti.THH
......
51 53
maxFileSize :: Int
52 54
maxFileSize = 131072
53 55

  
56
-- | ssconf file prefix, re-exported from Constants.
57
sSFilePrefix :: FilePath
58
sSFilePrefix = C.ssconfFileprefix
59

  
54 60
$(declareSADT "SSKey"
55 61
  [ ("SSClusterName",          'C.ssClusterName)
56 62
  , ("SSClusterTags",          'C.ssClusterTags)
......
80 86
keyToFilename :: Maybe FilePath     -- ^ Optional config path override
81 87
              -> SSKey              -- ^ ssconf key
82 88
              -> FilePath
83
keyToFilename optpath key = fromMaybe C.dataDir optpath </> sSKeyToRaw key
89
keyToFilename optpath key = fromMaybe C.dataDir optpath </>
90
                            sSFilePrefix ++ sSKeyToRaw key
84 91

  
85 92
-- | Runs an IO action while transforming any error into 'Bad'
86 93
-- values. It also accepts an optional value to use in case the error
b/htools/test.hs
125 125
  , (fast, testCLI)
126 126
  , (fast, testJSON)
127 127
  , (fast, testLUXI)
128
  , (fast, testSsconf)
128 129
  , (slow, testCluster)
129 130
  ]
130 131

  

Also available in: Unified diff