diff --git a/src/bin/pg_basebackup/t/040_pg_createsubscriber.pl b/src/bin/pg_basebackup/t/040_pg_createsubscriber.pl
index 7e275473eb9..9355cb0ade9 100644
--- a/src/bin/pg_basebackup/t/040_pg_createsubscriber.pl
+++ b/src/bin/pg_basebackup/t/040_pg_createsubscriber.pl
@@ -419,12 +419,6 @@ command_fails_like(
 	qr/--publication cannot be used with --all/,
 	'fail if --publication is used with --all');
 
-# Create a new database on node_p
-$node_p->safe_psql(
-	"postgres", qq(
-	CREATE DATABASE db1;
-));
-
 # run pg_createsubscriber with '--all' option
 my ($stdout, $stderr) = run_command(
 	[
@@ -440,20 +434,14 @@ my ($stdout, $stderr) = run_command(
 	],
 	'run pg_createsubscriber with --all');
 
-like(
-	$stderr,
-	qr/.*pg_createsubscriber: creating publication .* in database \"postgres\"/,
-	"expanded commands for all databases");
-like(
-	$stderr,
-	qr/.*pg_createsubscriber: creating publication .* in database \"db1\"/,
-	"expanded commands for all databases");
-
-# Drop the newly created database on node_p
-$node_p->safe_psql(
-	"postgres", qq(
-	DROP DATABASE db1;
-));
+# Verify that the required logical replication objects are created. The
+# expected count 3 refers to postgres, $db1 and $db2 databases.
+is(scalar(() = $stderr =~ /creating publication/g),
+	3, "verify publications are created for all databases");
+is(scalar(() = $stderr =~ /creating the replication slot/g),
+	3, "verify replication slots are created for all databases");
+is(scalar(() = $stderr =~ /creating subscription/g),
+	3, "verify subscriptions are created for all databases");
 
 # Run pg_createsubscriber on node S.  --verbose is used twice
 # to show more information.
