tyk icon indicating copy to clipboard operation
tyk copied to clipboard

Add checks for parallelism in StartTest, surface broken tests

Open titpetric opened this issue 3 years ago • 5 comments

This PR should prevent two StartTest() calls to run in parallel. Since we have some setup/teardown issues that limit concurrency, the first step is to figure out where and to stabilize the Flaky APIs by limiting concurrency of StartTest.

Description

The implementation uses a semaphore, a compare-and-swap atomic operation that can be used similarly as sync.Mutex, but in an non-blocking way. If the semaphore says that StartTest can't run (as the previous one is still alive), this panics.

I'm not expecting the CI to pass, I'm expecting to fail and surface at least one panic.

Related Issue

Motivation and Context

How This Has Been Tested

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)
  • [ ] Refactoring or add test (improvements in base code or adds test coverage to functionality)

Checklist

  • [ ] Make sure you are requesting to pull a topic/feature/bugfix branch (right side). If pulling from your own fork, don't request your master!
  • [ ] Make sure you are making a pull request against the master branch (left side). Also, you should start your branch off our latest master.
  • [ ] My change requires a change to the documentation.
    • [ ] If you've changed APIs, describe what needs to be updated in the documentation.
    • [ ] If new config option added, ensure that it can be set via ENV variable
  • [ ] I have updated the documentation accordingly.
  • [ ] Modules and vendor dependencies have been updated; run go mod tidy && go mod vendor
  • [ ] When updating library version must provide reason/explanation for this update.
  • [ ] I have added tests to cover my changes.
  • [ ] All new and existing tests passed.
  • [ ] Check your code additions will not fail linting checks:
    • [ ] go fmt -s
    • [ ] go vet

titpetric avatar Jul 20 '22 11:07 titpetric

API tests result: success :white_check_mark: Branch used: refs/pull/4195/merge Commit:
Triggered by: pull_request (@titpetric) Execution page

Tyk-ITS avatar Jul 20 '22 12:07 Tyk-ITS

API tests result: success :white_check_mark: Branch used: refs/pull/4195/merge Commit: 128a8b69d0a0cbe23d0bc0d4f85299cc5a62a8a5 Triggered by: pull_request (@titpetric) Execution page

Tyk-ITS avatar Jul 20 '22 12:07 Tyk-ITS

API tests result: success :white_check_mark: Branch used: refs/pull/4195/merge Commit: 9ed411945d486a4d09f211417a5aba4224d52980 Triggered by: pull_request (@titpetric) Execution page

Tyk-ITS avatar Jul 20 '22 12:07 Tyk-ITS

API tests result: success :white_check_mark: Branch used: refs/pull/4195/merge Commit: baa2fab35b2dec47e7660319f73beb035b9d8806 Triggered by: pull_request (@titpetric) Execution page

Tyk-ITS avatar Jul 20 '22 12:07 Tyk-ITS