Commit b3465c03 authored by Helga Velroyen's avatar Helga Velroyen

Introduce (testutils) SSH file manager

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>
parent ee51a40b
......@@ -1842,6 +1842,7 @@ python_test_support = \
test/py/__init__.py \
test/py/lockperf.py \
test/py/testutils.py \
test/py/testutils_ssh.py \
test/py/mocks.py \
test/py/cmdlib/__init__.py \
test/py/cmdlib/testsupport/__init__.py \
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment