add test for checking service ready and health

This commit is contained in:
Viktor Scharf
2024-10-18 15:30:26 +02:00
committed by Prajwol Amatya
parent 46d397d74f
commit 18e0af90b7
7 changed files with 280 additions and 0 deletions

View File

@@ -88,6 +88,7 @@ config = {
"apiDepthInfinity",
"apiLocks",
"apiActivities",
"serviceAvailability",
],
"skip": False,
},
@@ -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": {
@@ -237,6 +240,7 @@ config = {
"collaborationServiceNeeded": True,
"extraServerEnvironment": {
"GATEWAY_GRPC_ADDR": "0.0.0.0:9142",
"COLLABORATION_DEBUG_ADDR": "0.0.0.0:9304",
},
},
"cliCommands": {
@@ -2322,6 +2326,39 @@ 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"],
"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",
"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:9135",
"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:9210",
"USERS_DEBUG_ADDR": "0.0.0.0:9145",
"WEB_DEBUG_ADDR": "0.0.0.0:9104",
"WEBDAV_DEBUG_ADDR": "0.0.0.0:9119",
}
if deploy_type == "":

View File

@@ -728,6 +728,24 @@ class FeatureContext extends BehatVariablesContext {
return $parsedUrl["host"] . ":" . $parsedUrl["port"];
}
/**
* removes the port rom the ocis URL
*
* @param string $url
*
* @return string
*/
public function removePortFromUrl(string $url): string {
return \str_replace(':9200', '', $url);
}
/**
* @return string
*/
public function getOcPath(): string {
return $this->ocPath;
}
/**
* returns the base URL (which is without a slash at the end)
*
@@ -783,6 +801,15 @@ class FeatureContext extends BehatVariablesContext {
return $this->removeSchemeFromUrl($this->getBaseUrl());
}
/**
* returns the base URL but without "http(s)://" and port
*
* @return string
*/
public function getBaseUrlWithoutSchemeAndPort(): string {
return $this->removePortFromUrl($this->removeSchemeFromUrl($this->getBaseUrl()));
}
/**
* returns the local base URL (which is without a slash at the end)
*
@@ -2178,6 +2205,14 @@ class FeatureContext extends BehatVariablesContext {
],
"parameter" => []
],
[
"code" => "%base_url_without_scheme_and_port%",
"function" => [
$this,
"getBaseUrlWithoutSchemeAndPort"
],
"parameter" => []
],
[
"code" => "%remote_server%",
"function" => [
@@ -2960,4 +2995,26 @@ class FeatureContext extends BehatVariablesContext {
}
return false;
}
/**
* @When a user requests these endpoints:
*
* @param TableNode $table
*
* @return void
* @throws Exception
*/
public function userRequestsEndpoints(TableNode $table): void {
$this->verifyTableNodeColumns($table, ['endpoint'], ['service', 'comment']);
foreach ($table->getHash() as $row) {
$this->setResponse(
HttpRequestHelper::sendRequest(
$this->substituteInLineCodes($row['endpoint']),
$this->getStepLineRef()
)
);
$this->pushToLastStatusCodesArrays();
}
}
}

View File

@@ -750,6 +750,14 @@ default:
- SharingNgContext:
- WebDavPropertiesContext:
- OcisConfigContext:
serviceAvailability:
paths:
- "%paths.base%/../features/serviceAvailability"
context: *common_ldap_suite_context
contexts:
- FeatureContext: *common_feature_context_params
- OcisConfigContext:
extensions:
rdx\behatvars\BehatVariablesExtension: ~

View File

@@ -0,0 +1,15 @@
Feature: service health check
Scenario: health check
When a user requests these endpoints:
| endpoint | service |
| %base_url_without_scheme_and_port%:9297/healthz | antivirus |
Then the HTTP status code of responses on all endpoints should be "200"
Scenario: ready check
When a user requests these endpoints:
| endpoint | service |
| %base_url_without_scheme_and_port%:9297/readyz | antivirus |
Then the HTTP status code of responses on all endpoints should be "200"

View File

@@ -0,0 +1,15 @@
Feature: service health check
Scenario: health check defauts service
When a user requests these endpoints:
| endpoint | service |
| %base_url_without_scheme_and_port%:9304/healthz | collaboration |
Then the HTTP status code of responses on all endpoints should be "200"
Scenario: service ready check
When a user requests these endpoints:
| endpoint | service |
| %base_url_without_scheme_and_port%:9304/readyz | collaboration |
Then the HTTP status code of responses on all endpoints should be "200"

View File

