Skip to content
This repository was archived by the owner on Dec 27, 2024. It is now read-only.

Commit 64a0910

Browse files
azroddmicheneau
authored andcommitted
fix: Unit tests
1 parent 0e192ff commit 64a0910

File tree

5 files changed

+63
-13
lines changed

5 files changed

+63
-13
lines changed

.github/workflows/goreport.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
name: Go Report Card Refresh
2+
3+
on:
4+
release:
5+
types: [published]
6+
7+
jobs:
8+
build:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: creekorful/goreportcard-action@v1.0

.github/workflows/tests.yml

Lines changed: 37 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,19 +15,51 @@ permissions:
1515
contents: read
1616

1717
jobs:
18-
# Ensure project builds before running testing matrix
1918
lint:
2019
name: Lint
2120
runs-on: ubuntu-latest
2221
timeout-minutes: 5
2322
steps:
24-
- uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
25-
- uses: actions/setup-go@6edd4406fa81c3da01a34fa6f6343087c207a568 # v3.5.0
23+
- uses: actions/checkout@v3
24+
- uses: actions/setup-go@v4
2625
with:
2726
go-version-file: 'go.mod'
2827
cache: true
2928
- run: go mod download
3029
- name: Run linters
31-
uses: golangci/golangci-lint-action@08e2f20817b15149a52b5b3ebe7de50aff2ba8c5 # v3.4.0
30+
uses: golangci/golangci-lint-action@v3
3231
with:
33-
version: latest
32+
version: latest
33+
34+
coverage:
35+
runs-on: ubuntu-latest
36+
strategy:
37+
fail-fast: false
38+
matrix:
39+
go:
40+
- '1.20'
41+
- '1.19'
42+
- '1.18'
43+
steps:
44+
- uses: actions/setup-go@v3
45+
with:
46+
go-version: ${{ matrix.go }}
47+
- uses: actions/checkout@v3
48+
- run: go test -v -coverprofile=profile.cov ./...
49+
50+
- name: Send coverage
51+
uses: shogo82148/actions-goveralls@v1
52+
with:
53+
path-to-profile: profile.cov
54+
flag-name: Go-${{ matrix.go }}
55+
parallel: true
56+
57+
# notifies that all test jobs are finished.
58+
coverage-finish:
59+
needs: coverage
60+
runs-on: ubuntu-latest
61+
steps:
62+
- uses: shogo82148/actions-goveralls@v1
63+
with:
64+
parallel-finished: true
65+

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@
1111
<a href="https://github.com/FrangipaneTeam/terraform-plugin-framework-validators/issues">
1212
<img alt="Issues" src="https://img.shields.io/github/issues/FrangipaneTeam/terraform-plugin-framework-validators?style=for-the-badge&logo=bilibili&color=F5E0DC&logoColor=D9E0EE&labelColor=302D41" />
1313
</a>
14+
<a href="https://goreportcard.com/report/github.com/FrangipaneTeam/terraform-plugin-framework-validators">
15+
<img alt="GoReport" src="https://goreportcard.com/badge/github.com/FrangipaneTeam/terraform-plugin-framework-validators?style=for-the-badge" />
16+
</a>
1417
</div>
1518

1619
# terraform-plugin-framework-validators
@@ -27,4 +30,8 @@ go get github.com/FrangipaneTeam/terraform-plugin-framework-validators@latest
2730

2831
## Documentation
2932

