changeset 480:5ac463ebf463

added a test for lua SetHttpTimeout
author Alain Mazy <am@osimis.io>
date Mon, 13 Jun 2022 16:55:45 +0200
parents 91d3dfdae90f
children e0b502b31a8a
files Database/Lua/HttpClient.lua GenerateConfigurationForTests.py
diffstat 2 files changed, 13 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/Database/Lua/HttpClient.lua	Tue May 10 12:17:30 2022 +0200
+++ b/Database/Lua/HttpClient.lua	Mon Jun 13 16:55:45 2022 +0200
@@ -45,6 +45,18 @@
 testSucceeded = testSucceeded and (response['headers']['Content-Type'] == 'application/json' and response['headers']['Toto'] == 'Tutu')
 if not testSucceeded then print('Failed in HttpGet') PrintRecursive(response) end
 
+
+-- Test SetHttpTimeout
+SetHttpTimeout(10)
+response = HttpGet('https://httpstat.us/200?sleep=1000')
+testSucceeded = testSucceeded and (response == '200 OK')
+if not testSucceeded then print('Failed in SetHttpTimeout1') PrintRecursive(response) end
+
+SetHttpTimeout(1)
+response = HttpGet('https://httpstat.us/200?sleep=2000')
+testSucceeded = testSucceeded and (response == nil)
+if not testSucceeded then print('Failed in SetHttpTimeout2') PrintRecursive(response) end
+
 if testSucceeded then
 	print('OK')
 else
--- a/GenerateConfigurationForTests.py	Tue May 10 12:17:30 2022 +0200
+++ b/GenerateConfigurationForTests.py	Mon Jun 13 16:55:45 2022 +0200
@@ -151,6 +151,7 @@
 config['WebDavUploadAllowed'] = True
 config['StorageCompression'] = args.compression
 config['CheckRevisions'] = True
+config['HttpsCACertificates'] = "/etc/ssl/certs/ca-certificates.crt"   # for HTTPS lua tests (note: this path is valid only on linux !)
 
 del config['DeidentifyLogsDicomVersion']
 del config['KeepAlive']