Skip to content

Commit

Permalink
scorecard - add PATCH to list of methods in scorecard CR update test (#…
Browse files Browse the repository at this point in the history
…2509)

* add PATCH to list of methods in scorecard CR update test

* use http constants for put/patch/post and update changelog
  • Loading branch information
Jeff McCormick committed Feb 6, 2020
1 parent 4153775 commit a8d2c2a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
- The scaffolded molecule.yml files now use the Ansible verifier. All asserts.yml files were renamed to verify.yml to reflect this.
- The prepare/converge/verify tasks now make use of the new `k8s` `wait` option to simplify the deployment logic.

- Changed the scorecard basic test, `Writing into CRs has an effect`, to include the http.MethodPatch as part of its test criteria alongside http.MethodPut and http.MethodPost. ([#2509](https://github.com/operator-framework/operator-sdk/pull/2509))

### Deprecated

### Removed
Expand Down
6 changes: 4 additions & 2 deletions internal/scorecard/plugins/basic_tests.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import (
"context"
"encoding/json"
"fmt"
"net/http"
"strings"

schelpers "github.com/operator-framework/operator-sdk/internal/scorecard/helpers"
Expand Down Expand Up @@ -170,15 +171,16 @@ func (t *WritingIntoCRsHasEffectTest) Run(ctx context.Context) *schelpers.TestRe
if !ok {
continue
}
if method == "PUT" || method == "POST" {

if method == http.MethodPut || method == http.MethodPost || method == http.MethodPatch {
writes = true
break
}
}

if !writes {
res.Suggestions = append(res.Suggestions, "The operator should write into objects to update state."+
"No PUT or POST requests from the operator were recorded by the scorecard.")
"No PUT, PATCH, or POST requests from the operator were recorded by the scorecard.")
res.State = scapiv1alpha2.FailState
}
return res
Expand Down

0 comments on commit a8d2c2a

Please sign in to comment.