threefoldtech / tfgrid-sdk-go

Apache License 2.0
2 stars 4 forks source link

using schemathesis or similar tools for testing purposes #51

Open sameh-farouk opened 1 year ago

sameh-farouk commented 1 year ago

Description

I saw these two issues raised recently,

  1. Sometimes our API specifications get outdated and out-of-sync with our implementation. we should always respect this contract, but how to make sure it is always respected and updated?
  2. We need to test our API functionality regularly to ensure it is working properly, a PR was submitted to run basic tests in a GitHub action. it will add one more thing to the stack that is needed also to keep in sync with every change.

I want to point out that there are many tools that can generate and run tests from the API specification. e.g, schemathesis is an API testing tool that could run thousands of generated test cases given just the API schema.

This could solve these two issues and provides added benefits:

It is expected to have many falling tests when we start to use this tool, but I see this as a pro and a way to improve and fix invisible issues.

ramezsaeed commented 1 year ago

@A-Harby please verify and update this issue

A-Harby commented 1 year ago

As @sameh-farouk said old PR is a hard coded endpoint tests so it's hard to maintain updated with every new changes happens on the grid proxy. And I did some researches on schema/api testing tools and schemathesis was the most suitable tool to be used cause it have the ability to generate and easily customize theses tests.

The issue is that when the schema was tested, it reported a numerous amount of errors which will make it hard to debug and fix. so with using schemathesis docs I found a way to use a python code to specify each endpoint and checks (mentioned below) I want the tool to test and I'm trying to separates theses errors as I could, so it could be more easier to identify and report.

There are five built-in checks you can use:

Stranger6667 commented 1 year ago

Hey, Schemathesis author here. Folks, if you'd need any help or something won't work as expected with Schemathesis or you'd like to propose some feature request - do not hesitate to ping me :)

xmonader commented 1 year ago

What is the status here? please make sure it's updated and merged or let's close the issue

xmonader commented 11 months ago

@ramezsaeed @A-Harby what are we going to do with this one?

A-Harby commented 9 months ago

I will update the old PR code and version at https://github.com/threefoldtecharchive/tfgridclient_proxy/pull/297, and create a new PR on this repo after.

A-Harby commented 9 months ago

wip: Create a new PR with new versions, all the networks and locally, and some fixes: https://github.com/threefoldtech/tfgrid-sdk-go/pull/695, waiting for reviews.

sameh-farouk commented 7 months ago

Any progress or help needed for This one? Last update/review on PR was about two months ago.

A-Harby commented 6 months ago

Any progress or help needed for This one? Last update/review on PR was about two months ago.

I'll update the PR with some changes as requested here: https://github.com/threefoldtech/tfgrid-sdk-go/pull/695#issuecomment-1937556279 and will request a re-review.

A-Harby commented 6 months ago

Approved and done: https://github.com/threefoldtech/tfgrid-sdk-go/pull/695#pullrequestreview-2015909505.