Skip to content

Commit 198745b

Browse files
Update Github Workflow pipeline (testacc, lint, pr template) (#17)
* add testacc and linting to workflows * update old rigor tests to stop ci lint from failing Co-authored-by: greatestusername-splunk <83726369+greatestusername-splunk@users.noreply.github.com>
1 parent 32dd831 commit 198745b

9 files changed

+98
-7
lines changed

.github/pull_request_template.md

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<!-- Please refer to our contributing docs for any questions on submitting a pull request -->
2+
<!-- Issues are expected for bug fixes and features. -->
3+
Resolves #ISSUE_NUMBER
4+
5+
----
6+
7+
### Before the change?
8+
<!-- Please describe the current behavior that you are modifying. -->
9+
10+
*
11+
12+
### After the change?
13+
<!-- Please describe the behavior or changes that are being added by this PR. -->
14+
15+
*
16+
17+
### Pull request checklist
18+
- [ ] Acceptance Tests have been updated, run (`make testacc`), and pasted in this PR (for bug fixes / features)
19+
- [ ] Docs have been reviewed and added / updated if needed (for bug fixes / features)
20+
21+
#### Acceptance Test Output
22+
<!-- Please paste the results of acceptance tests `make testacc` in the codeblock here. -->
23+
```
24+
25+
```
26+
27+
### Does this introduce a breaking change?
28+
<!-- If this introduces a breaking change make sure to note it here any what the impact might be -->
29+
30+
- [ ] Yes
31+
- [ ] No
32+
33+
----

.github/workflows/ci.yml

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# Terraform Provider CI checks workflow.
2+
name: CI Checks
3+
4+
# This GitHub action runs your tests for each pull request and push.
5+
# Optionally, you can turn it on using a schedule for regular testing.
6+
on:
7+
pull_request:
8+
paths-ignore:
9+
- 'README.md'
10+
push:
11+
paths-ignore:
12+
- 'README.md'
13+
14+
# Testing only needs permissions to read the repository contents.
15+
permissions:
16+
contents: read
17+
18+
jobs:
19+
# Ensure project builds before running testing matrix
20+
build:
21+
name: Build
22+
runs-on: ubuntu-latest
23+
timeout-minutes: 5
24+
steps:
25+
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
26+
- uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe # v4.1.0
27+
with:
28+
go-version-file: 'go.mod'
29+
cache: true
30+
- run: go mod download
31+
- name: Run linters
32+
uses: golangci/golangci-lint-action@3a919529898de77ec3da873e3063ca4b10e7f5cc # v3.7.0
33+
with:
34+
version: latest
35+
- run: make lint
36+
- run: make testacc
37+
- run: go build -v ./syntheticsclientv2

syntheticsclient/create_browsercheck_test.go

+4-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,10 @@ func TestCreateBrowseCheck(t *testing.T) {
3131

3232
testMux.HandleFunc("/v2/checks/real_browsers", func(w http.ResponseWriter, r *http.Request) {
3333
testMethod(t, r, "POST")
34-
w.Write([]byte(createBrowserRespBody))
34+
_, err := w.Write([]byte(createBrowserRespBody))
35+
if err != nil {
36+
t.Errorf("returned error: %#v", err)
37+
}
3538
})
3639

3740
resp, _, err := testClient.CreateBrowserCheck(&BrowserCheckInput{

syntheticsclient/create_httpcheck_test.go

+4-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,10 @@ func TestCreateHttpCheck(t *testing.T) {
3131

3232
testMux.HandleFunc("/v2/checks/http", func(w http.ResponseWriter, r *http.Request) {
3333
testMethod(t, r, "POST")
34-
w.Write([]byte(createHttpBody))
34+
_, err := w.Write([]byte(createHttpBody))
35+
if err != nil {
36+
t.Errorf("returned error: %#v", err)
37+
}
3538
})
3639

3740
resp, _, err := testClient.CreateHttpCheck(&HttpCheckInput{

syntheticsclient/delete_browsercheck_test.go

+4-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,10 @@ func TestDeleteBrowseCheck(t *testing.T) {
2929

3030
testMux.HandleFunc("/v2/checks/real_browsers/10", func(w http.ResponseWriter, r *http.Request) {
3131
testMethod(t, r, "DELETE")
32-
w.Write([]byte(deleteBrowserRespBody))
32+
_, err := w.Write([]byte(deleteBrowserRespBody))
33+
if err != nil {
34+
t.Errorf("returned error: %#v", err)
35+
}
3336
})
3437

3538
resp, err := testClient.DeleteBrowserCheck(10)

syntheticsclient/delete_httpcheck_test.go

+4-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,10 @@ func TestDeleteHttpCheck(t *testing.T) {
2929

3030
testMux.HandleFunc("/v2/checks/http/19", func(w http.ResponseWriter, r *http.Request) {
3131
testMethod(t, r, "DELETE")
32-
w.Write([]byte(deleteHttpRespBody))
32+
_, err := w.Write([]byte(deleteHttpRespBody))
33+
if err != nil {
34+
t.Errorf("returned error: %#v", err)
35+
}
3336
})
3437

3538
resp, err := testClient.DeleteHttpCheck(19)

syntheticsclient/get_check_test.go

+4-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,10 @@ func TestGetBrowserCheck(t *testing.T) {
3232

3333
testMux.HandleFunc("/v2/checks/206537", func(w http.ResponseWriter, r *http.Request) {
3434
testMethod(t, r, "GET")
35-
w.Write([]byte(getBrowserBody))
35+
_, err := w.Write([]byte(getBrowserBody))
36+
if err != nil {
37+
t.Errorf("returned error: %#v", err)
38+
}
3639
})
3740

3841
resp, _, err := testClient.GetCheck(206537)

syntheticsclient/update_browsercheck_test.go

+4-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,10 @@ func TestUpdateBrowserCheck(t *testing.T) {
5656

5757
testMux.HandleFunc("/v2/checks/real_browsers/10", func(w http.ResponseWriter, r *http.Request) {
5858
testMethod(t, r, "PUT")
59-
w.Write([]byte(updateBrowserCheckResponse))
59+
_, err := w.Write([]byte(updateBrowserCheckResponse))
60+
if err != nil {
61+
t.Errorf("returned error: %#v", err)
62+
}
6063
})
6164

6265
resp, _, err := testClient.UpdateBrowserCheck(10, updateBrowserCheckBody)

syntheticsclient/update_httpcheck_test.go

+4-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,10 @@ func TestUpdateHttpCheck(t *testing.T) {
3131

3232
testMux.HandleFunc("/v2/checks/http/19", func(w http.ResponseWriter, r *http.Request) {
3333
testMethod(t, r, "PUT")
34-
w.Write([]byte(updateResponse))
34+
_, err := w.Write([]byte(updateResponse))
35+
if err != nil {
36+
t.Errorf("returned error: %#v", err)
37+
}
3538
})
3639

3740
resp, _, err := testClient.UpdateHttpCheck(19, updateBody)

0 commit comments

Comments
 (0)