Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
PrajwolAmatya opened this issue Jul 18, 2024 · 14 comments
Labels

Comments

@PrajwolAmatya
Copy link
Contributor

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)
@PrajwolAmatya PrajwolAmatya changed the title Flaky e2e test on pagination related scenario [QA] Flaky e2e test on pagination related scenario Jul 18, 2024
@JammingBen
Copy link
Contributor

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

@PrajwolAmatya
Copy link
Contributor Author

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. 👍

@ScharfViktor
Copy link
Contributor

ScharfViktor commented Jul 18, 2024

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 ScharfViktor transferred this issue from owncloud/web Jul 18, 2024
@ScharfViktor ScharfViktor changed the title [QA] Flaky e2e test on pagination related scenario [QA] Flaky e2e test. when creating a txt file using API Jul 18, 2024
@ScharfViktor
Copy link
Contributor

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
Copy link
Contributor

ScharfViktor commented Jul 18, 2024

How to reproduce it localy:

  • get personalSpaceUUID
  • open ocis in browser
  • run script which creates 100 txt files
  • see 500 error

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
Screen.Recording.2024-07-19.at.10.22.45.mov

@saw-jan
Copy link
Member

saw-jan commented Jul 19, 2024

Don't know if it is related to #9573

@butonic
Copy link
Member

butonic commented Jul 19, 2024

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 #9648 (comment)

@butonic
Copy link
Member

butonic commented Jul 19, 2024

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
Copy link
Contributor

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

I'll try to enable test again. let see

@ScharfViktor
Copy link
Contributor

I'll try to enable test again. let see

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

@saw-jan
Copy link
Member

saw-jan commented Jul 31, 2024

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)

@saw-jan saw-jan changed the title [QA] Flaky e2e test. when creating a txt file using API Web e2e test can fail when creating multiple text files using API - oCIS couldn't handle all requests properly Jul 31, 2024
@ScharfViktor
Copy link
Contributor

ScharfViktor commented Jul 31, 2024

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:

  • Alice opens browser (to set bearer token -> it needed for api requests)
  • Alice using api(Given step) creates 55 files -> web page stays open (in personal space) and immediately tries to display the new files we are uploading and catch UNCAUGHT EXCEPTION and 500 errors.
    We have similar test for uploading files in the project space-> works fine because personal space is open in web. I'm sure if we go inside to project space before uploading files -> we get same error

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

  • add small amount between uploading each file.
  • getting token using api (do not login) - best way for me
  • before uploading files in personal space -> go off the personal space page -> most easy fix
Screenshot 2024-07-31 at 10 23 52

go off the personal space page:
Screenshot 2024-07-31 at 10 24 42

@saw-jan
Copy link
Member

saw-jan commented Jul 31, 2024

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
Copy link
Contributor

S-Panta commented Sep 3, 2024

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

@S-Panta S-Panta closed this as completed Sep 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

6 participants