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

[tests-only][full-ci] removing the setresponse in given/then step in SettingContext and TUSContext #7298

Merged
merged 5 commits into from
Sep 25, 2023

Conversation

KarunAtreya
Copy link
Contributor

Description

We have used setResponse() and $this->response in the Given/Then steps and some helper functions (maybe to reuse existing available methods). But storing responses from Given/Then steps and helper functions is not a good idea because it can lead to a false positive assertion in the Then steps.
So, check the use of setResponse() and $this->response in

  • Given steps
  • Then steps (Then steps can use $this->response but must prevent saving to it)
  • Helper functions

So this pr make the above changes in SettingContext and TUSContext

Related Issue

#7082

Motivation and Context

  • To remove setResponse() and $this->response in the Given/Then steps and some helper functions
  • To avoid false positive assertions

How Has This Been Tested?

  • test environment:
  • locally
  • CI

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Technical debt
  • Tests only (no source changes)

Checklist:

  • Code changes
  • Unit tests added
  • Acceptance tests added
  • Documentation ticket raised:

@saw-jan
Copy link
Member

saw-jan commented Sep 19, 2023

Issue with sonarcloud: #7301

@KarunAtreya KarunAtreya force-pushed the refactor_setting_response branch 2 times, most recently from a0f1d39 to 93a889b Compare September 21, 2023 03:51
@KarunAtreya KarunAtreya force-pushed the refactor_setting_response branch from ac98536 to 5c900e3 Compare September 21, 2023 11:22
Copy link
Member

@saw-jan saw-jan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍 ✨

@KarunAtreya KarunAtreya force-pushed the refactor_setting_response branch from 5c900e3 to c0e0c6f Compare September 22, 2023 03:51
@saw-jan
Copy link
Member

saw-jan commented Sep 22, 2023

this scenario is failing: apiSpacesShares/shareUploadTUS.feature:248

@saw-jan
Copy link
Member

saw-jan commented Sep 22, 2023

this scenario is failing: apiSpacesShares/shareUploadTUS.feature:248

consistently failing in CI

@KarunAtreya
Copy link
Contributor Author

this scenario is failing: apiSpacesShares/shareUploadTUS.feature:248

consistently failing in CI

yeah it might also be due to the test code so i will try to look carefully locally

@KarunAtreya KarunAtreya force-pushed the refactor_setting_response branch 2 times, most recently from e18cdee to bcb3668 Compare September 22, 2023 10:14
@KarunAtreya KarunAtreya force-pushed the refactor_setting_response branch 2 times, most recently from e55e064 to 30f4128 Compare September 25, 2023 04:51
Comment on lines 3394 to 3396
if (isset(WebDavHelper::$SPACE_ID_FROM_OCIS)) {
WebDavHelper::$SPACE_ID_FROM_OCIS = '';
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

review this @saw-jan dai

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we clear this after each request. any case where this is to be clean in afterScenario? But yeah i think that we do not need this variable $SPACE_ID_FROM_OCIS variable anymore. This was added because we used the same testcode for core. We can make an issue to refactor this also. @saw-jan @SwikritiT

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we clear this after each request. any case where this is to be clean in afterScenario? But yeah i think that we do not need this variable $SPACE_ID_FROM_OCIS variable anymore. This was added because we used the same testcode for core. We can make an issue to refactor this also. @saw-jan @SwikritiT

I actually removed this before but this scenario was failing: apiSpacesShares/shareUploadTUS.feature:248
later found out that $SPACE_ID_FROM_OCIS was not reset in the scenario apiSpacesShares/shareUploadTUS.feature:248 so the request was send to the space id from previous scenario resulting 409 status error

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can make an issue to refactor this also.

yeah, should be on the list

Copy link
Member

@SagarGi SagarGi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

other LGTM 👍

@KarunAtreya KarunAtreya force-pushed the refactor_setting_response branch from 30f4128 to f7f5f42 Compare September 25, 2023 06:56
Copy link
Member

@saw-jan saw-jan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍 ✨

@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

@saw-jan saw-jan merged commit 49d9d3b into master Sep 25, 2023
2 checks passed
@delete-merged-branch delete-merged-branch bot deleted the refactor_setting_response branch September 25, 2023 07:47
ownclouders pushed a commit that referenced this pull request Sep 25, 2023
…SettingContext and TUSContext (#7298)

* refactor given when then steps in settings and tus contexts

* set resource location from response

* addressed the reviews

* reset  spaceidfromocis

* reset after scenario using after hook
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants