1. 04 Sep, 2012 2 commits
    • Iustin Pop's avatar
      Split out Objects.hs from QC.hs · e5a29b6c
      Iustin Pop authored
      
      
      This is the first file split out from QC.hs - an easy one, since it
      has just one test.
      
      The patch changes the way we build hpc excludes, since now we'll have
      many modules that need to be excluded, and hpc doesn't seem to be able
      to do wildcards (it can do packages, but all our code is
      not-package-based).
      
      Further splitting will be done in bigger batches.
      Signed-off-by: default avatarIustin Pop <iustin@google.com>
      Reviewed-by: default avatarRené Nussbaumer <rn@google.com>
      e5a29b6c
    • Iustin Pop's avatar
      Move haskell test code to htest/ · f0f3a6df
      Iustin Pop authored
      
      
      This is the first commit of a series that will attempt to cleanup the
      test code organisation, which evolved somewhat organically from the
      initial pure htools functionality.
      
      The proposed organisation of the tree will be as follows:
      
      - htools (or maybe renamed to haskell or hs): only production code
      - htest: top-level test directory, containing test.hs, static helper
        scripts, etc.
      - htest/Ganeti/*.hs: modules implementing the actual test properties
        and test cases for the correspondingly-named production code modules
      - htest/data: containing test data files for the test cases
      
      This particular patch moves all the test code (test.hs, hpc-htools.hs
      symlink) and helper scripts (offline-test.sh, etc.) from htools/ to
      htest/, while updating the files themselves (if they had paths
      mentioning htools/), .gitignore and the Makefile.
      
      The only special mention is that in Makefile, we used to have a BINARY
      shell variable in binary build rule; that was computed via stripping
      `htools/' prefix; I've cleaned that and replaced with $(notdir $@);
      even though it's duplicated a few times, it leads to more readable
      make output (and easier to copy-paste).
      Signed-off-by: default avatarIustin Pop <iustin@google.com>
      Reviewed-by: default avatarAgata Murawska <agatamurawska@google.com>
      f0f3a6df
  2. 03 Sep, 2012 1 commit
  3. 28 Aug, 2012 6 commits
    • Iustin Pop's avatar
      Add two confd library tests · 998b6f8b
      Iustin Pop authored
      
      
      These test that we encode requests correctly and decode good messages,
      that a message with a too old/new timestamp is never accepted, and
      that a message signed with a different key is never accepted.
      Signed-off-by: default avatarIustin Pop <iustin@google.com>
      Reviewed-by: default avatarAgata Murawska <agatamurawska@google.com>
      998b6f8b
    • Iustin Pop's avatar
      Rename tests for nicer names in test output · 2c4eb054
      Iustin Pop authored
      
      
      With the change to test-framework, where individual tests are listed,
      QCHelper tries to remove a "prop_$group_" prefix from the function
      names, for shorter names. However, some test groups (LUXI) and test
      functions are not uniform, leading to long names, so we should fix
      them.
      Signed-off-by: default avatarIustin Pop <iustin@google.com>
      Reviewed-by: default avatarAgata Murawska <agatamurawska@google.com>
      2c4eb054
    • Iustin Pop's avatar
      Switch Haskell test harness to test-framework · 95f6c931
      Iustin Pop authored
      This patch replaces our home-grown, and quite limited, test runner
      infrastructure with test-framework
      (http://batterseapower.github.com/test-framework/
      
      ). The rationale for
      doing so is as follows:
      
      - we will need to add support for HUnit tests, so either we add more
        custom code or we switch to an existing library
      - test-framework is mature and already packaged, at least in
        Debian/Ubuntu
      - it supports more features: parallel test running, better test
        selection, etc.
      
      As you can see, the changes are trivial, and don't touch the tests at
      all; if/when we split the QC.hs file into per-module files, then we
      could drop QCHelper too, and replace it with test-framework-th, which
      does the same, but even more automated (auto-discovery, without having
      to list the tests at all).
      
      Dependencies are updated in devnotes.rst; note that I've already added
      the hunit dependencies since we're going to use that soon.
      Signed-off-by: default avatarIustin Pop <iustin@google.com>
      Reviewed-by: default avatarAgata Murawska <agatamurawska@google.com>
      95f6c931
    • Iustin Pop's avatar
      Rename Query2.hs to Qlang.hs · dc6a0f82
      Iustin Pop authored
      
      
      While starting to use the new filter types, I realised that what is
      currently implemented is the equivalent of `lib/qlang.py', not
      `lib/query.py', since we only deal with data types for now and not the
      actual query runtime functionality (RPC, config, etc.).
      
      Let's rename the file to be more consistent with the Python code base.
      Signed-off-by: default avatarIustin Pop <iustin@google.com>
      Reviewed-by: default avatarAgata Murawska <agatamurawska@google.com>
      dc6a0f82
    • Iustin Pop's avatar
      Implement Query2 filter JSON (de)serialisation · e8a25d62
      Iustin Pop authored
      
      
      This adds support for encoding/decoding Query2 filters to/from JSON,
      in (hopefully) the same format as the Python code generates.
      
      It also adds a simple unit-test to check that this conversion is
      idempotent. Of note here is that, since the Filter data type is
      recursive, we have to manually ensure that the generator for it
      correctly "shrinks" at each step (first version crashed hard my
      workstation after eating ~8GB of ram :).
      
      Compared to the current Query2 implementation, the following changes
      were done:
      
      - style: shortened some names to match the Python ones (LessEqualThan
        → LE, etc.)
      - changed FilterValue from string to an ADT that can encode both
        quoted strings and numeric values, since this is actually what
        qlang.py generates
      - added support for EmptyField, which in hindsight it's an obvious
        missing part :)
      Signed-off-by: default avatarIustin Pop <iustin@google.com>
      Reviewed-by: default avatarAgata Murawska <agatamurawska@google.com>
      e8a25d62
    • Agata Murawska's avatar
      Simple QC tests for RPC calls · 66f74cae
      Agata Murawska authored
      
      
      Right now we're only able to test if when a node is offline, the call
      fails with an appropriate errror.
      Signed-off-by: default avatarAgata Murawska <agatamurawska@google.com>
      Reviewed-by: default avatarIustin Pop <iustin@google.com>
      66f74cae
  4. 08 Jun, 2012 1 commit
  5. 08 May, 2012 2 commits
  6. 29 Feb, 2012 1 commit
  7. 16 Jan, 2012 2 commits
  8. 08 Dec, 2011 1 commit
    • Iustin Pop's avatar
      Cleanup hlint errors · 3603605a
      Iustin Pop authored
      
      
      First, we update the recommended hlint version to what I used to get a
      clean output (1.8.15). Most of the changes are:
      
      - remove unneeded parentheses
      - some simplifications (intercalate " " → unwords, maybe … id →
        fromMaybe, etc.)
      - removal of some duplicate code (in previous patches)
      
      There are still some warnings which I didn't clean out but plain
      ignored:
      
      - 'Eta reduce' in some specific files, because the type inference
        specialises the function on the first call, and annotating the type
        properly would be too verbose
      - use of 'first', 'comparing', and 'on', since these don't seem to be
        widely or consistently used (outside ganeti/htools, I mean)
      - use of Control.Exception.catch, as we only care about I/O errors; at
        one point yes, we will need to transition to this new API
      - 'Reduce duplication', since hlint warns even for 3 duplicate lines,
        and abstracting that away seems overkill to me
      
      After this patch, make hlint is clean and doesn't exit with an error
      anymore; we could enable it automatically on 'make lint' if hlint is
      detected (future patch).
      
      Note that we explicitly skip the THH.hs file from checking because it
      seems that hlint doesn't parse correctly for now the splice notation.
      Signed-off-by: default avatarIustin Pop <iustin@google.com>
      Reviewed-by: default avatarAgata Murawska <agatamurawska@google.com>
      3603605a
  9. 18 Nov, 2011 1 commit
    • Iustin Pop's avatar
      htools: adjust imports for newer compilers · 7345b69b
      Iustin Pop authored
      
      
      While testing with ghc 7.2, I saw that some imports we are using are
      very old (from ghc 6.8 time), even though current libraries are using
      different names.
      
      We fix this and bump minimum documented version to ghc 6.12, as I
      don't have 6.10 to test anymore (possibly still works with that
      version, but better safe - both Ubuntu Lucid and Debian Squeeze ship
      with 6.12 nowadays).
      Signed-off-by: default avatarIustin Pop <iustin@google.com>
      Reviewed-by: default avatarMichael Hanselmann <hansmi@google.com>
      7345b69b
  10. 17 Nov, 2011 1 commit
  11. 03 Oct, 2011 2 commits
  12. 21 Jul, 2011 1 commit
  13. 13 Jul, 2011 2 commits
  14. 28 Jun, 2011 2 commits
    • Iustin Pop's avatar
      htools: allow unittest to be replayed · 509809db
      Iustin Pop authored
      
      
      This just adds glue to allow replaying of tests using a given RNG state
      and test size (both are needed for exact replayability).
      Signed-off-by: default avatarIustin Pop <iustin@google.com>
      Reviewed-by: default avatarGuido Trotter <ultrotter@google.com>
      509809db
    • Iustin Pop's avatar
      htools: Switch to QuickCheck 2.x · 8e4f6d56
      Iustin Pop authored
      
      
      Since current distros don't package anymore QuickCheck 1.x, let's move
      to 2.x.
      
      This requires also a few changes to the code:
      
      - Test.QuickCheck.Batch doesn't exist anymore, so we need to write some
        scaffolding code to replace it
      - the way test sizes are generated has changed, and we need to restrict
        (in some tests) the cluster size, as our code is not yet ready for
        hundreds of thousands of nodes in a cluster and we run out of stack
        (which could be a bug somewhere by itself, needs investigation)
      - at least with GHC 7, floating point errors make a perfect cluster
        score even bigger, so we need to bump up the max. rounding error
        allowed
      Signed-off-by: default avatarIustin Pop <iustin@google.com>
      Reviewed-by: default avatarGuido Trotter <ultrotter@google.com>
      8e4f6d56