diff lib/Test/Nginx.pm @ 621:884b2f0c173f

Tests: tests for dumped nginx configuration ("nginx -T").
author Sergey Kandaurov <pluknet@nginx.com>
date Mon, 01 Jun 2015 14:34:36 +0300
parents 7497adad1a50
children 0940773278c7
line wrap: on
line diff
--- a/lib/Test/Nginx.pm
+++ b/lib/Test/Nginx.pm
@@ -277,6 +277,20 @@ sub run(;$) {
 	return $self;
 }
 
+sub dump_config() {
+	my ($self) = @_;
+
+	my $testdir = $self->{_testdir};
+
+	my @globals = $self->{_test_globals} ?
+		() : ('-g', "pid $testdir/nginx.pid; "
+		. "error_log $testdir/error.log debug;");
+	my $command = "$NGINX -T -p $testdir/ -c nginx.conf "
+		. join(' ', @globals);
+
+	return qx/$command 2>&1/;
+}
+
 sub waitforfile($;$) {
 	my ($self, $file, $pid) = @_;
 	my $exited;