commit e93fcfd43fc18f74a2f03ae3eeace2ad064158bd
Author: Ian Barwick <ian@2ndquadrant.com>
Date:   Tue Jul 16 16:41:57 2019 +0900

    Add TAP test to disallow empty includes

diff --git a/src/test/configuration/t/001_disallow-empty-include-directives.pl b/src/test/configuration/t/001_disallow-empty-include-directives.pl
new file mode 100644
index 0000000000..3c21732c13
--- /dev/null
+++ b/src/test/configuration/t/001_disallow-empty-include-directives.pl
@@ -0,0 +1,72 @@
+# Test that empty include directives are disallowed
+
+use strict;
+use warnings;
+use PostgresNode;
+use TestLib;
+use Test::More tests => 3;
+
+our $postgresql_conf = 'postgresql.conf';
+
+
+our ($expected, $result, $config_line);
+
+# Initialize a single node
+# ------------------------
+
+my $node = get_new_node('primary');
+$node->init();
+$node->start;
+
+# Get number of lines in current postgresql.conf
+my $conf = $node->read_conf($postgresql_conf);
+my @conf = split("\n", $conf);
+my $conf_lines = scalar @conf;
+
+my $include = <<'EO_CONF';
+include = ''
+include_if_exists = ''
+include_dir = ''
+EO_CONF
+
+$node->append_conf($postgresql_conf, $include);
+
+
+# 1. Check "include" directive
+# ----------------------------
+
+$config_line = $conf_lines + 1;
+
+$result = $node->safe_psql('postgres',
+						   "SELECT error FROM pg_catalog.pg_file_settings WHERE sourceline = $config_line");
+
+is($result,
+   '"include" must not be empty',
+   'Check "include" directive (filename only)');
+
+
+# 2. Check "include_if_exists" directive
+# ---------------------------------------
+
+$config_line = $conf_lines + 2;
+
+$result = $node->safe_psql('postgres',
+						   "SELECT error FROM pg_catalog.pg_file_settings WHERE sourceline = $config_line");
+
+is($result,
+   '"include_if_exists" must not be empty',
+   'Check "include" directive (filename only)');
+
+
+# 3. Check "include_dir" directive
+# --------------------------------
+
+$config_line = $conf_lines + 3;
+
+$result = $node->safe_psql('postgres',
+						   "SELECT error FROM pg_catalog.pg_file_settings WHERE sourceline = $config_line");
+
+is($result,
+   '"include_dir" must not be empty',
+   'Check "include" directive (filename only)');
+
