owncloud / ocis

:atom_symbol: ownCloud Infinite Scale Stack
https://doc.owncloud.com/ocis/next/
Apache License 2.0
1.35k stars 174 forks source link

Web e2e test can fail when creating multiple text files using API - oCIS couldn't handle all requests properly #9648

Closed PrajwolAmatya closed 4 days ago

PrajwolAmatya commented 1 month ago

Description

Build: https://drone.owncloud.com/owncloud/web/45882/13/8

Failed Scenario:

Scenario: pagination (attempt 2) # tests/e2e/cucumber/features/navigation/personalSpacePagination.feature:6
   ✔ Before # tests/e2e/cucumber/environment/index.ts:44
   ✔ Given "Admin" creates following user using API # tests/e2e/cucumber/steps/api.ts:7
       | id    |
       | Alice |
   ✔ And "Alice" logs in # tests/e2e/cucumber/steps/ui/session.ts:45
   ✔ And "Alice" creates 55 folders in personal space using API # tests/e2e/cucumber/steps/api.ts:74
   ✖ And "Alice" creates 55 files in personal space using API # tests/e2e/cucumber/steps/api.ts:137
       Error: expect(received).not.toBeDefined()

       Received: [Error: Unknown error]
           at Proxy.<anonymous> (/var/www/owncloud/web/node_modules/.pnpm/playwright@1.44.1/node_modules/playwright/lib/matchers/expect.js:177:37)
           at Page.<anonymous> (/var/www/owncloud/web/tests/e2e/support/environment/actor/actor.ts:30:31)
           at Page.emit (node:events:514:28)
           at Page.emit (node:domain:489:12)
           at Proxy.<anonymous> (/var/www/owncloud/web/node_modules/.pnpm/playwright-core@1.44.1/node_modules/playwright-core/lib/client/browserContext.js:124:34)
           at Proxy.emit (node:events:514:28)
           at Proxy.emit (node:domain:489:12)
           at Connection.dispatch (/var/www/owncloud/web/node_modules/.pnpm/playwright-core@1.44.1/node_modules/playwright-core/lib/client/connection.js:202:21)
           at Immediate.<anonymous> (/var/www/owncloud/web/node_modules/.pnpm/playwright-core@1.44.1/node_modules/playwright-core/lib/inProcessFactory.js:49:83)
           at processImmediate (node:internal/timers:476:21)
   - And "Alice" creates the following files into personal space using API # tests/e2e/cucumber/steps/api.ts:108
       | pathToFile           | content                |
       | .hidden-testFile.txt | This is a hidden file. |
   - And "Alice" opens the "files" app # tests/e2e/cucumber/steps/ui/application.ts:15
   - When "Alice" navigates to page "2" of the personal space files view # tests/e2e/cucumber/steps/ui/resources.ts:716
   - Then "Alice" should see the text "111 items with 1 kB in total (56 files including 1 hidden, 55 folders)" at the footer of the page # tests/e2e/cucumber/steps/ui/resources.ts:734
   - And "Alice" should see 10 resources in the personal space files view # tests/e2e/cucumber/steps/ui/resources.ts:744
   - When "Alice" enables the option to display the hidden file # tests/e2e/cucumber/steps/ui/resources.ts:395
   - Then "Alice" should see 11 resources in the personal space files view # tests/e2e/cucumber/steps/ui/resources.ts:744
   - When "Alice" changes the items per page to "500" # tests/e2e/cucumber/steps/ui/resources.ts:725
   - Then "Alice" should not see the pagination in the personal space files view # tests/e2e/cucumber/steps/ui/resources.ts:754
   - And "Alice" logs out # tests/e2e/cucumber/steps/ui/session.ts:58
   ✖ After # tests/e2e/cucumber/environment/index.ts:112
       Error: expect(received).not.toBeDefined()

       Received: [Error: Unknown error]
           at Proxy.<anonymous> (/var/www/owncloud/web/node_modules/.pnpm/playwright@1.44.1/node_modules/playwright/lib/matchers/expect.js:177:37)
           at Page.<anonymous> (/var/www/owncloud/web/tests/e2e/support/environment/actor/actor.ts:30:31)
           at Page.emit (node:events:514:28)
           at Page.emit (node:domain:489:12)
           at Proxy.<anonymous> (/var/www/owncloud/web/node_modules/.pnpm/playwright-core@1.44.1/node_modules/playwright-core/lib/client/browserContext.js:124:34)
           at Proxy.emit (node:events:514:28)
           at Proxy.emit (node:domain:489:12)
           at Connection.dispatch (/var/www/owncloud/web/node_modules/.pnpm/playwright-core@1.44.1/node_modules/playwright-core/lib/client/connection.js:202:21)
           at Immediate.<anonymous> (/var/www/owncloud/web/node_modules/.pnpm/playwright-core@1.44.1/node_modules/playwright-core/lib/inProcessFactory.js:49:83)
           at processImmediate (node:internal/timers:476:21)