33+
The documentation for the validators can be found [here](https://github.frangipane.io/terraform/validators/getting-started/).
34+
35+
## Maintainers
36+
3037
This repository is maintained by the [Frangipane Team](https://github.com/FrangipaneTeam)

internal/null_if_attribute_is_one_of_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ func TestNullIfAttributeIsOneOfValidator(t *testing.T) {
5858
types.StringValue("excepted value"),
5959
},
6060
expError: true,
61-
expErrorMessage: "If foo attribute is set and the value is one of \"excepted value\", this attribute is null",
61+
expErrorMessage: "If foo attribute is set and the value is one of \"excepted value\", this attribute is NULL",
6262
},
6363
"extendedString": {
6464
req: internal.NullIfAttributeIsOneOfRequest{
@@ -124,7 +124,7 @@ func TestNullIfAttributeIsOneOfValidator(t *testing.T) {
124124
types.StringValue("bar1 excepted value"),
125125
},
126126
expError: true,
127-
expErrorMessage: "If foobar[0].bar1 attribute is set and the value is one of \"bar1 excepted value\", this attribute is null",
127+
expErrorMessage: "If foobar[0].bar1 attribute is set and the value is one of \"bar1 excepted value\", this attribute is NULL",
128128
},
129129
"baseInt64": {
130130
req: internal.NullIfAttributeIsOneOfRequest{
@@ -155,7 +155,7 @@ func TestNullIfAttributeIsOneOfValidator(t *testing.T) {
155155
types.Int64Value(10),
156156
},
157157
expError: true,
158-
expErrorMessage: "If foo attribute is set and the value is one of 10, this attribute is null",
158+
expErrorMessage: "If foo attribute is set and the value is one of 10, this attribute is NULL",
159159
},
160160
"baseBool": {
161161
req: internal.NullIfAttributeIsOneOfRequest{
@@ -186,7 +186,7 @@ func TestNullIfAttributeIsOneOfValidator(t *testing.T) {
186186
types.BoolValue(true),
187187
},
188188
expError: true,
189-
expErrorMessage: "If foo attribute is set and the value is one of true, this attribute is null",
189+
expErrorMessage: "If foo attribute is set and the value is one of true, this attribute is NULL",
190190
},
191191
"path-attribute-is-null": {
192192
req: internal.NullIfAttributeIsOneOfRequest{

internal/require_if_attribute_is_one_of_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ func TestRequireIfAttributeIsOneOfValidator(t *testing.T) {
5858
types.StringValue("excepted value"),
5959
},
6060
expError: true,
61-
expErrorMessage: "If foo attribute is set and the value is one of \"excepted value\", this attribute is required",
61+
expErrorMessage: "If foo attribute is set and the value is one of \"excepted value\", this attribute is REQUIRED",
6262
},
6363
"extendedString": {
6464
req: internal.RequireIfAttributeIsOneOfRequest{
@@ -124,7 +124,7 @@ func TestRequireIfAttributeIsOneOfValidator(t *testing.T) {
124124
types.StringValue("bar1 excepted value"),
125125
},
126126
expError: true,
127-
expErrorMessage: "If foobar[0].bar1 attribute is set and the value is one of \"bar1 excepted value\", this attribute is required",
127+
expErrorMessage: "If foobar[0].bar1 attribute is set and the value is one of \"bar1 excepted value\", this attribute is REQUIRED",
128128
},
129129
"baseInt64": {
130130
req: internal.RequireIfAttributeIsOneOfRequest{
@@ -155,7 +155,7 @@ func TestRequireIfAttributeIsOneOfValidator(t *testing.T) {
155155
types.Int64Value(10),
156156
},
157157
expError: true,
158-
expErrorMessage: "If foo attribute is set and the value is one of 10, this attribute is required",
158+
expErrorMessage: "If foo attribute is set and the value is one of 10, this attribute is REQUIRED",
159159
},
160160
"baseBool": {
161161
req: internal.RequireIfAttributeIsOneOfRequest{
@@ -186,7 +186,7 @@ func TestRequireIfAttributeIsOneOfValidator(t *testing.T) {
186186
types.BoolValue(true),
187187
},
188188
expError: true,
189-
expErrorMessage: "If foo attribute is set and the value is one of true, this attribute is required",
189+
expErrorMessage: "If foo attribute is set and the value is one of true, this attribute is REQUIRED",
190190
},
191191
"path-attribute-is-null": {
192192
req: internal.RequireIfAttributeIsOneOfRequest{

0 commit comments

Comments
 (0)