Skip to content
  • Helga Velroyen's avatar
    Introduce (testutils) SSH file manager · b3465c03
    Helga Velroyen authored
    
    
    Testing the backend functions which update SSH keys is a
    pain and maintaining the tests even more. Therefore, this
    patch introduces a manager for all SSH key files of a
    clusters (ganeti_pub_keys and authorized_keys). It
    emulates all operations on these files for all nodes in
    the cluster.
    
    This has the following advantages:
    - One can query the state of the entire cluster in a
      consisten way, for example "Do all nodes have this
      master candidates' key?" instead of tediously evaluating
      a history of mock calls.
    - The file manager emulates both local changes in the
      master nodes' key files and changes on other nodes'
      key files using the ssh_update tool. This way, the
      state of the cluster ssh files is managed consistently
      no matter by what mechanism they were changed.
    - The file manager offers a couple of convenience
      functions to set up the test data and to query their
      state after test operation.
    
    Note that this might look like a lot of code, but it
    vastly simplifies the current unit tests and it will
    make future tests (for example for invalid calls) much
    more easier. As it is a test utility, it is properly
    documented to make it maintainable.
    
    Signed-off-by: default avatarHelga Velroyen <helgav@google.com>
    Reviewed-by: default avatarPetr Pudlak <pudlak@google.com>
    b3465c03