summaryrefslogtreecommitdiffstats
path: root/tests/auto/network/access/qnetworkreply
diff options
context:
space:
mode:
authorRyan Chu <ryan.chu@qt.io>2019-01-25 22:48:29 +0100
committerLiang Qi <liang.qi@qt.io>2019-01-28 14:03:34 +0000
commit71cd5a6f3643a5369b883d0e36478693de6db024 (patch)
treeec3be7c85ddb8736ca23b9249047b2b6f518787a /tests/auto/network/access/qnetworkreply
parentd8d60696da8bbb168ac4554b51c96ea244e407b8 (diff)
Select single-name SSL certificate for test servers using host network
On Windows and macOS, the containers are deployed into a virtual machine using the host network. All the containers share the same hostname (qt-test-server), and they are connected to the same network domain (local). When running test in such platforms, use the single-name SSL certificate (qt-test-server.local) for SSL related tests. Change-Id: Idf33e01e8dd8814510d848b87b59b5fc0edc903e Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@qt.io>
Diffstat (limited to 'tests/auto/network/access/qnetworkreply')
-rw-r--r--tests/auto/network/access/qnetworkreply/certs/qt-test-server-host-network-cacert.pem16
-rw-r--r--tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp7
2 files changed, 23 insertions, 0 deletions
diff --git a/tests/auto/network/access/qnetworkreply/certs/qt-test-server-host-network-cacert.pem b/tests/auto/network/access/qnetworkreply/certs/qt-test-server-host-network-cacert.pem
new file mode 100644
index 0000000000..5bdce3a3f9
--- /dev/null
+++ b/tests/auto/network/access/qnetworkreply/certs/qt-test-server-host-network-cacert.pem
@@ -0,0 +1,16 @@
+-----BEGIN CERTIFICATE-----
+MIIClzCCAgACCQDeuuUc2HkfKDANBgkqhkiG9w0BAQQFADCBjzELMAkGA1UEChMC
+UXQxGTAXBgNVBAsTEENvcmUgQW5kIE5ldHdvcmsxGzAZBgkqhkiG9w0BCQEWDG5v
+Ym9keS5xdC5pbzENMAsGA1UEBxMET3NsbzENMAsGA1UECBMET3NsbzELMAkGA1UE
+BhMCTk8xHTAbBgNVBAMTFHF0LXRlc3Qtc2VydmVyLmxvY2FsMB4XDTE5MDEyNTE1
+NDE0N1oXDTQ5MDExNzE1NDE0N1owgY8xCzAJBgNVBAoTAlF0MRkwFwYDVQQLExBD
+b3JlIEFuZCBOZXR3b3JrMRswGQYJKoZIhvcNAQkBFgxub2JvZHkucXQuaW8xDTAL
+BgNVBAcTBE9zbG8xDTALBgNVBAgTBE9zbG8xCzAJBgNVBAYTAk5PMR0wGwYDVQQD
+ExRxdC10ZXN0LXNlcnZlci5sb2NhbDCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkC
+gYEAzarbb9Y0yafxwL7kQRgZ4gLJIuan1boDLp4oevRfGndfd6kRO49+8C7Gnus6
+2RLXwQxR6CRSPyPDQgwRxvIcoUL+tMJpg633cLEYFcwgKGIw8CwV5jMZr8PrHMCR
+9xFolFD4STcIMtc+dd+jvGkAFd7Nhw9cAmuCyAF9avAd3HMCAwEAATANBgkqhkiG
+9w0BAQQFAAOBgQB1dxK3Ia4sCpvSikKLaf1ZXu+9GKaNWKJe9bWex9/RmNOla9N2
+FIh6/CfaPFDy/OXCkyEiGg78iyg/DgqVoa9JJGV3diI6berisHMPJpv1syyz9YEU
+G3RQUClPcPV6EcedyqCdpbnIFtiSZbtJ0ZBGef4KzBN3rTmPucKb+bhMPg==
+-----END CERTIFICATE-----
diff --git a/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp b/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp
index 61f0f70ea7..0d6828797a 100644
--- a/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp
+++ b/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp
@@ -550,8 +550,15 @@ static void setupSslServer(QSslSocket* serverSocket)
}
#ifdef QT_TEST_SERVER
+#ifdef QT_TEST_SERVER_NAME
+// In this case, each server is assigned a unique hostname. Use the wildcard SSL
+// certificate (*.test-net.qt.local).
const QString tst_QNetworkReply::certsFilePath = "/certs/qt-test-net-cacert.pem";
#else
+// Otherwise, select the single-name SSL certificate (qt-test-server.local) instead.
+const QString tst_QNetworkReply::certsFilePath = "/certs/qt-test-server-host-network-cacert.pem";
+#endif // QT_TEST_SERVER_NAME
+#else
const QString tst_QNetworkReply::certsFilePath = "/certs/qt-test-server-cacert.pem";
#endif