1
0

better error messages in selftest

This commit is contained in:
Mike Schwörer 2020-01-20 18:00:30 +01:00
parent 2fc64df38e
commit a6f53c546e
Signed by: Mikescher
GPG Key ID: D3C7172E0A70F8CF
4 changed files with 13 additions and 10 deletions

View File

@ -854,7 +854,7 @@ html, body {
} }
.consistency_result { .consistency_result {
min-width: 400px; width: 500px;
color: #222222; color: #222222;
border: 1px solid #888; border: 1px solid #888;
padding: 0 5px; padding: 0 5px;

View File

@ -167,7 +167,7 @@ html,body{margin:0;padding:0;height:100%}
.kvl_100 div span:first-child{min-width:100px} .kvl_100 div span:first-child{min-width:100px}
.kvl_200 div span:first-child{min-width:200px} .kvl_200 div span:first-child{min-width:200px}
.kvl_300 div span:first-child{min-width:300px} .kvl_300 div span:first-child{min-width:300px}
.consistency_result{min-width:400px;color:#222;border:1px solid #888;padding:0 5px;margin:1px 0} .consistency_result{width:500px;color:#222;border:1px solid #888;padding:0 5px;margin:1px 0}
.consistency_result:after{content:" "} .consistency_result:after{content:" "}
.consistency_result_ok{background:#0f0} .consistency_result_ok{background:#0f0}
.consistency_result_warn{background:#ff0} .consistency_result_warn{background:#ff0}

View File

@ -42,7 +42,7 @@
.kvl_300 div span:first-child { min-width: 300px; } .kvl_300 div span:first-child { min-width: 300px; }
.consistency_result { .consistency_result {
min-width: 400px; width: 500px;
color: $COL_ADMIN_STATUS_FG; color: $COL_ADMIN_STATUS_FG;
border: $COL_ADMIN_STATUS_BORDER; border: $COL_ADMIN_STATUS_BORDER;
padding: 0 5px; padding: 0 5px;

View File

@ -190,6 +190,7 @@ class SelfTest implements IWebsiteModule
'exception' => null, 'exception' => null,
]; ];
$url = $_SERVER['HTTP_HOST'] . $path;
$r = curl_http_request($_SERVER['HTTP_HOST'] . $path); $r = curl_http_request($_SERVER['HTTP_HOST'] . $path);
if ($r['statuscode'] === $status) return if ($r['statuscode'] === $status) return
[ [
@ -203,7 +204,7 @@ class SelfTest implements IWebsiteModule
[ [
'result' => self::STATUS_ERROR, 'result' => self::STATUS_ERROR,
'message' => '{'.$xname.'} failed: Request returned wrong statuscode', 'message' => '{'.$xname.'} failed: Request returned wrong statuscode',
'long' => 'Wrong HTTP Statuscode (Expected: ['.$status.']; Found: ['.$r['statuscode'].'])' . "\n" . "Response:\n" . $r['output'] . "\nError [" . $r['errnum'] . "]:\n" . $r['errstr'], 'long' => 'Wrong HTTP Statuscode (Expected: ['.$status.']; Found: ['.$r['statuscode'].'])' . "\nURL: $url\n" . "Response:\n" . $r['output'] . "\nError [" . $r['errnum'] . "]:\n" . $r['errstr'],
'exception' => null, 'exception' => null,
]; ];
} }
@ -246,7 +247,8 @@ class SelfTest implements IWebsiteModule
$count = 0; $count = 0;
foreach ($supdata as $d) foreach ($supdata as $d)
{ {
$r = curl_http_request($_SERVER['HTTP_HOST'] . str_replace('{0}', $d, $path)); $url = $_SERVER['HTTP_HOST'] . str_replace('{0}', $d, $path);
$r = curl_http_request($url);
$count++; $count++;
if ($r['statuscode'] === $status) { $message .= "{".$xname."} succeeded" . "\n"; continue; } if ($r['statuscode'] === $status) { $message .= "{".$xname."} succeeded" . "\n"; continue; }
@ -254,7 +256,7 @@ class SelfTest implements IWebsiteModule
[ [
'result' => self::STATUS_ERROR, 'result' => self::STATUS_ERROR,
'message' => '{'.$xname.'} failed: Request returned wrong statuscode', 'message' => '{'.$xname.'} failed: Request returned wrong statuscode',
'long' => 'Wrong HTTP Statuscode (Expected: ['.$status.']; Found: ['.$r['statuscode'].'])' . "\n" . "Response:\n" . $r['output'] . "\nError [" . $r['errnum'] . "]:\n" . $r['errstr'], 'long' => 'Wrong HTTP Statuscode (Expected: ['.$status.']; Found: ['.$r['statuscode'].'])' . "\nURL: $url\n" . "Response:\n" . $r['output'] . "\nError [" . $r['errnum'] . "]:\n" . $r['errstr'],
'exception' => null, 'exception' => null,
]; ];
} }
@ -354,14 +356,15 @@ class SelfTest implements IWebsiteModule
'exception' => null, 'exception' => null,
]; ];
$r = curl_http_request($_SERVER['HTTP_HOST'] . $path); $url = $_SERVER['HTTP_HOST'] . $path;
$r = curl_http_request($url);
if ($r['statuscode'] !== $status) if ($r['statuscode'] !== $status)
{ {
return return
[ [
'result' => self::STATUS_ERROR, 'result' => self::STATUS_ERROR,
'message' => '{'.$xname.'} failed: Request returned wrong statuscode', 'message' => '{'.$xname.'} failed: Request returned wrong statuscode',
'long' => 'Wrong HTTP Statuscode (Expected: ['.$status.']; Found: ['.$r['statuscode'].'])' . "\n" . "Response:\n" . $r['output'] . "\nError [" . $r['errnum'] . "]:\n" . $r['errstr'], 'long' => 'Wrong HTTP Statuscode (Expected: ['.$status.']; Found: ['.$r['statuscode'].'])' . "\nURL: $url\n" . "Response:\n" . $r['output'] . "\nError [" . $r['errnum'] . "]:\n" . $r['errstr'],
'exception' => null, 'exception' => null,
]; ];
} }
@ -371,7 +374,7 @@ class SelfTest implements IWebsiteModule
[ [
'result' => self::STATUS_ERROR, 'result' => self::STATUS_ERROR,
'message' => '{'.$xname.'} failed: Request returned wrong statuscode', 'message' => '{'.$xname.'} failed: Request returned wrong statuscode',
'long' => "Wrong HTTP Response\nExpected:\n$json_expected\nFound:\n".$r['output'] . "\n" . "HTTP Statuscode:\n" . $r['statuscode'] . "\nError [" . $r['errnum'] . "]:\n" . $r['errstr'], 'long' => "Wrong HTTP Response\nExpected:\n$json_expected\nFound:\n".$r['output'] . "\nURL: $url\n" . "HTTP Statuscode:\n" . $r['statuscode'] . "\nError [" . $r['errnum'] . "]:\n" . $r['errstr'],
'exception' => null, 'exception' => null,
]; ];
} }
@ -551,7 +554,7 @@ class SelfTest implements IWebsiteModule
[ [
'result' => self::STATUS_ERROR, 'result' => self::STATUS_ERROR,
'message' => '{'.$xname.'} failed: Request returned wrong statuscode', 'message' => '{'.$xname.'} failed: Request returned wrong statuscode',
'long' => 'Wrong HTTP Statuscode (Expected: [200]; Found: ['.$r['statuscode'].'])' . "\n" . "Response:\n" . $r['output'] . "\n" . "Redirect:\n" . $r['redirect'] . "\nError [" . $r['errnum'] . "]:\n" . $r['errstr'], 'long' => 'Wrong HTTP Statuscode (Expected: [200]; Found: ['.$r['statuscode'].'])' . "\nURL: $url1 >> $url2\n" . "Response:\n" . $r['output'] . "\n" . "Redirect:\n" . $r['redirect'] . "\nError [" . $r['errnum'] . "]:\n" . $r['errstr'],
'exception' => null, 'exception' => null,
]; ];
} }