1. 13 Jan, 2014 1 commit
  2. 17 Oct, 2013 2 commits
  3. 15 Oct, 2013 1 commit
  4. 25 Sep, 2013 1 commit
  5. 01 Jul, 2013 1 commit
  6. 17 Jun, 2013 1 commit
  7. 03 Jun, 2013 1 commit
  8. 18 Feb, 2013 2 commits
  9. 05 Feb, 2013 1 commit
  10. 27 Dec, 2012 2 commits
    • Iustin Pop's avatar
      Rename test/hs/test to htest · 3e16567e
      Iustin Pop authored
      
      
      The current base name of 'test' means that this binary will generate
      profiling, coverage, etc. files with the name 'test.*', result in
      tab-completion conflicts with the test directory. Let's slightly
      change its base name for typing easiness.
      Signed-off-by: default avatarIustin Pop <iustin@google.com>
      Reviewed-by: default avatarGuido Trotter <ultrotter@google.com>
      3e16567e
    • Iustin Pop's avatar
      Move htest/ files under the test/ tree · 83846468
      Iustin Pop authored
      htest/data becomes test/data/htools (basically reverting commit
      8feabc89
      
      ), and htest/* becomes test/hs/*.
      
      Most changes beside the rename are trivial s/…/…, with the exception
      of autotools/run-in-tempdir, which needed some more changes now that
      test/ is not just Python files:
      
      - test/py is still being copied
      - test/hs moves from individual symlinks to entire dir symlink
      - test/data is symlinked in its entirety
      
      Checked with make distcheck, pep8 and pylint, so at least VPATH builds
      are OK.
      Signed-off-by: default avatarIustin Pop <iustin@google.com>
      Reviewed-by: default avatarGuido Trotter <ultrotter@google.com>
      83846468
  11. 19 Dec, 2012 1 commit
    • Iustin Pop's avatar
      Add a read-only job queue module · aa79e62e
      Iustin Pop authored
      
      
      This patch adds implementation for a read-only job queue module,
      together with "full" test (as full as can be in a lazy language…).
      
      One note about the behaviour of the job queue is the handling of
      opcodes that fail validation: the 'input' opcode actually is a
      meta-type, which can hold either a real opcode or a plain JSValue, so
      that we can still load jobs with invalid opcodes for querying. The
      only downside of this is that, as opposed to Python code, we can't
      show the correct summary for such an opcode - we try to parse the
      OP_ID but not the extended OP_DSC_FIELD-equivalent.
      Signed-off-by: default avatarIustin Pop <iustin@google.com>
      Reviewed-by: default avatarHelga Velroyen <helgav@google.com>
      aa79e62e
  12. 17 Dec, 2012 2 commits
  13. 11 Dec, 2012 1 commit
  14. 07 Dec, 2012 1 commit
  15. 06 Dec, 2012 1 commit
  16. 04 Dec, 2012 1 commit
    • Guido Trotter's avatar
      Add Ganeti.HTools.Graph · 8e6623c8
      Guido Trotter authored
      
      
      This module implements some algorithms on Data.Graph data structures.
      At the moment its main functionality is an LF-color implementation
      (greedy coloring in descending order of degree). There are also a few
      extra functions to calculate the degree order, and convert the node to
      color mapping to color to nodes.
      Signed-off-by: default avatarGuido Trotter <ultrotter@google.com>
      Reviewed-by: default avatarIustin Pop <iustin@google.com>
      8e6623c8
  17. 03 Dec, 2012 1 commit
  18. 27 Nov, 2012 1 commit
  19. 20 Nov, 2012 2 commits
    • Michele Tartara's avatar
      Add DRBD parser unit tests · a52f8e72
      Michele Tartara authored
      
      
      This adds tests that existing test files can be parsed by the Haskell
      parser as well, plus one new test file.
      Signed-off-by: default avatarMichele Tartara <mtartara@google.com>
      Reviewed-by: default avatarIustin Pop <iustin@google.com>
      a52f8e72
    • Iustin Pop's avatar
      Create a new Ganeti/Types.hs module · 5e9deac0
      Iustin Pop authored
      There are already three cases where we copied type definitions between
      the htools-specific types into the main ganeti code. Let's stop doing
      this 
      
       and create a common types module that holds these.
      
      Note that there already exists BasicTypes.hs, but that refers to very
      low-level types, and can't use TH derivation itself.
      
      A side effect of this unification is that there is a small conflict
      between AdminStatus/AdminOffline and InstanceStatus/AdminOffline. As
      such, I renamed AdminOffline and AdminDown to StatusOffline/StatusDown
      in the InstanceStatus type.
      
      The patch also moves the tests related to these types to a new test
      module.
      Signed-off-by: default avatarIustin Pop <iustin@google.com>
      Reviewed-by: default avatarAdeodato Simo <dato@google.com>
      5e9deac0
  20. 13 Nov, 2012 1 commit
  21. 26 Oct, 2012 2 commits
  22. 25 Oct, 2012 1 commit
    • Iustin Pop's avatar
      Add an Errors module mirroring the Python one · ef3ad027
      Iustin Pop authored
      
      
      As described in the module doc string, while writing this it dawned
      upon me that we're mixing all errors together into a single hierarchy
      (well, type on the Haskell side), which is not good. Some errors are
      used purely within noded, some in the CLI frontends, etc. so these
      should not be the same type; frontend functions should only be able to
      raise frontend errors, not backend ones.
      
      As to this patch itself, I've used again Template Haskell to generate
      both the data type and the serialisation functions, as the initial
      version, hand-written, seemed too prone to errors due to string
      matching.
      
      A small unittest for checking serialisation consistency is also added.
      Signed-off-by: default avatarIustin Pop <iustin@google.com>
      Reviewed-by: default avatarGuido Trotter <ultrotter@google.com>
      ef3ad027
  23. 08 Oct, 2012 1 commit
  24. 07 Sep, 2012 2 commits
  25. 05 Sep, 2012 6 commits
    • Iustin Pop's avatar
      Rework CLI modules and tests · 51000365
      Iustin Pop authored
      While investigating how we could test the Daemon.hs module, I realised
      that we have a very, erm, sub-optimal situation:
      
      - HTools/CLI.hs has a nice IO/pure separation testing in cmdline
        parsing, which allows some basic functionality to be tested, but
        uses direct 'read' in many options, which fails at runtime when
        evaluating the argument, and not when parsing the options
      - Daemon.hs lacks that, but has a much nicer 'reqWithConversion'
        helper that can be used for nicer option parsing, and uses that +
        tryRead instead of plain 'read'
      
      Since this situation is very bad, let's clean it up. We introduce yet
      another module, Common.hs, that holds functionality common to all
      command line programs (daemons or not). We move the parsing to this
      module, and introduce a type class to handle option types which
      support --help/--version. This allows removal of duplicated code from
      CLI.hs and Daemon.hs.
      
      The other part of the patch is cleanup/rework of the tests for this
      code: we introduce some helpers (checkOpt, passFailOpt,
      checkEarlyExit) that can be used from the much-slimmer now tests for
      CLI and Daemon. In the common module, we just test the yes/no helper
      we have. Many new tests for boolean options and numeric options are
      added.
      
      A side change is the removal of the obsolete `--replay-count',
      `--test-size' options (unused since commit 95f6c931
      
      , “Switch Haskell
      test harness to test-framework”).
      Signed-off-by: default avatarIustin Pop <iustin@google.com>
      Reviewed-by: default avatarRené Nussbaumer <rn@google.com>
      51000365
    • Iustin Pop's avatar
      Add query filter tests · 90171729
      Iustin Pop authored
      
      
      These tests are node specific only because we don't have other query
      types implemented yet, but what they actually test is the various
      filter types.
      
      The tests are trying to cover most filter functionality; missing for
      now is proper checking for ContainsFilter and TrueFilter, the rest
      should be more or less covered.
      Signed-off-by: default avatarIustin Pop <iustin@google.com>
      Reviewed-by: default avatarRené Nussbaumer <rn@google.com>
      90171729
    • Iustin Pop's avatar
      Add some unittests for node queries · b9bdc10e
      Iustin Pop authored
      
      
      These new tests check that:
      
      - no known fields return unknown
      - any unknown field returns unknown
      - the type of the fields is consistent between the getters and the
        field definition
      - the length of each result row corresponds with the number of fields
        queried, and the length of the field definitions returned
      - the length of the rows corresponds to the number of nodes
      - querying fields on empty fields returns all fields
      
      Finally this patch found a bug, in that the pinst_list/sinst_list
      fields were declared as QFTNumber (copy-paste error from
      pinst_cnt/sinst_cnt), yay!
      
      I also changed genEmptyCluster to ensure that it generates unique node
      names, so that the number of result rows is consistent with what we
      requested, and switched ResultEntry from a normal constructor to
      record syntax, so that we can extract the fields without having to use
      pattern matching.
      Signed-off-by: default avatarIustin Pop <iustin@google.com>
      Reviewed-by: default avatarRené Nussbaumer <rn@google.com>
      b9bdc10e
    • Iustin Pop's avatar
      Add entire ConfigData serialisation tests · 9924d61e
      Iustin Pop authored
      
      
      Using the recently-added genArbitrary, we can now implement Arbitrary
      instances for even "huge" objects like Cluster, so let's use that to
      implement entire ConfigData serialisation tests.
      
      Note that, as we don't have yet proper types for some of the Params
      fields, we have to cheat via FlexibleInstances and
      TypeSynonymInstances, using either empty items or real arbitrary
      values.
      Signed-off-by: default avatarIustin Pop <iustin@google.com>
      Reviewed-by: default avatarRené Nussbaumer <rn@google.com>
      9924d61e
    • Iustin Pop's avatar
      Add unittests for the BasicTypes module · 1493a93b
      Iustin Pop authored
      
      
      This adds test properties for the various laws that the instances of
      Result should follow; I could not find (offline) laws about `mappend',
      but otherwise I implemented all laws that I could find.
      
      Note that we have to silence hlint warnings for the things we want to
      test, as otherwise hlint is all "this is already true based on the
      functor law, why 'fmap id' and not just 'id'?".
      Signed-off-by: default avatarIustin Pop <iustin@google.com>
      Reviewed-by: default avatarRené Nussbaumer <rn@google.com>
      1493a93b
    • Iustin Pop's avatar
      Fixup test suite names · e09c1fa0
      Iustin Pop authored
      
      
      The names were not in a proper hierarchy, leading to inconsistencies
      about what they were actually tested.
      
      We change this by reproducing in the test names the relative hierarchy
      within the Ganeti directory, leading to nicer test suite names (in
      test-framework output).
      Signed-off-by: default avatarIustin Pop <iustin@google.com>
      Reviewed-by: default avatarRené Nussbaumer <rn@google.com>
      e09c1fa0
  26. 04 Sep, 2012 3 commits