From 4176c1db12ffc7e9d98eff1f3b8b8278c229e508 Mon Sep 17 00:00:00 2001 From: Brian Cox Date: Wed, 28 Jun 2017 20:05:52 -0700 Subject: [PATCH] Add a new test-harness test to exercise twadmin change-passphrases mode --- src/test-harness/tests/chpass.pm | 84 ++++++++++++++++++++++++++++++++ 1 file changed, 84 insertions(+) create mode 100644 src/test-harness/tests/chpass.pm diff --git a/src/test-harness/tests/chpass.pm b/src/test-harness/tests/chpass.pm new file mode 100644 index 0000000..3e201f2 --- /dev/null +++ b/src/test-harness/tests/chpass.pm @@ -0,0 +1,84 @@ + +use twtools; + +package chpass; + +###################################################################### +# One time module initialization goes in here... +# +BEGIN { + $description = "change passphrases test"; +} + +###################################################################### +# +# Initialize, get ready to run this test... +# +sub initialize() { + +} + + +###################################################################### +# +# Run the test. +# +sub run() { + + my $twpassed = 1; + my $newpass = "password"; + + twtools::logStatus("*** Beginning $description\n"); + printf("%-30s", "-- $description"); + + + twtools::logStatus(`$twtools::twrootdir/bin/twadmin --change-passphrases -S $twtools::twrootdir/$twtools::twsitekeyloc --site-passphrase $newpass --site-passphrase-old $twtools::twsitepass`); + if ( $? != 0 ) { + twtools::logStatus("first change site passphrase failed\n"); + $twpassed = 0; + } + + twtools::logStatus(`$twtools::twrootdir/bin/twadmin --change-passphrases -S $twtools::twrootdir/$twtools::twsitekeyloc --site-passphrase $twtools::twsitepass --site-passphrase-old $newpass`); + if ( $? != 0 ) { + twtools::logStatus("second change site passphrase failed\n"); + $twpassed = 0; + } + + twtools::logStatus(`$twtools::twrootdir/bin/twadmin --change-passphrases -L $twtools::twrootdir/$twtools::twlocalkeyloc --local-passphrase $newpass --local-passphrase-old $twtools::twlocalpass`); + if ( $? != 0 ) { + twtools::logStatus("first change local passphrase failed\n"); + $twpassed = 0; + } + + twtools::logStatus(`$twtools::twrootdir/bin/twadmin --change-passphrases -L $twtools::twrootdir/$twtools::twlocalkeyloc --local-passphrase $twtools::twlocalpass --local-passphrase-old $newpass`); + if ( $? != 0 ) { + twtools::logStatus("second change local passphrase failed\n"); + $twpassed = 0; + } + + + ######################################################### + # + # See if the tests all succeeded... + # + if ($twpassed) { + ++$twtools::twpassedtests; + print "PASSED\n"; + return 1; + } + else { + ++$twtools::twfailedtests; + print "*FAILED*\n"; + return 0; + } +} + + + +###################################################################### +# One time module cleanup goes in here... +# +END { +} + +1;