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] Do not overwrite user information when testing duplicate user creation #37917

Merged
merged 1 commit into from
Sep 18, 2020

Conversation

phil-davis
Copy link
Contributor

@phil-davis phil-davis commented Sep 18, 2020

Description

Some test scenarios purposely try to create a user twice, to check that the 2nd user create request fails. They do this with different case of userid (username), because you should not be able to create both brand-new-user and BRAND-NEW-USER

The test code remembers the users that have been created, so it can delete those users in the afterScenario cleanup of the test. But some test steps are remembering "again" the 2nd version of the userid and overwriting the first value. That means that, for example, the actual user on the system-under-test is brand-new-user but the afterScenario tries to delete BRAND-NEW-USER. Actually that will work fine on a system-under-test that has a "correct" Provisioning API "delete" method. But on a system-under-test that is in development, a small problem in the Provisioning API can cause "bonus" test failures that impact on later scenarios.

In afterScenario we should try as best we can to use the "lowest-risk" API calls to do the cleanup actions that reset the system back to a known state.

In this PR the code is more careful that if the user create was not successful then to not overwrite any memory it already has about the existence of that user. That will ensure that deleting users in the afterScenario is done using the exact same userid that was used to create the user.

This should help with owncloud/ocis#587 - preventing the "duplicate user creation" tests from messing up later test scenarios.

How Has This Been Tested?

CI

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Database schema changes (next release will require increase of minor version instead of patch)
  • 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:
  • Changelog item, see TEMPLATE

Copy link
Contributor

@kulmann kulmann left a comment

Choose a reason for hiding this comment

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

LGTM 🚀

@phil-davis phil-davis force-pushed the do-not-overwrite-original-user-in-tests branch from 6bbbd4e to ccaa115 Compare September 18, 2020 06:20
@codecov
Copy link

codecov bot commented Sep 18, 2020

Codecov Report

Merging #37917 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff            @@
##             master   #37917   +/-   ##
=========================================
  Coverage     64.75%   64.75%           
  Complexity    19408    19408           
=========================================
  Files          1285     1285           
  Lines         75830    75830           
  Branches       1336     1336           
=========================================
  Hits          49101    49101           
  Misses        26335    26335           
  Partials        394      394           
Flag Coverage Δ Complexity Δ
#javascript 54.06% <ø> (ø) 0.00 <ø> (ø)
#phpunit 65.93% <ø> (ø) 19408.00 <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.


Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update efab3aa...ccaa115. Read the comment docs.

@phil-davis phil-davis merged commit 2c5bb68 into master Sep 18, 2020
@delete-merged-branch delete-merged-branch bot deleted the do-not-overwrite-original-user-in-tests branch September 18, 2020 06:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants