[check_postgres] [commit] Support both signature styles.

check_postgres at bucardo.org check_postgres at bucardo.org
Sun May 3 17:53:11 UTC 2009


Committed by Greg Sabino Mullane <greg at endpoint.com>

Support both signature styles.

---
 Makefile.PL      |    5 ++++-
 t/00_signature.t |   23 ++++++++++++++++++++++-
 2 files changed, 26 insertions(+), 2 deletions(-)

diff --git a/Makefile.PL b/Makefile.PL
index 3190c48..828c638 100644
--- a/Makefile.PL
+++ b/Makefile.PL
@@ -53,7 +53,7 @@ my %opts =
 	 NO_META        => 1,
      NORECURS       => 1,
      MAN1PODS       => {},
-	 clean          => { FILES => 'test_database_check_postgres/', '/tmp/cptesting_socket' },
+	 clean          => { FILES => 'test_database_check_postgres/ /tmp/cptesting_socket' },
 );
 
 {
@@ -61,6 +61,9 @@ my %opts =
 	sub clean {
 		my $string = shift->SUPER::clean(@_);
 		$string =~ s{\t}{\tperl t/99_cleanup\.t\n\t};
+		$string .= qq{\nsignature_asc : \n};
+		$string .= qq{\t@ gpg --yes -ba check_postgres.pl\n};
+		$string .= qq{\t@ gpg --verify check_postgres.pl.asc\n};
 		return $string;
 	}
 }
diff --git a/t/00_signature.t b/t/00_signature.t
index 3588614..74fbe7a 100644
--- a/t/00_signature.t
+++ b/t/00_signature.t
@@ -13,7 +13,7 @@ my $sigfile = 'check_postgres.pl.asc';
 if (!$ENV{TEST_SIGNATURE} and !$ENV{TEST_EVERYTHING}) {
 	plan skip_all => 'Set the environment variable TEST_SIGNATURE to enable this test';
 }
-plan tests => 1;
+plan tests => 2;
 
 SKIP: {
 	if ( !-e $sigfile ) {
@@ -32,3 +32,24 @@ SKIP: {
 		}
 	}
 }
+
+SKIP: {
+	if (!eval { require Module::Signature; 1 }) {
+		skip ('Must have Module::Signature to test SIGNATURE file', 1);
+	}
+	elsif ( !-e 'SIGNATURE' ) {
+		fail ('SIGNATURE file was not found');
+	}
+	elsif ( ! -s 'SIGNATURE') {
+		fail ('SIGNATURE file was empty');
+	}
+	else {
+		my $ret = Module::Signature::verify();
+		if ($ret eq Module::Signature::SIGNATURE_OK()) {
+			pass ('Valid SIGNATURE file');
+		}
+		else {
+			fail ('Invalid SIGNATURE file');
+		}
+	}
+}
-- 
1.6.0.5



More information about the Check_postgres mailing list