From 2d5bbf3a49aa5e46427d63c0eb4bc02d3240538f Mon Sep 17 00:00:00 2001
From: Lee Dong Wook <sh95119@gmail.com>
Date: Fri, 29 Jul 2022 11:46:07 +0900
Subject: [PATCH] pg_basebackup: add test for zstd coverage

---
 src/bin/pg_basebackup/t/010_pg_basebackup.pl | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/src/bin/pg_basebackup/t/010_pg_basebackup.pl b/src/bin/pg_basebackup/t/010_pg_basebackup.pl
index 3d1a4ddd5c0e..f83c5ceb5790 100644
--- a/src/bin/pg_basebackup/t/010_pg_basebackup.pl
+++ b/src/bin/pg_basebackup/t/010_pg_basebackup.pl
@@ -865,6 +865,24 @@
 	rmtree("$tempdir/backup_gzip3");
 }
 
+# Check ZSTD compression if available.
+SKIP:
+{
+	skip "postgres was not built with ZSTD support", 7
+	  if (!check_pg_config("#define USE_ZSTD 1"));
+
+	$node->command_ok(
+		[
+			@pg_basebackup_defs,    '-D',
+			"$tempdir/backup_zstd", '--compress',
+			'server-zstd',          '--compress',
+			'client-zstd',          '--wal-method',
+            'none',                 '--format',
+            't'
+		],
+		'pg_basebackup with --compress=ZSTD');
+}
+
 # Test background stream process terminating before the basebackup has
 # finished, the main process should exit gracefully with an error message on
 # stderr. To reduce the risk of timing related issues we invoke the base
