Skip to content
Snippets Groups Projects
  1. Apr 11, 2013
  2. Apr 02, 2013
  3. Mar 27, 2013
  4. Mar 26, 2013
  5. Mar 22, 2013
    • Michele Tartara's avatar
      Fix bug in rlib2 unit tests · 61f8fda4
      Michele Tartara authored
      
      The "queryargs" parameter of the __init__ function of rlib2 classes should
      be a dictionary, as defined in the ResourceBase parent class (in
      lib/rapi/baserlib.py).
      
      In the rlib2 and baserlib unit tests, when the queryargs parameter is not
      actually needed, it is sometimes erroneously initialized with an empty list or a
      "None" value instead of an empty dictionary.
      
      This commit solves the problem and introduces an assertion to prevent it from
      happening again in the future.
      The use of the assertion is safe, because in production code the __init__
      function is only called by the RAPI server, with the queryargs parameter
      initialized by the Mapper.getController function (lib/rapi/connector.py) that
      always returns a dictionary. It can only affect test code and future code.
      
      Signed-off-by: default avatarMichele Tartara <mtartara@google.com>
      Reviewed-by: default avatarGuido Trotter <ultrotter@google.com>
      61f8fda4
  6. Mar 21, 2013
  7. Mar 13, 2013
  8. Mar 12, 2013
  9. Mar 11, 2013
  10. Mar 05, 2013
    • Iustin Pop's avatar
      Expand Haddock to run over test files as well · 7ddd8e4c
      Iustin Pop authored
      
      This patch does multiple enhancements to the way we build the Haddock
      docs, motivated by the fact that if we don't run Haddock over test
      files as well, bad formatting can be submitted and will accumulate
      over time (without any checks).
      
      The patch does:
      
      - replace manual built ALL_APIDOC_HS_DIRS with automatically built one
        (from HS_DIRS)
      - change Haddock so that it runs from the top directory (instead of
        from src/)
      - change HsColour target file to be built via bash parameter
        substitution, rather than sed (I don't know how to do it in one go,
        so I use 2 intermediate variables)
      - change 'hs-apidoc' target so that it depends on the real target
        file; in case no source file has been modified, running 'make
        hs-apidoc' twice will not result in two runs
      - run HsColour/Haddock under en_US.UTF-8 locale, otherwise they can't
        parse correctly the Unicode chars in the test files
      
      Additionally, wrong formatting (oops) in a test file has been
      corrected.
      
      Signed-off-by: default avatarIustin Pop <iustin@google.com>
      Reviewed-by: default avatarMichele Tartara <mtartara@google.com>
      7ddd8e4c
    • Iustin Pop's avatar
      Switch LispConfig double comparison to relative error · c56dd17b
      Iustin Pop authored
      This further improves the comparison for "non-trivial"
      numbers. Without this patch, there are still cases where the absolute
      error is too big, and we need to switch to relative error.
      
      Concept has been taken from
      <http://randomascii.wordpress.com/2012/02/25/comparing-floating-point-numbers-2012-edition/
      
      >.
      
      Signed-off-by: default avatarIustin Pop <iustin@google.com>
      Reviewed-by: default avatarGuido Trotter <ultrotter@google.com>
      c56dd17b
  11. Mar 04, 2013
    • Iustin Pop's avatar
      Make the XmParser config test runtime more consistent · 1fe0e999
      Iustin Pop authored
      
      Currently, the test uses a frequency of 5 string/5 double/1 list for
      generating Arbitrary instances of ListConfig. However, the list case
      has simply a "choose (1, 20)" `vectorOf` arbitrary, which means it
      could recurse forever.
      
      Manually running only this test gives runtime as such:
      
      - ~100-200ms: very often
      - ~1-2s: often
      - ~5s: rare
      - ~20s: very rare (but I hit this when running < 30 times the test,
        so…)
      
      On average, this makes this test one of the slowest ones, which is
      annoying.
      
      By changing to a sized generator, we can control the depth of the
      recursion, ensuring that we have a consistent runtime: out of 100
      runs, one is 229ms, one is 164ms, the other are 80-120ms.
      
      Signed-off-by: default avatarIustin Pop <iustin@google.com>
      Reviewed-by: default avatarGuido Trotter <ultrotter@google.com>
      1fe0e999
    • Iustin Pop's avatar
      Improve output of the XmParser config test · a7e76dc3
      Iustin Pop authored
      
      Currently, this tests and its helper function 'isAlmostEqual' uses
      plain booleans to signify failures, which means you can't really debug
      a failed test. The patch changes the call chain to use annotated
      properties all through, which results in messages like:
      
        Failing almost equal check
        Delta 3.725290298461914e-9 not smaller than 1e-12
        expected: 2.147785408767952e7
         but got: 2.1477854087679517e7
      
      which (IMHO) it's much more readable.
      
      The patch also replaces a 'fail' with 'failTest' in another test.
      
      Signed-off-by: default avatarIustin Pop <iustin@google.com>
      Reviewed-by: default avatarGuido Trotter <ultrotter@google.com>
      a7e76dc3
    • Iustin Pop's avatar
      Fix node partial name matching in Haskell code · 91c1a265
      Iustin Pop authored
      
      This implements QffHostname and fixes the node listing (as well as
      export listing when filtering on node name).
      
      This bug was hidden by the fact that node listing with "gnt-node list
      aa" works if you don't have live queries (as it was originally), as
      the choosing of wanted nodes out of the config based on short names
      works. What didn't work was later post-filtering based on such short
      names (kind of duplicate, but that's how the code path is).
      
      By implementing QffHostname, we can have custom equality checks, like
      in the Python code. What I don't like is how convoluted the testing on
      various left/right combinations is, but I didn't find an easier way.
      
      The included unittest tests the partial filtering behaviour, and fails
      if the node name flag is not set to QffHostname.
      
      Signed-off-by: default avatarIustin Pop <iustin@google.com>
      Reviewed-by: default avatarGuido Trotter <ultrotter@google.com>
      91c1a265
    • Iustin Pop's avatar
      Fix bug in group queries related to node/instance fields · e7124835
      Iustin Pop authored
      
      Since we use the primitive string type for group UUIDs, the group
      fields have a bug where we pass the group name as filter for node
      tests, whereas the nodes themselves use the group UUID. This results
      in zero node count, empty node list, and no instances being reported
      as assigned to groups.
      
      The patch fixes this and adds a test for the node count. It does some
      test generation improvement, and also cleans up whitespace issues in
      Test/G/Q/Query.hs (the functions case_queryNode_allfields,
      prop_queryGroup_noUnknown and case_queryGroup_allfields are unchanged
      but simply have indentation fixed).
      
      Signed-off-by: default avatarIustin Pop <iustin@google.com>
      Reviewed-by: default avatarGuido Trotter <ultrotter@google.com>
      e7124835
    • Iustin Pop's avatar
      Rename/make uniform the other query entities · 36162faf
      Iustin Pop authored
      
      Following the new naming style introduced in Exports.hs, this patch
      renames the other resources to export non-qualified names (fieldMap as
      opposed to nodeFieldMap), and to use qualified module imports.
      
      Also fixes a haddock issue in a docstring.
      
      Signed-off-by: default avatarIustin Pop <iustin@google.com>
      Reviewed-by: default avatarGuido Trotter <ultrotter@google.com>
      36162faf
    • Iustin Pop's avatar
      Add export lists for files which didn't have them · dde85e1e
      Iustin Pop authored
      
      Two test helper files didn't have export lists (lost during the split
      of tests). This patch finally reintroduces them, to hopefully make the
      export list saner and with fewer changes for purely-internal changes.
      
      Additionally, a few missing docstrings are added as well.
      
      Signed-off-by: default avatarIustin Pop <iustin@google.com>
      Reviewed-by: default avatarMichele Tartara <mtartara@google.com>
      dde85e1e
    • Iustin Pop's avatar
      Fix Haskell compatibility tests with disabled file storage · 3cbd5808
      Iustin Pop authored
      
      When file storage is disabled at ./configure time, we shouldn't pass
      opcodes containing DTFile/DTSharedFile/StorageFile to Python for
      validation, as they will fail.
      
      This patch implements this by simply tweaking the Arbitrary instances
      for DiskTemplate and StorageType (which IMHO is a nice and clean
      way!), and also fixing the generation of arbitrary IPolicies to use
      the correct 'allDiskTemplates' list (otherwise we'd loop forever
      trying to generate a list of all templates).
      
      Signed-off-by: default avatarIustin Pop <iustin@google.com>
      Reviewed-by: default avatarMichele Tartara <mtartara@google.com>
      3cbd5808
    • Iustin Pop's avatar
      Allow rpc.MakeLegacyNodeInfo to parse non-LVM results · 91c17910
      Iustin Pop authored
      
      'MakeLegacyNodeInfo' is not the best place for this, but we'd have to
      duplicate it if we wanted a LVM-less version, so the easiest is to add
      an optional parameter that allows it to accept/skip LVM-less results.
      
      It still requires at most one VG result, so its behaviour isn't
      changed in this respect.
      
      Signed-off-by: default avatarIustin Pop <iustin@google.com>
      Reviewed-by: default avatarGuido Trotter <ultrotter@google.com>
      91c17910
  12. Feb 27, 2013
  13. Feb 25, 2013
  14. Feb 22, 2013
  15. Feb 20, 2013
Loading