JammingBen commented 1 month ago

Roughly 80% of my CIs fail because of that test. Can we temporarily skip the test until it is resolved?

PrajwolAmatya commented 1 month ago

Roughly 80% of my CIs fail because of that test. Can we temporarily skip the test until it is resolved?

Yes we can skip this test temporarily for now until resolved. :+1:

ScharfViktor commented 1 month ago

sometimes we have 500 error during the creating files via API web catches it and interrupts the test.

ocis log:

2024/07/18 10:50:19 http: proxy error: context canceled
{"level":"error","service":"gateway","pkg":"rgrpc","traceid":"c60ab3652f0b75ecef83b19c07d0d00c","user-agent":"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) HeadlessChrome/123.0.6312.105 Safari/537.36","from":"tcp://127.0.0.1:32790","uri":"/cs3.gateway.v1beta1.GatewayAPI/Stat","start":"18/Jul/2024:10:50:19 +0000","end":"18/Jul/2024:10:50:19 +0000","time_ns":1370190,"code":"Canceled","time":"2024-07-18T10:50:19Z","message":"rpc error: code = Canceled desc = context canceled"}
{"level":"error","service":"ocdav","name":"com.owncloud.web.ocdav","traceid":"c60ab3652f0b75ecef83b19c07d0d00c","request-id":"d945f491-c29e-4ea5-a4aa-f4277faa9863","path":"/testfile25.txt","spaceid":"eaac99b4-1710-4ebf-b7bd-23addaca23c2$75f61a46-a175-4128-86d9-5be779c6c946","error":"rpc error: code = Canceled desc = context canceled","time":"2024-07-18T10:50:19Z","message":"error getting grpc client"}
{"level":"error","service":"storage-users","pkg":"rgrpc","traceid":"de9b31c5f350059ba58be30686e05a5e","error":"node.Xattr /root/.ocis/storage/users/spaces/75/f61a46-a175-4128-86d9-5be779c6c946/nodes/75/f6/1a/46/-a175-4128-86d9-5be779c6c946 user.ocis.name: no data available","id":"75f61a46-a175-4128-86d9-5be779c6c946","time":"2024-07-18T10:50:19Z","message":"could not read node"}
{"level":"error","service":"storage-users","pkg":"rgrpc","traceid":"de9b31c5f350059ba58be30686e05a5e","error":"node.Xattr /root/.ocis/storage/users/spaces/75/f61a46-a175-4128-86d9-5be779c6c946/nodes/75/f6/1a/46/-a175-4128-86d9-5be779c6c946 user.ocis.name: no data available","status":{"code":15,"message":"error listing spaces","trace":"de9b31c5f350059ba58be30686e05a5e"},"filters":[{"type":2,"Term":{"Id":{"opaque_id":"eaac99b4-1710-4ebf-b7bd-23addaca23c2$75f61a46-a175-4128-86d9-5be779c6c946!75f61a46-a175-4128-86d9-5be779c6c946"}}},{"type":4,"Term":{"SpaceType":"+grant"}}],"time":"2024-07-18T10:50:19Z","message":"failed to list storage spaces"}
{"level":"error","service":"ocdav","name":"com.owncloud.web.ocdav","traceid":"a4a6d84ea343a0960a90ab8934b4493d","request-id":"a5f2dd075b84/IKIyk1o97j-010951","spaceid":"eaac99b4-1710-4ebf-b7bd-23addaca23c2$75f61a46-a175-4128-86d9-5be779c6c946","path":"/testfile36.txt","status":{"code":15,"message":"stat:node.Xattr /root/.ocis/storage/users/spaces/75/f61a46-a175-4128-86d9-5be779c6c946/nodes/75/f6/1a/46/-a175-4128-86d9-5be779c6c946 user.ocis.name: no data available","trace":"a4a6d84ea343a0960a90ab8934b4493d"},"code":500,"time":"2024-07-18T10:50:19Z","message":"Internal Server Error"}
ScharfViktor commented 1 month ago

