changeset 1446:44973a23b031

Tests: loading "engine:..." keys with certificate variable.
author Sergey Kandaurov <pluknet@nginx.com>
date Thu, 28 Feb 2019 17:02:24 +0300
parents 889283abadf8
children e1c64ee44212
files ssl_engine_keys.t
diffstat 1 files changed, 22 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/ssl_engine_keys.t
+++ b/ssl_engine_keys.t
@@ -28,7 +28,7 @@ plan(skip_all => 'may not work, leaves c
 	unless $ENV{TEST_NGINX_UNSAFE};
 
 my $t = Test::Nginx->new()->has(qw/http proxy http_ssl/)->has_daemon('openssl')
-	->has_daemon('softhsm')->has_daemon('pkcs11-tool')->plan(1);
+	->has_daemon('softhsm')->has_daemon('pkcs11-tool');
 
 $t->write_file_expand('nginx.conf', <<'EOF');
 
@@ -53,9 +53,28 @@ http {
         location / {
             # index index.html by default
         }
+
         location /proxy {
             proxy_pass https://127.0.0.1:8081/;
         }
+
+        location /var {
+            proxy_pass https://127.0.0.1:8082/;
+            proxy_ssl_name localhost;
+            proxy_ssl_server_name on;
+        }
+    }
+
+    server {
+        listen       127.0.0.1:8082 ssl;
+        server_name  localhost;
+
+        ssl_certificate $ssl_server_name.crt;
+        ssl_certificate_key engine:pkcs11:slot_0-id_00;
+
+        location / {
+            # index index.html by default
+        }
     }
 }
 
@@ -118,12 +137,13 @@ foreach my $name ('localhost') {
 		or die "Can't create certificate for $name: $!\n";
 }
 
-$t->run();
+$t->try_run('no ssl_certificate variables')->plan(2);
 
 $t->write_file('index.html', '');
 
 ###############################################################################
 
 like(http_get('/proxy'), qr/200 OK/, 'ssl engine keys');
+like(http_get('/var'), qr/200 OK/, 'ssl_certificate with variable');
 
 ###############################################################################