Add some unittests for node queries
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:Iustin Pop <iustin@google.com> Reviewed-by:
René Nussbaumer <rn@google.com>
Showing
- Makefile.am 1 addition, 0 deletionsMakefile.am
- htest/Test/Ganeti/Objects.hs 3 additions, 1 deletionhtest/Test/Ganeti/Objects.hs
- htest/Test/Ganeti/Query/Query.hs 153 additions, 0 deletionshtest/Test/Ganeti/Query/Query.hs
- htest/Test/Ganeti/TestCommon.hs 8 additions, 0 deletionshtest/Test/Ganeti/TestCommon.hs
- htest/test.hs 2 additions, 0 deletionshtest/test.hs
- htools/Ganeti/Query/Language.hs 4 additions, 2 deletionshtools/Ganeti/Query/Language.hs
- htools/Ganeti/Query/Node.hs 2 additions, 2 deletionshtools/Ganeti/Query/Node.hs
Loading
Please register or sign in to comment