Commit 502f5236 authored by Michael Hanselmann's avatar Michael Hanselmann
Browse files

QA: Restore RAPI cert after “gnt-cluster renew-crypto”



The RAPI tests will depend on the certificate.
Signed-off-by: default avatarMichael Hanselmann <hansmi@google.com>
Reviewed-by: default avatarIustin Pop <iustin@google.com>
parent 49d50e52
......@@ -182,32 +182,45 @@ def TestClusterRenewCrypto():
AssertNotEqual(StartSSH(master["primary"],
utils.ShellQuoteArgs(cmd)).wait(), 0)
# Custom RAPI certificate
fh = tempfile.NamedTemporaryFile()
rapi_cert_backup = qa_utils.BackupFile(master["primary"],
constants.RAPI_CERT_FILE)
try:
# Custom RAPI certificate
fh = tempfile.NamedTemporaryFile()
# Ensure certificate doesn't cause "gnt-cluster verify" to complain
validity = constants.SSL_CERT_EXPIRATION_WARN * 3
# Ensure certificate doesn't cause "gnt-cluster verify" to complain
validity = constants.SSL_CERT_EXPIRATION_WARN * 3
bootstrap.GenerateSelfSignedSslCert(fh.name, validity=validity)
bootstrap.GenerateSelfSignedSslCert(fh.name, validity=validity)
tmpcert = qa_utils.UploadFile(master["primary"], fh.name)
try:
tmpcert = qa_utils.UploadFile(master["primary"], fh.name)
try:
cmd = ["gnt-cluster", "renew-crypto", "--force",
"--rapi-certificate=%s" % tmpcert]
AssertEqual(StartSSH(master["primary"],
utils.ShellQuoteArgs(cmd)).wait(), 0)
finally:
cmd = ["rm", "-f", tmpcert]
AssertEqual(StartSSH(master["primary"],
utils.ShellQuoteArgs(cmd)).wait(), 0)
# Normal case
cmd = ["gnt-cluster", "renew-crypto", "--force",
"--new-cluster-certificate", "--new-confd-hmac-key",
"--new-rapi-certificate"]
AssertEqual(StartSSH(master["primary"],
utils.ShellQuoteArgs(cmd)).wait(), 0)
# Restore RAPI certificate
cmd = ["gnt-cluster", "renew-crypto", "--force",
"--rapi-certificate=%s" % tmpcert]
"--rapi-certificate=%s" % rapi_cert_backup]
AssertEqual(StartSSH(master["primary"],
utils.ShellQuoteArgs(cmd)).wait(), 0)
finally:
cmd = ["rm", "-f", tmpcert]
cmd = ["rm", "-f", rapi_cert_backup]
AssertEqual(StartSSH(master["primary"],
utils.ShellQuoteArgs(cmd)).wait(), 0)
# Normal case
cmd = ["gnt-cluster", "renew-crypto", "--force",
"--new-cluster-certificate", "--new-confd-hmac-key",
"--new-rapi-certificate"]
AssertEqual(StartSSH(master["primary"],
utils.ShellQuoteArgs(cmd)).wait(), 0)
def TestClusterBurnin():
"""Burnin"""
......
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