On Mon, Jul 6, 2015 at 10:21 PM, 'Lisa Velden' via ganeti-devel < [email protected]> wrote:
> This test is done with the newly introduced opcode 'gnt-debug > test-osparams'. Redaction of secret parameters within the job file is > also tested again with this opcode. > > Signed-off-by: Lisa Velden <[email protected]> > --- > qa/ganeti-qa.py | 1 + > qa/qa_instance.py | 13 +++++++++++++ > 2 files changed, 14 insertions(+) > > diff --git a/qa/ganeti-qa.py b/qa/ganeti-qa.py > index e537b70..bc6dd52 100755 > --- a/qa/ganeti-qa.py > +++ b/qa/ganeti-qa.py > @@ -1068,6 +1068,7 @@ def RunQa(): > RunTestIf("instance-add-osparams", qa_instance.TestInstanceAddOsParams, > [pnode]) > pnode.Release() > + RunTestIf("instance-add-osparams", qa_instance.TestOsParams) > > # Test removing instance with offline drbd secondary > if qa_config.TestEnabled(["instance-remove-drbd-offline", > diff --git a/qa/qa_instance.py b/qa/qa_instance.py > index 0321da9..91d4c78 100644 > --- a/qa/qa_instance.py > +++ b/qa/qa_instance.py > @@ -1539,6 +1539,19 @@ def TestInstanceAddOsParams(nodes): > instance.Release() > > > +def TestOsParams(): > Please improve this function name - it is not clear you are testing the transmission of secret params. Perhaps call it TestSecretOsParams, and add the missing docstring? The one-line docstring that gets output during the QA in this case. > + secret_keys = ["param1", "param2"] > + cmd = (["gnt-debug", "test-osparams", "--os-parameters-secret", > + "param1=secret1,param2=secret2", "--submit", "--print-jobid"]) > + _TestRedactionOfSecretOsParams(cmd, secret_keys) > + > + cmd_output = stdout_of(["gnt-debug", "test-osparams", > + "--os-parameters-secret", > + "param1=secret1,param2=secret2"]) > + AssertIn("\'param1\': \'secret1\'", cmd_output) > + AssertIn("\'param2\': \'secret2\'", cmd_output) > + > + > def _TestRedactionOfSecretOsParams(cmd, secret_keys): > """Tests redaction of secret os parameters""" > > -- > 2.4.3.573.g4eafbef > > Hrvoje Ribicic Ganeti Engineering Google Germany GmbH Dienerstr. 12, 80331, München Geschäftsführer: Graham Law, Christine Elizabeth Flores Registergericht und -nummer: Hamburg, HRB 86891 Sitz der Gesellschaft: Hamburg
