File tree Expand file tree Collapse file tree 1 file changed +34
-0
lines changed Expand file tree Collapse file tree 1 file changed +34
-0
lines changed Original file line number Diff line number Diff line change @@ -21,6 +21,10 @@ $envs = [
21
21
'ATLAS_TLS12 ' ,
22
22
'ATLAS_SRV_TLS12 ' ,
23
23
];
24
+ $ x509Envs = [
25
+ 'ATLAS_X509 ' ,
26
+ 'ATLAS_X509_DEV ' ,
27
+ ];
24
28
25
29
$ command = new \MongoDB \Driver \Command (['ping ' => 1 ]);
26
30
$ query = new \MongoDB \Driver \Query ([]);
@@ -43,6 +47,34 @@ foreach ($envs as $env) {
43
47
echo "FAIL: " , $ e ->getMessage (), "\n" ;
44
48
}
45
49
}
50
+
51
+ foreach ($ x509Envs as $ env ) {
52
+ echo $ env , ': ' ;
53
+ $ uri = getenv ($ env );
54
+ $ cert = getenv ($ env . '_CERT_BASE64 ' );
55
+
56
+ if (! is_string ($ uri )) {
57
+ echo "FAIL: env var is undefined \n" ;
58
+ continue ;
59
+ }
60
+
61
+ if (! is_string ($ cert )) {
62
+ echo "FAIL: cert env var is undefined \n" ;
63
+ continue ;
64
+ }
65
+
66
+ file_put_contents ('/tmp/cert.pem ' , base64_decode ($ cert ));
67
+
68
+ try {
69
+ $ m = new \MongoDB \Driver \Manager ($ uri . '&tlsCertificateKeyFile=/tmp/cert.pem ' );
70
+ $ m ->executeCommand ('admin ' , $ command );
71
+ iterator_to_array ($ m ->executeQuery ('test.test ' , $ query ));
72
+ echo "PASS \n" ;
73
+ } catch (Exception $ e ) {
74
+ echo "FAIL: " , $ e ->getMessage (), "\n" ;
75
+ }
76
+ }
77
+
46
78
?>
47
79
===DONE===
48
80
<?php exit (0 ); ?>
@@ -59,4 +91,6 @@ ATLAS_TLS11: PASS
59
91
ATLAS_SRV_TLS11: PASS
60
92
ATLAS_TLS12: PASS
61
93
ATLAS_SRV_TLS12: PASS
94
+ ATLAS_X509: PASS
95
+ ATLAS_X509_DEV: PASS
62
96
===DONE===
You can’t perform that action at this time.
0 commit comments