update the scenarios for service availability check

This commit is contained in:
Prajwol Amatya
2024-11-26 17:03:49 +05:45
parent 15420a3d7b
commit 34dc52d426
9 changed files with 174 additions and 187 deletions

View File

@@ -88,13 +88,13 @@ config = {
"apiDepthInfinity",
"apiLocks",
"apiActivities",
"apiServiceAvailability",
],
"skip": False,
},
"graph": {
"suites": [
"apiGraph",
"apiServiceAvailability",
],
"skip": False,
"withRemotePhp": [True],
@@ -240,7 +240,6 @@ config = {
"collaborationServiceNeeded": True,
"extraServerEnvironment": {
"GATEWAY_GRPC_ADDR": "0.0.0.0:9142",
"COLLABORATION_DEBUG_ADDR": "0.0.0.0:9304",
},
},
"cliCommands": {
@@ -1033,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:
@@ -2341,6 +2341,7 @@ def ocisServer(storage = "ocis", accounts_hash_difficulty = 4, volumes = [], dep
"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",
@@ -2360,6 +2361,7 @@ def ocisServer(storage = "ocis", accounts_hash_difficulty = 4, volumes = [], dep
"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 == "":
@@ -3151,7 +3153,6 @@ def wopiCollaborationService(name):
"COLLABORATION_CS3API_DATAGATEWAY_INSECURE": "true",
"OCIS_JWT_SECRET": "some-ocis-jwt-secret",
"COLLABORATION_WOPI_SECRET": "some-wopi-secret",
"OCIS_ADD_RUN_SERVICES": "collaboration",
}
if name == "collabora":

View File

@@ -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
*/

View File

@@ -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();
}
}

View File

@@ -735,15 +735,9 @@ class FeatureContext extends BehatVariablesContext {
*
* @return string
*/
public function removePortFromUrl(string $url): string {
return \str_replace(':9200', '', $url);
}
/**
* @return string
*/
public function getOcPath(): string {
return $this->ocPath;
public function removeSchemeAndPortFromUrl(string $url): string {
$parsedUrl = parse_url($url);
return $parsedUrl["host"];
}
/**
@@ -806,8 +800,17 @@ class FeatureContext extends BehatVariablesContext {
*
* @return string
*/
public function getBaseUrlWithoutSchemeAndPort(): string {
return $this->removePortFromUrl($this->removeSchemeFromUrl($this->getBaseUrl()));
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());
}
/**
@@ -2206,10 +2209,18 @@ class FeatureContext extends BehatVariablesContext {
"parameter" => []
],
[
"code" => "%base_url_without_scheme_and_port%",
"code" => "%base_url_hostname%",
"function" => [
$this,
"getBaseUrlWithoutSchemeAndPort"
"getBaseUrlHostName"
],
"parameter" => []
],
[
"code" => "%collaboration_hostname%",
"function" => [
$this,
"getCollaborationHostName"
],
"parameter" => []
],
@@ -2995,26 +3006,4 @@ 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

@@ -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"
@@ -751,14 +759,6 @@ default:
- WebDavPropertiesContext:
- OcisConfigContext:
apiServiceAvailability:
paths:
- "%paths.base%/../features/apiServiceAvailability"
context: *common_ldap_suite_context
contexts:
- FeatureContext: *common_feature_context_params
- OcisConfigContext:
extensions:
rdx\behatvars\BehatVariablesExtension: ~

View File

@@ -2,14 +2,14 @@ Feature: service health check
Scenario: check service health
When a user requests these endpoints:
| endpoint | service |
| %base_url_without_scheme_and_port%:9297/healthz | antivirus |
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:
| endpoint | service |
| %base_url_without_scheme_and_port%:9297/readyz | antivirus |
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"

View File

@@ -1,19 +1,15 @@
Feature: service health check
@skip
Scenario: check service health
When a user requests these endpoints:
| endpoint | service | comment |
| wopi-onlyoffice:9304/healthz | collaboration | wopi-onlyoffice port 9304: Connection refused in CI |
| wopi-collabora:9304/healthz | collaboration | wopi-collabora port 9304: Connection refused in CI |
| wopi-fakeoffice:9304/healthz | collaboration | wopi-fakeoffice port 9304: Connection refused in CI |
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"
@skip
Scenario: check service readiness
When a user requests these endpoints:
| endpoint | service | comment |
| wopi-onlyoffice:9304/readyz | collaboration | wopi-onlyoffice port 9304: Connection refused in CI |
| wopi-collabora:9304/readyz | collaboration | wopi-collabora port 9304: Connection refused in CI |
| wopi-fakeoffice:9304/readyz | collaboration | wopi-fakeoffice port 9304: Connection refused in CI |
Then the HTTP status code of responses on all endpoints should be "200"
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"

View File

@@ -2,14 +2,14 @@ Feature: service health check
Scenario: check service health
When a user requests these endpoints:
| endpoint | service |
| %base_url_without_scheme_and_port%:9174/healthz | notification |
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:
| endpoint | service |
| %base_url_without_scheme_and_port%:9174/readyz | notification |
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"

View File

@@ -2,132 +2,118 @@ Feature: service health check
Scenario: check default services health
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%:9214/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 |
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 |
| 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 | |
| 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:
| 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%:9214/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 |
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 |
| 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 | |
| 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"