• 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>