@@ -0,0 +1,15 @@
Feature: service health check
Scenario: health check
When a user requests these endpoints:
| endpoint | service |
| %base_url_without_scheme_and_port%:9174/healthz | notification |
Then the HTTP status code of responses on all endpoints should be "200"
Scenario: ready check
When a user requests these endpoints:
| endpoint | service |
| %base_url_without_scheme_and_port%:9174/readyz | notification |
Then the HTTP status code of responses on all endpoints should be "200"

View File

@@ -0,0 +1,133 @@
Feature: service health check
Scenario: health check defauts service
When a user requests these endpoints:
| endpoint | service | comment |
# | %base_url_without_scheme_and_port%:9197/healthz | activitylog | #get 500 |
# | %base_url_without_scheme_and_port%:9297/healthz | antivirus | checked in apiAntivirus suite |
| %base_url_without_scheme_and_port%:9165/healthz | app-provider | |
| %base_url_without_scheme_and_port%:9243/healthz | app-registry | |
# | %base_url_without_scheme_and_port%:9229/healthz | audit | extra |
# | %base_url_without_scheme_and_port%:9245/healthz | auth-app | extra |
| %base_url_without_scheme_and_port%:9147/healthz | auth-basic | |
# | %base_url_without_scheme_and_port%:9149/healthz | auth-bearer | extra |
| %base_url_without_scheme_and_port%:9167/healthz | auth-machine | |
| %base_url_without_scheme_and_port%:9198/healthz | auth-service | |
| %base_url_without_scheme_and_port%:9260/healthz | clientlog | |
# | %base_url_without_scheme_and_port%:9980/healthz | collaboration | checked in apiColaboration suite |
| %base_url_without_scheme_and_port%:9270/healthz | eventhistory | |
# | %base_url_without_scheme_and_port%:9141/healthz | frontend | #get 500 |
| %base_url_without_scheme_and_port%:9143/healthz | gateway | |
# | %base_url_without_scheme_and_port%:9124/healthz | graph | #get 500 |
| %base_url_without_scheme_and_port%:9161/healthz | groups | |
| %base_url_without_scheme_and_port%:9239/healthz | idm | |
# | %base_url_without_scheme_and_port%:9134/healthz | idp | #get 500 |
# | %base_url_without_scheme_and_port%:/healthz | invitations | #fix me need a proper port|
| %base_url_without_scheme_and_port%:9234/healthz | nats | |
# | %base_url_without_scheme_and_port%:9174/healthz | notifications | checked in apiNotification suite |
| %base_url_without_scheme_and_port%:9163/healthz | ocdav | |
# | %base_url_without_scheme_and_port%:9281/healthz | ocm | #get 500 should not be used by default |
# | %base_url_without_scheme_and_port%:9114/healthz | ocs | #get 500 |
# | %base_url_without_scheme_and_port%:9129/healthz | policies | extra |
| %base_url_without_scheme_and_port%:9255/healthz | postprocessing | |
# | %base_url_without_scheme_and_port%:9205/healthz | proxy | #get 500 |
| %base_url_without_scheme_and_port%:9224/healthz | search | |
# | %base_url_without_scheme_and_port%:9194/healthz | settings | #get 500 |
| %base_url_without_scheme_and_port%:9151/healthz | sharing | |
# | %base_url_without_scheme_and_port%:9135/healthz | sse | #get 500 |
| %base_url_without_scheme_and_port%:9179/healthz | storage-publiclink | |
| %base_url_without_scheme_and_port%:9156/healthz | storage-shares | |
| %base_url_without_scheme_and_port%:9217/healthz | storage-system | |
| %base_url_without_scheme_and_port%:9159/healthz | storage-users | |
# | %base_url_without_scheme_and_port%:/healthz | store | # deleted |
# | %base_url_without_scheme_and_port%:9189/healthz | thumbnails | #get 500 |
# | %base_url_without_scheme_and_port%:9210/healthz | userlog | #get 500 |
| %base_url_without_scheme_and_port%:9145/healthz | users | |
# | %base_url_without_scheme_and_port%:9104/healthz | web | #get 500 |
# | %base_url_without_scheme_and_port%:9119/healthz | webdav | #get 500 |
# | %base_url_without_scheme_and_port%:/healthz | webfinger | #fix me need a proper port |
Then the HTTP status code of responses on all endpoints should be "200"
@env-config
Scenario: health check extra services
Given the following configs have been set:
| config | value |
| OCIS_ADD_RUN_SERVICES | audit,auth-app,auth-bearer,policies |
| 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 |
When a user requests these endpoints:
| endpoint | service | comment |
| %base_url_without_scheme_and_port%:9229/healthz | audit | |
| %base_url_without_scheme_and_port%:9245/healthz | auth-app | |
# | %base_url_without_scheme_and_port%:9149/healthz | auth-bearer | donot work |
| %base_url_without_scheme_and_port%:9129/healthz | policies | |
Then the HTTP status code of responses on all endpoints should be "200"
Scenario: service ready check
When a user requests these endpoints:
| endpoint | service | comment |
# | %base_url_without_scheme_and_port%:9197/readyz | activitylog | #get 500 |
# | %base_url_without_scheme_and_port%:9297/readyz | antivirus | checked in apiAntivirus suite |
| %base_url_without_scheme_and_port%:9165/readyz | app-provider | |
| %base_url_without_scheme_and_port%:9243/readyz | app-registry | |
# | %base_url_without_scheme_and_port%:9229/readyz | audit | extra |
# | %base_url_without_scheme_and_port%:9245/readyz | auth-app | extra |
| %base_url_without_scheme_and_port%:9147/readyz | auth-basic | |
# | %base_url_without_scheme_and_port%:9149/readyz | auth-bearer | extra |
| %base_url_without_scheme_and_port%:9167/readyz | auth-machine | |
| %base_url_without_scheme_and_port%:9198/readyz | auth-service | |
# | %base_url_without_scheme_and_port%:9260/readyz | clientlog | #get 500 |
# | %base_url_without_scheme_and_port%:9980/readyz | collaboration | checked in apiColaboration suite |
# | %base_url_without_scheme_and_port%:9270/readyz | eventhistory | #get 500 |
# | %base_url_without_scheme_and_port%:9141/readyz | frontend | #get 500 |
| %base_url_without_scheme_and_port%:9143/readyz | gateway | |
# | %base_url_without_scheme_and_port%:9124/readyz | graph | #get 500 |
| %base_url_without_scheme_and_port%:9161/readyz | groups | |
| %base_url_without_scheme_and_port%:9239/readyz | idm | |
# | %base_url_without_scheme_and_port%:9134/readyz | idp | #get 500 |
# | %base_url_without_scheme_and_port%:/readyz | invitations |#fix me need a proper port|
| %base_url_without_scheme_and_port%:9234/readyz | nats | |
# | %base_url_without_scheme_and_port%:9174/readyz | notifications | checked in apiNotification suite |
| %base_url_without_scheme_and_port%:9163/readyz | ocdav | |
# | %base_url_without_scheme_and_port%:9281/readyz | ocm | should not be used by default |
# | %base_url_without_scheme_and_port%:9114/readyz | ocs | #get 500 |
# | %base_url_without_scheme_and_port%:9129/readyz | policies | extra |
| %base_url_without_scheme_and_port%:9255/readyz | postprocessing | |
# | %base_url_without_scheme_and_port%:9205/readyz | proxy | #get 500 |
# | %base_url_without_scheme_and_port%:9224/readyz | search | #get 500 |
# | %base_url_without_scheme_and_port%:9194/readyz | settings | #get 500 |
| %base_url_without_scheme_and_port%:9151/readyz | sharing | |
# | %base_url_without_scheme_and_port%:9135/readyz | sse | #get 500 |
| %base_url_without_scheme_and_port%:9179/readyz | storage-publiclink | |
| %base_url_without_scheme_and_port%:9156/readyz | storage-shares | |
| %base_url_without_scheme_and_port%:9217/readyz | storage-system | |
| %base_url_without_scheme_and_port%:9159/readyz | storage-users | |
# | %base_url_without_scheme_and_port%:/readyz | store | # deleted |
# | %base_url_without_scheme_and_port%:9189/readyz | thumbnails | #get 500 |
# | %base_url_without_scheme_and_port%:9210/readyz | userlog | #get 500 |
| %base_url_without_scheme_and_port%:9145/readyz | users | |
# | %base_url_without_scheme_and_port%:9104/readyz | web | #get 500 |
# | %base_url_without_scheme_and_port%:9119/readyz | webdav | #get 500 |
# | %base_url_without_scheme_and_port%:/readyz | webfinger | #fix me need a proper port |
Then the HTTP status code of responses on all endpoints should be "200"
@env-config
Scenario: health check extra services
Given the following configs have been set:
| config | value |
| OCIS_ADD_RUN_SERVICES | audit,auth-app,auth-bearer,policies |
| 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 |
When a user requests these endpoints:
| endpoint | service | comment |
| %base_url_without_scheme_and_port%:9229/readyz | audit | |
| %base_url_without_scheme_and_port%:9245/readyz | auth-app | |
# | %base_url_without_scheme_and_port%:9149/readyz | auth-bearer | donot work |
| %base_url_without_scheme_and_port%:9129/readyz | policies | |
Then the HTTP status code of responses on all endpoints should be "200"