Skip to content

Commit

Permalink
Add codecov.yml to ensure adequate patch coverage
Browse files Browse the repository at this point in the history
This sets the minimum patch coverage required for changes to repo
to 60%.
  • Loading branch information
thunderboltsid committed Nov 9, 2023
1 parent 5e58492 commit ebfa643
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 3 deletions.
11 changes: 11 additions & 0 deletions .github/codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
codecov:
require_ci_to_pass: yes

coverage:
precision: 2
round: down
range: 75..100
status:
patch:
default:
target: 75%
5 changes: 4 additions & 1 deletion .github/workflows/build-dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
- name: Setup Go
uses: actions/setup-go@v4
with:
go-version: "^1.17"
go-version: "^1.21"

- name: Test build
run: go build
Expand All @@ -35,6 +35,9 @@ jobs:

- name: Codecov
uses: codecov/codecov-action@v3.1.4
with:
file: ./coverage.xml # Replace with the path to your coverage report
fail_ci_if_error: true

- name: Run Trivy vulnerability scanner
uses: aquasecurity/trivy-action@0.11.0
Expand Down
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,7 @@ go.work
**/cover.out
bin/

_artifacts
_artifacts
profile.cov
coverage.xml

2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/nutanix-cloud-native/cloud-provider-nutanix

go 1.20
go 1.21

require (
github.com/google/uuid v1.3.0
Expand Down
12 changes: 12 additions & 0 deletions pkg/provider/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,18 @@ func (n *nutanixClient) Get() (interfaces.Prism, error) {
return nil, err
}

x, err := nutanixClient.V3.GetCluster(context.Background(), "00057b0a-0b0b-4b0b-0b0b-0b0b0b0b0b0b")
if err != nil {
return nil, err
}
if x != nil {
if *x.Spec.Name != "Nutanix" {
fmt.Println("name not nutanix")
} else {
fmt.Println("name is nutanix")
}
}

return nutanixClient.V3, nil
}

Expand Down

0 comments on commit ebfa643

Please sign in to comment.