It's backend issue so I moved to the ocis repo

after discussion with @butonic, we decided to temporarily skip this e2e test so as to not block CI

ScharfViktor commented 1 month ago

How to reproduce it localy:

run script:

#!/bin/bash

BEARER_TOKEN="token"
SPACE_UUID="personal_space_uuid"

for i in {1..100}
do
 curl -k -s -o /dev/null -w "%{http_code}" -X PUT "https://host.docker.internal:9200/remote.php/dav/spaces/$SPACE_UUID/${i}.txt" \
    -H "Authorization: Bearer $BEARER_TOKEN" \
    --data "This is the content of file ${i}.txt"

response=$(curl -k -s -o /dev/null -w "%{http_code}" -X PROPFIND "https://host.docker.internal:9200/remote.php/dav/spaces/$SPACE_UUID" \
    -H "Authorization: Bearer $BEARER_TOKEN" \
    -H "Content-Type: application/xml" \
    -H "Depth: 1" \
    --data-binary @- << EOF
<d:propfind xmlns:d="DAV:" xmlns:oc="http://owncloud.org/ns">
  <d:prop>
    <oc:permissions/>
    <oc:favorite/>
    <oc:fileid/>
    <oc:file-parent/>
    <oc:name/>
    <d:lockdiscovery/>
    <d:activelock/>
    <oc:owner-id/>
    <oc:owner-display-name/>
    <oc:remote-item-id/>
    <oc:shareroot/>
    <oc:share-types/>
    <oc:privatelink/>
    <d:getcontentlength/>
    <oc:size/>
    <d:getlastmodified/>
    <d:getetag/>
    <d:getcontenttype/>
    <d:resourcetype/>
    <oc:downloadURL/>
    <oc:tags/>
    <oc:audio/>
    <oc:location/>
    <oc:image/>
    <oc:photo/>
  </d:prop>
</d:propfind>
EOF)

  if [ "$response" -ne 207 ]; then
    echo "err code $response"
    exit 1
  else
    echo "PROPFIND response is successfully"
  fi
done

https://github.com/user-attachments/assets/89bb5788-fd48-4bdb-ab99-42ada4bfa46f

saw-jan commented 1 month ago

Don't know if it is related to https://github.com/owncloud/ocis/issues/9573

butonic commented 1 month ago

hm I cannot reproduce this with the script when running it locally. even after 1000 files I don't see an error ... (basic auth vs oidc makes no difference, tried both)

@ScharfViktor as you are running it locally, shoul should also have an error log on the server side. A 500 should always trigger a log entry. Would be interesting to see if it confirms https://github.com/owncloud/ocis/issues/9648#issuecomment-2236586374

butonic commented 1 month ago

ok, now I'm running three concurrent scripts with 1k files each against a kubernetes deployment with ocis in a single container ... still no errors.

ScharfViktor commented 1 month ago

hm, now I cannot reproduce it. but there was a bug. I recorded it 😀

I'll try to enable test again. let see

ScharfViktor commented 1 month ago

I'll try to enable test again. let see

error still exist😪 https://drone.owncloud.com/owncloud/web/45973/14/9

saw-jan commented 1 month ago

still fails: https://drone.owncloud.com/owncloud/web/46239/14/9 but small amount of wait between each request can make the test pass. (https://drone.owncloud.com/owncloud/web/46238/14/9)

ScharfViktor commented 1 month ago

still fails: https://drone.owncloud.com/owncloud/web/46239/14/9 but small amount of wait between each request can make the test pass. (https://drone.owncloud.com/owncloud/web/46238/14/9)

let try to small amount

or we can implement getting token using api to avoid this issue or similar

what does test now:

How in conclusion I see 3 ways how to solve this issue:

Screenshot 2024-07-31 at 10 23 52

go off the personal space page:

Screenshot 2024-07-31 at 10 24 42
saw-jan commented 1 month ago

getting token using api (do not login) - best way for me

This would be the way to go if we can get valid token using API

S-Panta commented 4 days ago

Closing this issue as this is solved with https://github.com/owncloud/web/pull/11368. As per @ScharfViktor suggestion, the bearer token is received with API before login.