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

NOISSUE - Add property based testing to users service #2087

Merged
merged 5 commits into from
Mar 22, 2024

Conversation

rodneyosodo
Copy link
Member

What type of PR is this?

This is a feature PR as it adds property-based testing to users API. In addition it is a refactor to error handling on the API

What does this do?

Adds schemathesis, property-based testing to users service

Which issue(s) does this PR fix/relate to?

No issue

Have you included tests for your changes?

Yes, I have included tests for my changes.

Did you document any new/modified feature?

No

Notes

base-url: http://localhost:9002
checks: all
report: false
args: '--header "Authorization: Bearer ${{ env.USER_TOKEN }}" --contrib-unique-data --contrib-openapi-formats-uuid --hypothesis-suppress-health-check=filter_too_much --stateful=links'

Choose a reason for hiding this comment

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

The --contrib-unique-data option is deprecated and going to be removed in the next major version of Schemathesis. I suggest avoiding it as it leads to unstable tests

Copy link
Contributor

Choose a reason for hiding this comment

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

@rodneyosodo can you please inspect this and see if we can remove --contrib-unique-data and what implications it will make (i.e. how we can find a future-proof approach)

base-url: http://localhost:9002
checks: all
report: false
args: '--header "Authorization: Bearer ${{ env.USER_TOKEN }}" --contrib-unique-data --contrib-openapi-formats-uuid --hypothesis-suppress-health-check=filter_too_much --stateful=links'
Copy link
Contributor

Choose a reason for hiding this comment

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

@rodneyosodo can you please inspect this and see if we can remove --contrib-unique-data and what implications it will make (i.e. how we can find a future-proof approach)

@rodneyosodo rodneyosodo force-pushed the users-schemathesis branch 6 times, most recently from 9afecd6 to 88932de Compare February 26, 2024 16:46
@rodneyosodo rodneyosodo force-pushed the users-schemathesis branch 2 times, most recently from 8f20e95 to 64e7f91 Compare March 8, 2024 07:58
@rodneyosodo rodneyosodo force-pushed the users-schemathesis branch 2 times, most recently from f983000 to 5e139ad Compare March 13, 2024 13:04
Copy link
Contributor

@arvindh123 arvindh123 left a comment

Choose a reason for hiding this comment

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

LGTM

At here in users repository , we are using svcerr, instead of svcerr, does the repoerr will fit there ?

Makefile Show resolved Hide resolved
@rodneyosodo rodneyosodo force-pushed the users-schemathesis branch 2 times, most recently from 55dc245 to 0f0c948 Compare March 14, 2024 13:55
arvindh123
arvindh123 previously approved these changes Mar 14, 2024
@arvindh123
Copy link
Contributor

arvindh123 commented Mar 14, 2024

Got the below warnings from schemathesis in local and in CI,
Is it possible to provision Magistrala with domain and groups ? , so that schemathesis could test all the cases.

WARNINGS:
  - Most of the responses from `GET /groups/{groupID}` have a 403 status code. Did you specify proper API credentials?
  - Most of the responses from `PUT /groups/{groupID}` have a 403 status code. Did you specify proper API credentials?
  - Most of the responses from `DELETE /groups/{groupID}` have a 403 status code. Did you specify proper API credentials?
  - Most of the responses from `POST /groups/{groupID}/enable` have a 403 status code. Did you specify proper API credentials?
  - Most of the responses from `POST /groups/{groupID}/disable` have a 403 status code. Did you specify proper API credentials?

@rodneyosodo
Copy link
Member Author

Is it possible to provision Magistrala with domain and groups ? , so that schemathesis could test all the cases.

This is completely fine. Most of the endpoints schemathesis is probing are not valid hence we get an authorization error because the id is not for a valid entity

Removed the `--contrib-unique-data` option from API test arguments in `.github/workflows/api-tests.yml` and `Makefile` since it will be deprecated

Signed-off-by: Rodney Osodo <[email protected]>
Signed-off-by: Rodney Osodo <[email protected]>
Signed-off-by: Rodney Osodo <[email protected]>
@dborovcanin dborovcanin merged commit 70c3d65 into absmach:main Mar 22, 2024
6 checks passed
JeffMboya pushed a commit to JeffMboya/supermq that referenced this pull request Apr 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants