Skip to content

Commit 8a522b9

Browse files
Merge pull request #10808 from owncloud/santizeServiceUrlInTests
[full-ci][tests-only] Refactor service health and ready url in tests
2 parents 3011eaa + acc993a commit 8a522b9

File tree

6 files changed

+147
-106
lines changed

6 files changed

+147
-106
lines changed

tests/acceptance/bootstrap/AuthContext.php

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ public function userRequestsEndpointsWithoutBodyAndNoAuthAboutUser(
213213
* @throws Exception
214214
*/
215215
public function userRequestsEndpointsWithNoAuthentication(string $method, TableNode $table): void {
216-
$this->featureContext->verifyTableNodeColumns($table, ['endpoint'], ['service']);
216+
$this->featureContext->verifyTableNodeColumns($table, ['endpoint']);
217217
foreach ($table->getHash() as $row) {
218218
$this->featureContext->setResponse(
219219
$this->sendRequest(
@@ -225,6 +225,29 @@ public function userRequestsEndpointsWithNoAuthentication(string $method, TableN
225225
}
226226
}
227227

228+
/**
229+
* @When a user requests these URLs with :method and no authentication
230+
*
231+
* @param $method
232+
* @param TableNode $table
233+
*
234+
* @return void
235+
* @throws Exception
236+
*/
237+
public function aUserRequestsTheseUrlsWithAndNoAuthentication($method, TableNode $table): void {
238+
$this->featureContext->verifyTableNodeColumns($table, ['endpoint'], ['service']);
239+
foreach ($table->getHash() as $row) {
240+
$this->featureContext->setResponse(
241+
HttpRequestHelper::sendRequest(
242+
$this->featureContext->substituteInLineCodes($row['endpoint']),
243+
$this->featureContext->getStepLineRef(),
244+
$method
245+
)
246+
);
247+
$this->featureContext->pushToLastStatusCodesArrays();
248+
}
249+
}
250+
228251
/**
229252
* @When the user :user requests these endpoints with :method with basic auth
230253
*

tests/acceptance/expected-failures-localAPI-on-OCIS-storage.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -322,5 +322,9 @@ The expected failures in this file are from features in the owncloud/ocis repo.
322322

323323
- [apiSharingNg1/propfindShares.feature:149](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSharingNg1/propfindShares.feature#L149)
324324

325+
#### [Readiness check for some services returns 500 status code](https://github.com/owncloud/ocis/issues/10661)
326+
- [apiServiceAvailability/serviceAvailabilityCheck.feature:116](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiServiceAvailability/serviceAvailabilityCheck.feature#L116)
327+
- [apiServiceAvailability/serviceAvailabilityCheck.feature:125](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiServiceAvailability/serviceAvailabilityCheck.feature#L125)
328+
325329
Note: always have an empty line at the end of this file.
326330
The bash script that processes this file requires that the last line has a newline on the end.

tests/acceptance/features/apiAntivirus/serviceAvailabilityCheck.feature

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@ Feature: service health check
22

33

44
Scenario: check service health
5-
When a user requests these endpoints with "GET" and no authentication
6-
| endpoint | service |
7-
| %base_url_hostname%:9297/healthz | antivirus |
5+
When a user requests these URLs with "GET" and no authentication
6+
| endpoint | service |
7+
| http://%base_url_hostname%:9297/healthz | antivirus |
88
Then the HTTP status code of responses on all endpoints should be "200"
99

1010

1111
Scenario: check service readiness
12-
When a user requests these endpoints with "GET" and no authentication
13-
| endpoint | service |
14-
| %base_url_hostname%:9297/readyz | antivirus |
12+
When a user requests these URLs with "GET" and no authentication
13+
| endpoint | service |
14+
| http://%base_url_hostname%:9297/readyz | antivirus |
1515
Then the HTTP status code of responses on all endpoints should be "200"

tests/acceptance/features/apiCollaboration/serviceAvailabilityCheck.feature

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@ Feature: service health check
22

33

44
Scenario: check service health
5-
When a user requests these endpoints with "GET" and no authentication
6-
| endpoint | service |
7-
| %collaboration_hostname%:9304/healthz | collaboration |
5+
When a user requests these URLs with "GET" and no authentication
6+
| endpoint | service |
7+
| http://%collaboration_hostname%:9304/healthz | collaboration |
88
Then the HTTP status code of responses on all endpoints should be "200"
99

1010

1111
Scenario: check service readiness
12-
When a user requests these endpoints with "GET" and no authentication
13-
| endpoint | service |
14-
| %collaboration_hostname%:9304/readyz | collaboration |
12+
When a user requests these URLs with "GET" and no authentication
13+
| endpoint | service |
14+
| http://%collaboration_hostname%:9304/readyz | collaboration |
1515
Then the HTTP status code of responses on all endpoints should be "200"

tests/acceptance/features/apiNotification/serviceAvailabilityCheck.feature

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@ Feature: service health check
22

33

44
Scenario: check service health
5-
When a user requests these endpoints with "GET" and no authentication
6-
| endpoint | service |
7-
| %base_url_hostname%:9174/healthz | notification |
5+
When a user requests these URLs with "GET" and no authentication
6+
| endpoint | service |
7+
| http://%base_url_hostname%:9174/healthz | notification |
88
Then the HTTP status code of responses on all endpoints should be "200"
99

1010

1111
Scenario: check service readiness
12-
When a user requests these endpoints with "GET" and no authentication
13-
| endpoint | service |
14-
| %base_url_hostname%:9174/readyz | notification |
12+
When a user requests these URLs with "GET" and no authentication
13+
| endpoint | service |
14+
| http://%base_url_hostname%:9174/readyz | notification |
1515
Then the HTTP status code of responses on all endpoints should be "200"

tests/acceptance/features/apiServiceAvailability/serviceAvailabilityCheck.feature

Lines changed: 101 additions & 87 deletions
Original file line numberDiff line numberDiff line change
@@ -2,42 +2,42 @@ Feature: service health check
22

33

44
Scenario: check default services health
5-
When a user requests these endpoints with "GET" and no authentication
6-
| endpoint | service |
7-
| %base_url_hostname%:9197/healthz | activitylog |
8-
| %base_url_hostname%:9165/healthz | app-provider |
9-
| %base_url_hostname%:9243/healthz | app-registry |
10-
| %base_url_hostname%:9147/healthz | auth-basic |
11-
| %base_url_hostname%:9167/healthz | auth-machine |
12-
| %base_url_hostname%:9198/healthz | auth-service |
13-
| %base_url_hostname%:9260/healthz | clientlog |
14-
| %base_url_hostname%:9270/healthz | eventhistory |
15-
| %base_url_hostname%:9141/healthz | frontend |
16-
| %base_url_hostname%:9143/healthz | gateway |
17-
| %base_url_hostname%:9124/healthz | graph |
18-
| %base_url_hostname%:9161/healthz | groups |
19-
| %base_url_hostname%:9239/healthz | idm |
20-
| %base_url_hostname%:9134/healthz | idp |
21-
| %base_url_hostname%:9234/healthz | nats |
22-
| %base_url_hostname%:9163/healthz | ocdav |
23-
| %base_url_hostname%:9281/healthz | ocm |
24-
| %base_url_hostname%:9114/healthz | ocs |
25-
| %base_url_hostname%:9255/healthz | postprocessing |
26-
| %base_url_hostname%:9205/healthz | proxy |
27-
| %base_url_hostname%:9224/healthz | search |
28-
| %base_url_hostname%:9194/healthz | settings |
29-
| %base_url_hostname%:9151/healthz | sharing |
30-
| %base_url_hostname%:9139/healthz | sse |
31-
| %base_url_hostname%:9179/healthz | storage-publiclink |
32-
| %base_url_hostname%:9156/healthz | storage-shares |
33-
| %base_url_hostname%:9217/healthz | storage-system |
34-
| %base_url_hostname%:9159/healthz | storage-users |
35-
| %base_url_hostname%:9189/healthz | thumbnails |
36-
| %base_url_hostname%:9214/healthz | userlog |
37-
| %base_url_hostname%:9145/healthz | users |
38-
| %base_url_hostname%:9104/healthz | web |
39-
| %base_url_hostname%:9119/healthz | webdav |
40-
| %base_url_hostname%:9279/healthz | webfinger |
5+
When a user requests these URLs with "GET" and no authentication
6+
| endpoint | service |
7+
| http://%base_url_hostname%:9197/healthz | activitylog |
8+
| http://%base_url_hostname%:9165/healthz | app-provider |
9+
| http://%base_url_hostname%:9243/healthz | app-registry |
10+
| http://%base_url_hostname%:9147/healthz | auth-basic |
11+
| http://%base_url_hostname%:9167/healthz | auth-machine |
12+
| http://%base_url_hostname%:9198/healthz | auth-service |
13+
| http://%base_url_hostname%:9260/healthz | clientlog |
14+
| http://%base_url_hostname%:9270/healthz | eventhistory |
15+
| http://%base_url_hostname%:9141/healthz | frontend |
16+
| http://%base_url_hostname%:9143/healthz | gateway |
17+
| http://%base_url_hostname%:9124/healthz | graph |
18+
| http://%base_url_hostname%:9161/healthz | groups |
19+
| http://%base_url_hostname%:9239/healthz | idm |
20+
| http://%base_url_hostname%:9134/healthz | idp |
21+
| http://%base_url_hostname%:9234/healthz | nats |
22+
| http://%base_url_hostname%:9163/healthz | ocdav |
23+
| http://%base_url_hostname%:9281/healthz | ocm |
24+
| http://%base_url_hostname%:9114/healthz | ocs |
25+
| http://%base_url_hostname%:9255/healthz | postprocessing |
26+
| http://%base_url_hostname%:9205/healthz | proxy |
27+
| http://%base_url_hostname%:9224/healthz | search |
28+
| http://%base_url_hostname%:9194/healthz | settings |
29+
| http://%base_url_hostname%:9151/healthz | sharing |
30+
| http://%base_url_hostname%:9139/healthz | sse |
31+
| http://%base_url_hostname%:9179/healthz | storage-publiclink |
32+
| http://%base_url_hostname%:9156/healthz | storage-shares |
33+
| http://%base_url_hostname%:9217/healthz | storage-system |
34+
| http://%base_url_hostname%:9159/healthz | storage-users |
35+
| http://%base_url_hostname%:9189/healthz | thumbnails |
36+
| http://%base_url_hostname%:9214/healthz | userlog |
37+
| http://%base_url_hostname%:9145/healthz | users |
38+
| http://%base_url_hostname%:9104/healthz | web |
39+
| http://%base_url_hostname%:9119/healthz | webdav |
40+
| http://%base_url_hostname%:9279/healthz | webfinger |
4141
Then the HTTP status code of responses on all endpoints should be "200"
4242

4343
@env-config
@@ -47,56 +47,51 @@ Feature: service health check
4747
| OCIS_ADD_RUN_SERVICES | audit,auth-app,auth-bearer,policies,invitations |
4848
| AUDIT_DEBUG_ADDR | 0.0.0.0:9229 |
4949
| AUTH_APP_DEBUG_ADDR | 0.0.0.0:9245 |
50-
| AUTH_BEARER_DEBUG_ADDR | 0.0.0.0:9149 |
5150
| POLICIES_DEBUG_ADDR | 0.0.0.0:9129 |
5251
| INVITATIONS_DEBUG_ADDR | 0.0.0.0:9269 |
53-
When a user requests these endpoints with "GET" and no authentication
54-
| endpoint | service |
55-
| %base_url_hostname%:9229/healthz | audit |
56-
| %base_url_hostname%:9245/healthz | auth-app |
57-
| %base_url_hostname%:9149/healthz | auth-bearer |
58-
| %base_url_hostname%:9269/healthz | invitations |
59-
| %base_url_hostname%:9129/healthz | policies |
52+
When a user requests these URLs with "GET" and no authentication
53+
| endpoint | service |
54+
| http://%base_url_hostname%:9229/healthz | audit |
55+
| http://%base_url_hostname%:9245/healthz | auth-app |
56+
| http://%base_url_hostname%:9269/healthz | invitations |
57+
| http://%base_url_hostname%:9129/healthz | policies |
6058
Then the HTTP status code of responses on all endpoints should be "200"
6159

6260

6361
Scenario: check default services readiness
64-
When a user requests these endpoints with "GET" and no authentication
65-
| endpoint | service |
66-
| %base_url_hostname%:9197/readyz | activitylog |
67-
| %base_url_hostname%:9165/readyz | app-provider |
68-
| %base_url_hostname%:9243/readyz | app-registry |
69-
| %base_url_hostname%:9147/readyz | auth-basic |
70-
| %base_url_hostname%:9167/readyz | auth-machine |
71-
| %base_url_hostname%:9198/readyz | auth-service |
72-
| %base_url_hostname%:9260/readyz | clientlog |
73-
| %base_url_hostname%:9270/readyz | eventhistory |
74-
| %base_url_hostname%:9141/readyz | frontend |
75-
| %base_url_hostname%:9143/readyz | gateway |
76-
| %base_url_hostname%:9124/readyz | graph |
77-
| %base_url_hostname%:9161/readyz | groups |
78-
| %base_url_hostname%:9239/readyz | idm |
79-
| %base_url_hostname%:9134/readyz | idp |
80-
| %base_url_hostname%:9234/readyz | nats |
81-
| %base_url_hostname%:9163/readyz | ocdav |
82-
| %base_url_hostname%:9281/readyz | ocm |
83-
| %base_url_hostname%:9114/readyz | ocs |
84-
| %base_url_hostname%:9255/readyz | postprocessing |
85-
| %base_url_hostname%:9205/readyz | proxy |
86-
| %base_url_hostname%:9224/readyz | search |
87-
| %base_url_hostname%:9194/readyz | settings |
88-
| %base_url_hostname%:9151/readyz | sharing |
89-
| %base_url_hostname%:9139/readyz | sse |
90-
| %base_url_hostname%:9179/readyz | storage-publiclink |
91-
| %base_url_hostname%:9156/readyz | storage-shares |
92-
| %base_url_hostname%:9217/readyz | storage-system |
93-
| %base_url_hostname%:9159/readyz | storage-users |
94-
| %base_url_hostname%:9189/readyz | thumbnails |
95-
| %base_url_hostname%:9214/readyz | userlog |
96-
| %base_url_hostname%:9145/readyz | users |
97-
| %base_url_hostname%:9104/readyz | web |
98-
| %base_url_hostname%:9119/readyz | webdav |
99-
| %base_url_hostname%:9279/readyz | webfinger |
62+
When a user requests these URLs with "GET" and no authentication
63+
| endpoint | service |
64+
| http://%base_url_hostname%:9197/readyz | activitylog |
65+
| http://%base_url_hostname%:9165/readyz | app-provider |
66+
| http://%base_url_hostname%:9243/readyz | app-registry |
67+
| http://%base_url_hostname%:9147/readyz | auth-basic |
68+
| http://%base_url_hostname%:9167/readyz | auth-machine |
69+
| http://%base_url_hostname%:9198/readyz | auth-service |
70+
| http://%base_url_hostname%:9260/readyz | clientlog |
71+
| http://%base_url_hostname%:9270/readyz | eventhistory |
72+
| http://%base_url_hostname%:9141/readyz | frontend |
73+
| http://%base_url_hostname%:9143/readyz | gateway |
74+
| http://%base_url_hostname%:9161/readyz | groups |
75+
| http://%base_url_hostname%:9239/readyz | idm |
76+
| http://%base_url_hostname%:9234/readyz | nats |
77+
| http://%base_url_hostname%:9163/readyz | ocdav |
78+
| http://%base_url_hostname%:9281/readyz | ocm |
79+
| http://%base_url_hostname%:9114/readyz | ocs |
80+
| http://%base_url_hostname%:9255/readyz | postprocessing |
81+
| http://%base_url_hostname%:9224/readyz | search |
82+
| http://%base_url_hostname%:9194/readyz | settings |
83+
| http://%base_url_hostname%:9151/readyz | sharing |
84+
| http://%base_url_hostname%:9139/readyz | sse |
85+
| http://%base_url_hostname%:9179/readyz | storage-publiclink |
86+
| http://%base_url_hostname%:9156/readyz | storage-shares |
87+
| http://%base_url_hostname%:9217/readyz | storage-system |
88+
| http://%base_url_hostname%:9159/readyz | storage-users |
89+
| http://%base_url_hostname%:9189/readyz | thumbnails |
90+
| http://%base_url_hostname%:9214/readyz | userlog |
91+
| http://%base_url_hostname%:9145/readyz | users |
92+
| http://%base_url_hostname%:9104/readyz | web |
93+
| http://%base_url_hostname%:9119/readyz | webdav |
94+
| http://%base_url_hostname%:9279/readyz | webfinger |
10095
Then the HTTP status code of responses on all endpoints should be "200"
10196

10297
@env-config
@@ -109,11 +104,30 @@ Feature: service health check
109104
| AUTH_BEARER_DEBUG_ADDR | 0.0.0.0:9149 |
110105
| POLICIES_DEBUG_ADDR | 0.0.0.0:9129 |
111106
| INVITATIONS_DEBUG_ADDR | 0.0.0.0:9269 |
112-
When a user requests these endpoints with "GET" and no authentication
113-
| endpoint | service |
114-
| %base_url_hostname%:9229/readyz | audit |
115-
| %base_url_hostname%:9245/readyz | auth-app |
116-
| %base_url_hostname%:9149/readyz | auth-bearer |
117-
| %base_url_hostname%:9269/readyz | invitations |
118-
| %base_url_hostname%:9129/readyz | policies |
107+
When a user requests these URLs with "GET" and no authentication
108+
| endpoint | service |
109+
| http://%base_url_hostname%:9229/readyz | audit |
110+
| http://%base_url_hostname%:9245/readyz | auth-app |
111+
| http://%base_url_hostname%:9269/readyz | invitations |
112+
| http://%base_url_hostname%:9129/readyz | policies |
113+
Then the HTTP status code of responses on all endpoints should be "200"
114+
115+
@issue-10661
116+
Scenario: check default services readiness
117+
When a user requests these URLs with "GET" and no authentication
118+
| endpoint | service |
119+
| http://%base_url_hostname%:9124/readyz | graph |
120+
| http://%base_url_hostname%:9134/readyz | idp |
121+
| http://%base_url_hostname%:9205/readyz | proxy |
122+
Then the HTTP status code of responses on all endpoints should be "200"
123+
124+
@env-config @issue-10661
125+
Scenario: check extra services readiness
126+
Given the following configs have been set:
127+
| config | value |
128+
| OCIS_ADD_RUN_SERVICES | auth-bearer |
129+
| AUTH_BEARER_DEBUG_ADDR | 0.0.0.0:9149 |
130+
When a user requests these URLs with "GET" and no authentication
131+
| endpoint | service |
132+
| http://%base_url_hostname%:9149/readyz | auth-bearer |
119133
Then the HTTP status code of responses on all endpoints should be "200"

0 commit comments

Comments
 (0)