From bfd7f017594ed3d3a7ccd757f175d4eb9c7591c4 Mon Sep 17 00:00:00 2001
From: Daniel Gustafsson <daniel@yesql.se>
Date: Mon, 29 Jun 2020 20:59:41 +0200
Subject: [PATCH] Fix file removal in SSL tests

---
 src/test/ssl/t/001_ssltests.pl | 4 +++-
 src/test/ssl/t/002_scram.pl    | 3 +++
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/test/ssl/t/001_ssltests.pl b/src/test/ssl/t/001_ssltests.pl
index a454bb0274..7a18af70b7 100644
--- a/src/test/ssl/t/001_ssltests.pl
+++ b/src/test/ssl/t/001_ssltests.pl
@@ -52,9 +52,11 @@ foreach my $key (@keys)
 
 # Also make a copy of that explicitly world-readable.  We can't
 # necessarily rely on the file in the source tree having those
-# permissions.
+# permissions. Also make sure to add to @keys to include it in
+# the clean up phase.
 copy("ssl/client.key", "ssl/client_wrongperms_tmp.key");
 chmod 0644, "ssl/client_wrongperms_tmp.key";
+push @keys, 'client_wrongperms';
 
 #### Set up the server.
 
diff --git a/src/test/ssl/t/002_scram.pl b/src/test/ssl/t/002_scram.pl
index ee6e26d732..12a53a390c 100644
--- a/src/test/ssl/t/002_scram.pl
+++ b/src/test/ssl/t/002_scram.pl
@@ -99,4 +99,7 @@ test_connect_fails(
 	qr/channel binding required, but server authenticated client without channel binding/,
 	"Cert authentication and channel_binding=require");
 
+# clean up
+unlink("ssl/client_tmp.key");
+
 done_testing($number_of_tests);
-- 
2.21.1 (Apple Git-122.3)

