Closed felixlut closed 1 year ago
Testing the copy functionality is not trivial since it's only really the conditions for it that are copied. This in combination that a Quality Gate is created with a number of conditions by default makes it a bit hard.
My idea right now is to do the following steps:
1. Create a base Quality Gate (including the default conditons that comes with this call)
2. Create a custom condition for it on top of the default ones
3. Create a copy of the base gate
4. Check that the custom condition is indeed in the list of conditions in the copy
Conceptually this is quite easy, but I'll probably have to dig into custom validation functions a bit to make it work
Testing the copy functionality is not trivial since it's only really the conditions for it that are copied. This in combination that a Quality Gate is created with a number of conditions by default makes it a bit hard.
My idea right now is to do the following steps:
1. Create a base Quality Gate (including the default conditons that comes with this call) 2. Create a custom condition for it on top of the default ones 3. Create a copy of the base gate 4. Check that the custom condition is indeed in the list of conditions in the copy
Conceptually this is quite easy, but I'll probably have to dig into custom validation functions a bit to make it work
Ended up changing step 4 to checking for equality between the base
and copied
gates
This PR introduces the
copy_from
argument when creating a SonarQubeQuality Gate
.It does so by calling the
api/qualitygates/copy
API as opposed to the regularapi/qualitygates/create
endpoint if thecopy_from
argument is supplied.Resolves #131