Merge pull request #10351 from owncloud/healthzCheck
[test-only] add test for checking service ready and health
This commit is contained in:
+40
@@ -94,6 +94,7 @@ config = {
|
||||
"graph": {
|
||||
"suites": [
|
||||
"apiGraph",
|
||||
"apiServiceAvailability",
|
||||
],
|
||||
"skip": False,
|
||||
"withRemotePhp": [True],
|
||||
@@ -180,6 +181,7 @@ config = {
|
||||
"NOTIFICATIONS_SMTP_PORT": "2500",
|
||||
"NOTIFICATIONS_SMTP_INSECURE": "true",
|
||||
"NOTIFICATIONS_SMTP_SENDER": "ownCloud <noreply@example.com>",
|
||||
"NOTIFICATIONS_DEBUG_ADDR": "0.0.0.0:9174",
|
||||
},
|
||||
},
|
||||
"antivirus": {
|
||||
@@ -194,6 +196,7 @@ config = {
|
||||
"POSTPROCESSING_STEPS": "virusscan",
|
||||
"OCIS_ASYNC_UPLOADS": True,
|
||||
"OCIS_ADD_RUN_SERVICES": "antivirus",
|
||||
"ANTIVIRUS_DEBUG_ADDR": "0.0.0.0:9297",
|
||||
},
|
||||
},
|
||||
"searchContent": {
|
||||
@@ -1029,6 +1032,7 @@ def localApiTests(ctx, name, suites, storage = "ocis", extra_environment = {}, w
|
||||
"UPLOAD_DELETE_WAIT_TIME": "1" if storage == "owncloud" else 0,
|
||||
"OCIS_WRAPPER_URL": "http://%s:5200" % OCIS_SERVER_NAME,
|
||||
"WITH_REMOTE_PHP": with_remote_php,
|
||||
"COLLABORATION_SERVICE_URL": "http://wopi-fakeoffice:9300",
|
||||
}
|
||||
|
||||
for item in extra_environment:
|
||||
@@ -2322,6 +2326,42 @@ def ocisServer(storage = "ocis", accounts_hash_difficulty = 4, volumes = [], dep
|
||||
"OCIS_JWT_SECRET": "some-ocis-jwt-secret",
|
||||
"EVENTHISTORY_STORE": "memory",
|
||||
"OCIS_TRANSLATION_PATH": "%s/tests/config/translations" % dirs["base"],
|
||||
# debug addresses required for running services health tests
|
||||
"ACTIVITYLOG_DEBUG_ADDR": "0.0.0.0:9197",
|
||||
"APP_PROVIDER_DEBUG_ADDR": "0.0.0.0:9165",
|
||||
"APP_REGISTRY_DEBUG_ADDR": "0.0.0.0:9243",
|
||||
"AUTH_BASIC_DEBUG_ADDR": "0.0.0.0:9147",
|
||||
"AUTH_MACHINE_DEBUG_ADDR": "0.0.0.0:9167",
|
||||
"AUTH_SERVICE_DEBUG_ADDR": "0.0.0.0:9198",
|
||||
"CLIENTLOG_DEBUG_ADDR": "0.0.0.0:9260",
|
||||
"EVENTHISTORY_DEBUG_ADDR": "0.0.0.0:9270",
|
||||
"FRONTEND_DEBUG_ADDR": "0.0.0.0:9141",
|
||||
"GATEWAY_DEBUG_ADDR": "0.0.0.0:9143",
|
||||
"GRAPH_DEBUG_ADDR": "0.0.0.0:9124",
|
||||
"GROUPS_DEBUG_ADDR": "0.0.0.0:9161",
|
||||
"IDM_DEBUG_ADDR": "0.0.0.0:9239",
|
||||
"IDP_DEBUG_ADDR": "0.0.0.0:9134",
|
||||
"INVITATIONS_DEBUG_ADDR": "0.0.0.0:9269",
|
||||
"NATS_DEBUG_ADDR": "0.0.0.0:9234",
|
||||
"OCDAV_DEBUG_ADDR": "0.0.0.0:9163",
|
||||
"OCM_DEBUG_ADDR": "0.0.0.0:9281",
|
||||
"OCS_DEBUG_ADDR": "0.0.0.0:9114",
|
||||
"POSTPROCESSING_DEBUG_ADDR": "0.0.0.0:9255",
|
||||
"PROXY_DEBUG_ADDR": "0.0.0.0:9205",
|
||||
"SEARCH_DEBUG_ADDR": "0.0.0.0:9224",
|
||||
"SETTINGS_DEBUG_ADDR": "0.0.0.0:9194",
|
||||
"SHARING_DEBUG_ADDR": "0.0.0.0:9151",
|
||||
"SSE_DEBUG_ADDR": "0.0.0.0:9139",
|
||||
"STORAGE_PUBLICLINK_DEBUG_ADDR": "0.0.0.0:9179",
|
||||
"STORAGE_SHARES_DEBUG_ADDR": "0.0.0.0:9156",
|
||||
"STORAGE_SYSTEM_DEBUG_ADDR": "0.0.0.0:9217",
|
||||
"STORAGE_USERS_DEBUG_ADDR": "0.0.0.0:9159",
|
||||
"THUMBNAILS_DEBUG_ADDR": "0.0.0.0:9189",
|
||||
"USERLOG_DEBUG_ADDR": "0.0.0.0:9214",
|
||||
"USERS_DEBUG_ADDR": "0.0.0.0:9145",
|
||||
"WEB_DEBUG_ADDR": "0.0.0.0:9104",
|
||||
"WEBDAV_DEBUG_ADDR": "0.0.0.0:9119",
|
||||
"WEBFINGER_DEBUG_ADDR": "0.0.0.0:9279",
|
||||
}
|
||||
|
||||
if deploy_type == "":
|
||||
|
||||
@@ -74,6 +74,16 @@ class OcisHelper {
|
||||
return 'https://localhost:10200';
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public static function getCollaborationServiceUrl(): string {
|
||||
if (\getenv("COLLABORATION_SERVICE_URL")) {
|
||||
return \getenv("COLLABORATION_SERVICE_URL");
|
||||
}
|
||||
return "http://localhost:9300";
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
|
||||
@@ -205,9 +205,14 @@ class AuthContext implements Context {
|
||||
* @throws Exception
|
||||
*/
|
||||
public function userRequestsEndpointsWithNoAuthentication(string $method, TableNode $table):void {
|
||||
$this->featureContext->verifyTableNodeColumns($table, ['endpoint']);
|
||||
$this->featureContext->verifyTableNodeColumns($table, ['endpoint'], ['service']);
|
||||
foreach ($table->getHash() as $row) {
|
||||
$this->featureContext->setResponse($this->sendRequest($row['endpoint'], $method));
|
||||
$this->featureContext->setResponse(
|
||||
$this->sendRequest(
|
||||
$this->featureContext->substituteInLineCodes($row['endpoint']),
|
||||
$method
|
||||
)
|
||||
);
|
||||
$this->featureContext->pushToLastStatusCodesArrays();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -728,6 +728,18 @@ class FeatureContext extends BehatVariablesContext {
|
||||
return $parsedUrl["host"] . ":" . $parsedUrl["port"];
|
||||
}
|
||||
|
||||
/**
|
||||
* removes the port from the ocis URL
|
||||
*
|
||||
* @param string $url
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function removeSchemeAndPortFromUrl(string $url): string {
|
||||
$parsedUrl = parse_url($url);
|
||||
return $parsedUrl["host"];
|
||||
}
|
||||
|
||||
/**
|
||||
* returns the base URL (which is without a slash at the end)
|
||||
*
|
||||
@@ -783,6 +795,24 @@ class FeatureContext extends BehatVariablesContext {
|
||||
return $this->removeSchemeFromUrl($this->getBaseUrl());
|
||||
}
|
||||
|
||||
/**
|
||||
* returns the base URL but without "http(s)://" and port
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getBaseUrlHostName(): string {
|
||||
return $this->removeSchemeAndPortFromUrl($this->getBaseUrl());
|
||||
}
|
||||
|
||||
/**
|
||||
* returns the base URL but without "http(s)://" and port
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getCollaborationHostName(): string {
|
||||
return $this->removeSchemeAndPortFromUrl(OcisHelper::getCollaborationServiceUrl());
|
||||
}
|
||||
|
||||
/**
|
||||
* returns the local base URL (which is without a slash at the end)
|
||||
*
|
||||
@@ -2178,6 +2208,22 @@ class FeatureContext extends BehatVariablesContext {
|
||||
],
|
||||
"parameter" => []
|
||||
],
|
||||
[
|
||||
"code" => "%base_url_hostname%",
|
||||
"function" => [
|
||||
$this,
|
||||
"getBaseUrlHostName"
|
||||
],
|
||||
"parameter" => []
|
||||
],
|
||||
[
|
||||
"code" => "%collaboration_hostname%",
|
||||
"function" => [
|
||||
$this,
|
||||
"getCollaborationHostName"
|
||||
],
|
||||
"parameter" => []
|
||||
],
|
||||
[
|
||||
"code" => "%remote_server%",
|
||||
"function" => [
|
||||
|
||||
@@ -416,6 +416,14 @@ default:
|
||||
- CollaborationContext:
|
||||
- TrashbinContext:
|
||||
|
||||
apiServiceAvailability:
|
||||
paths:
|
||||
- "%paths.base%/../features/apiServiceAvailability"
|
||||
context: *common_ldap_suite_context
|
||||
contexts:
|
||||
- FeatureContext: *common_feature_context_params
|
||||
- OcisConfigContext:
|
||||
|
||||
cliCommands:
|
||||
paths:
|
||||
- "%paths.base%/../features/cliCommands"
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
Feature: service health check
|
||||
|
||||
|
||||
Scenario: check service health
|
||||
When a user requests these endpoints with "GET" and no authentication
|
||||
| endpoint | service |
|
||||
| %base_url_hostname%:9297/healthz | antivirus |
|
||||
Then the HTTP status code of responses on all endpoints should be "200"
|
||||
|
||||
|
||||
Scenario: check service readiness
|
||||
When a user requests these endpoints with "GET" and no authentication
|
||||
| endpoint | service |
|
||||
| %base_url_hostname%:9297/readyz | antivirus |
|
||||
Then the HTTP status code of responses on all endpoints should be "200"
|
||||
@@ -0,0 +1,15 @@
|
||||
Feature: service health check
|
||||
|
||||
|
||||
Scenario: check service health
|
||||
When a user requests these endpoints with "GET" and no authentication
|
||||
| endpoint | service |
|
||||
| %collaboration_hostname%:9304/healthz | collaboration |
|
||||
Then the HTTP status code of responses on all endpoints should be "200"
|
||||
|
||||
|
||||
Scenario: check service readiness
|
||||
When a user requests these endpoints with "GET" and no authentication
|
||||
| endpoint | service |
|
||||
| %collaboration_hostname%:9304/readyz | collaboration |
|
||||
Then the HTTP status code of responses on all endpoints should be "200"
|
||||
@@ -0,0 +1,15 @@
|
||||
Feature: service health check
|
||||
|
||||
|
||||
Scenario: check service health
|
||||
When a user requests these endpoints with "GET" and no authentication
|
||||
| endpoint | service |
|
||||
| %base_url_hostname%:9174/healthz | notification |
|
||||
Then the HTTP status code of responses on all endpoints should be "200"
|
||||
|
||||
|
||||
Scenario: check service readiness
|
||||
When a user requests these endpoints with "GET" and no authentication
|
||||
| endpoint | service |
|
||||
| %base_url_hostname%:9174/readyz | notification |
|
||||
Then the HTTP status code of responses on all endpoints should be "200"
|
||||
@@ -0,0 +1,119 @@
|
||||
Feature: service health check
|
||||
|
||||
|
||||
Scenario: check default services health
|
||||
When a user requests these endpoints with "GET" and no authentication
|
||||
| endpoint | service |
|
||||
| %base_url_hostname%:9197/healthz | activitylog |
|
||||
| %base_url_hostname%:9165/healthz | app-provider |
|
||||
| %base_url_hostname%:9243/healthz | app-registry |
|
||||
| %base_url_hostname%:9147/healthz | auth-basic |
|
||||
| %base_url_hostname%:9167/healthz | auth-machine |
|
||||
| %base_url_hostname%:9198/healthz | auth-service |
|
||||
| %base_url_hostname%:9260/healthz | clientlog |
|
||||
| %base_url_hostname%:9270/healthz | eventhistory |
|
||||
| %base_url_hostname%:9141/healthz | frontend |
|
||||
| %base_url_hostname%:9143/healthz | gateway |
|
||||
| %base_url_hostname%:9124/healthz | graph |
|
||||
| %base_url_hostname%:9161/healthz | groups |
|
||||
| %base_url_hostname%:9239/healthz | idm |
|
||||
| %base_url_hostname%:9134/healthz | idp |
|
||||
| %base_url_hostname%:9234/healthz | nats |
|
||||
| %base_url_hostname%:9163/healthz | ocdav |
|
||||
| %base_url_hostname%:9281/healthz | ocm |
|
||||
| %base_url_hostname%:9114/healthz | ocs |
|
||||
| %base_url_hostname%:9255/healthz | postprocessing |
|
||||
| %base_url_hostname%:9205/healthz | proxy |
|
||||
| %base_url_hostname%:9224/healthz | search |
|
||||
| %base_url_hostname%:9194/healthz | settings |
|
||||
| %base_url_hostname%:9151/healthz | sharing |
|
||||
| %base_url_hostname%:9139/healthz | sse |
|
||||
| %base_url_hostname%:9179/healthz | storage-publiclink |
|
||||
| %base_url_hostname%:9156/healthz | storage-shares |
|
||||
| %base_url_hostname%:9217/healthz | storage-system |
|
||||
| %base_url_hostname%:9159/healthz | storage-users |
|
||||
| %base_url_hostname%:9189/healthz | thumbnails |
|
||||
| %base_url_hostname%:9214/healthz | userlog |
|
||||
| %base_url_hostname%:9145/healthz | users |
|
||||
| %base_url_hostname%:9104/healthz | web |
|
||||
| %base_url_hostname%:9119/healthz | webdav |
|
||||
| %base_url_hostname%:9279/healthz | webfinger |
|
||||
Then the HTTP status code of responses on all endpoints should be "200"
|
||||
|
||||
@env-config
|
||||
Scenario: check extra services health
|
||||
Given the following configs have been set:
|
||||
| config | value |
|
||||
| OCIS_ADD_RUN_SERVICES | audit,auth-app,auth-bearer,policies,invitations |
|
||||
| AUDIT_DEBUG_ADDR | 0.0.0.0:9229 |
|
||||
| AUTH_APP_DEBUG_ADDR | 0.0.0.0:9245 |
|
||||
| AUTH_BEARER_DEBUG_ADDR | 0.0.0.0:9149 |
|
||||
| POLICIES_DEBUG_ADDR | 0.0.0.0:9129 |
|
||||
| INVITATIONS_DEBUG_ADDR | 0.0.0.0:9269 |
|
||||
When a user requests these endpoints with "GET" and no authentication
|
||||
| endpoint | service |
|
||||
| %base_url_hostname%:9229/healthz | audit |
|
||||
| %base_url_hostname%:9245/healthz | auth-app |
|
||||
| %base_url_hostname%:9149/healthz | auth-bearer |
|
||||
| %base_url_hostname%:9269/healthz | invitations |
|
||||
| %base_url_hostname%:9129/healthz | policies |
|
||||
Then the HTTP status code of responses on all endpoints should be "200"
|
||||
|
||||
|
||||
Scenario: check default services readiness
|
||||
When a user requests these endpoints with "GET" and no authentication
|
||||
| endpoint | service |
|
||||
| %base_url_hostname%:9197/readyz | activitylog |
|
||||
| %base_url_hostname%:9165/readyz | app-provider |
|
||||
| %base_url_hostname%:9243/readyz | app-registry |
|
||||
| %base_url_hostname%:9147/readyz | auth-basic |
|
||||
| %base_url_hostname%:9167/readyz | auth-machine |
|
||||
| %base_url_hostname%:9198/readyz | auth-service |
|
||||
| %base_url_hostname%:9260/readyz | clientlog |
|
||||
| %base_url_hostname%:9270/readyz | eventhistory |
|
||||
| %base_url_hostname%:9141/readyz | frontend |
|
||||
| %base_url_hostname%:9143/readyz | gateway |
|
||||
| %base_url_hostname%:9124/readyz | graph |
|
||||
| %base_url_hostname%:9161/readyz | groups |
|
||||
| %base_url_hostname%:9239/readyz | idm |
|
||||
| %base_url_hostname%:9134/readyz | idp |
|
||||
| %base_url_hostname%:9234/readyz | nats |
|
||||
| %base_url_hostname%:9163/readyz | ocdav |
|
||||
| %base_url_hostname%:9281/readyz | ocm |
|
||||
| %base_url_hostname%:9114/readyz | ocs |
|
||||
| %base_url_hostname%:9255/readyz | postprocessing |
|
||||
| %base_url_hostname%:9205/readyz | proxy |
|
||||
| %base_url_hostname%:9224/readyz | search |
|
||||
| %base_url_hostname%:9194/readyz | settings |
|
||||
| %base_url_hostname%:9151/readyz | sharing |
|
||||
| %base_url_hostname%:9139/readyz | sse |
|
||||
| %base_url_hostname%:9179/readyz | storage-publiclink |
|
||||
| %base_url_hostname%:9156/readyz | storage-shares |
|
||||
| %base_url_hostname%:9217/readyz | storage-system |
|
||||
| %base_url_hostname%:9159/readyz | storage-users |
|
||||
| %base_url_hostname%:9189/readyz | thumbnails |
|
||||
| %base_url_hostname%:9214/readyz | userlog |
|
||||
| %base_url_hostname%:9145/readyz | users |
|
||||
| %base_url_hostname%:9104/readyz | web |
|
||||
| %base_url_hostname%:9119/readyz | webdav |
|
||||
| %base_url_hostname%:9279/readyz | webfinger |
|
||||
Then the HTTP status code of responses on all endpoints should be "200"
|
||||
|
||||
@env-config
|
||||
Scenario: check extra services readiness
|
||||
Given the following configs have been set:
|
||||
| config | value |
|
||||
| OCIS_ADD_RUN_SERVICES | audit,auth-app,auth-bearer,policies,invitations |
|
||||
| AUDIT_DEBUG_ADDR | 0.0.0.0:9229 |
|
||||
| AUTH_APP_DEBUG_ADDR | 0.0.0.0:9245 |
|
||||
| AUTH_BEARER_DEBUG_ADDR | 0.0.0.0:9149 |
|
||||
| POLICIES_DEBUG_ADDR | 0.0.0.0:9129 |
|
||||
| INVITATIONS_DEBUG_ADDR | 0.0.0.0:9269 |
|
||||
When a user requests these endpoints with "GET" and no authentication
|
||||
| endpoint | service |
|
||||
| %base_url_hostname%:9229/readyz | audit |
|
||||
| %base_url_hostname%:9245/readyz | auth-app |
|
||||
| %base_url_hostname%:9149/readyz | auth-bearer |
|
||||
| %base_url_hostname%:9269/readyz | invitations |
|
||||
| %base_url_hostname%:9129/readyz | policies |
|
||||
Then the HTTP status code of responses on all endpoints should be "200"
|
||||
Reference in New Issue
Block a user