Skip to content

Commit

Permalink
Update Github Workflow pipeline (testacc, lint, pr template) (#17)
Browse files Browse the repository at this point in the history
* add testacc and linting to workflows

* update old rigor tests to stop ci lint from failing

Co-authored-by: greatestusername-splunk <[email protected]>
  • Loading branch information
1 parent 32dd831 commit 198745b
Show file tree
Hide file tree
Showing 9 changed files with 98 additions and 7 deletions.
33 changes: 33 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<!-- Please refer to our contributing docs for any questions on submitting a pull request -->
<!-- Issues are expected for bug fixes and features. -->
Resolves #ISSUE_NUMBER

----

### Before the change?
<!-- Please describe the current behavior that you are modifying. -->

*

### After the change?
<!-- Please describe the behavior or changes that are being added by this PR. -->

*

### Pull request checklist
- [ ] Acceptance Tests have been updated, run (`make testacc`), and pasted in this PR (for bug fixes / features)
- [ ] Docs have been reviewed and added / updated if needed (for bug fixes / features)

#### Acceptance Test Output
<!-- Please paste the results of acceptance tests `make testacc` in the codeblock here. -->
```
```

### Does this introduce a breaking change?
<!-- If this introduces a breaking change make sure to note it here any what the impact might be -->

- [ ] Yes
- [ ] No

----
37 changes: 37 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Terraform Provider CI checks workflow.
name: CI Checks

# This GitHub action runs your tests for each pull request and push.
# Optionally, you can turn it on using a schedule for regular testing.
on:
pull_request:
paths-ignore:
- 'README.md'
push:
paths-ignore:
- 'README.md'

# Testing only needs permissions to read the repository contents.
permissions:
contents: read

jobs:
# Ensure project builds before running testing matrix
build:
name: Build
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe # v4.1.0
with:
go-version-file: 'go.mod'
cache: true
- run: go mod download
- name: Run linters
uses: golangci/golangci-lint-action@3a919529898de77ec3da873e3063ca4b10e7f5cc # v3.7.0
with:
version: latest
- run: make lint
- run: make testacc
- run: go build -v ./syntheticsclientv2
5 changes: 4 additions & 1 deletion syntheticsclient/create_browsercheck_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,10 @@ func TestCreateBrowseCheck(t *testing.T) {

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

resp, _, err := testClient.CreateBrowserCheck(&BrowserCheckInput{
Expand Down
5 changes: 4 additions & 1 deletion syntheticsclient/create_httpcheck_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,10 @@ func TestCreateHttpCheck(t *testing.T) {

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

resp, _, err := testClient.CreateHttpCheck(&HttpCheckInput{
Expand Down
5 changes: 4 additions & 1 deletion syntheticsclient/delete_browsercheck_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,10 @@ func TestDeleteBrowseCheck(t *testing.T) {

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

resp, err := testClient.DeleteBrowserCheck(10)
Expand Down
5 changes: 4 additions & 1 deletion syntheticsclient/delete_httpcheck_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,10 @@ func TestDeleteHttpCheck(t *testing.T) {

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

resp, err := testClient.DeleteHttpCheck(19)
Expand Down
5 changes: 4 additions & 1 deletion syntheticsclient/get_check_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,10 @@ func TestGetBrowserCheck(t *testing.T) {

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

resp, _, err := testClient.GetCheck(206537)
Expand Down
5 changes: 4 additions & 1 deletion syntheticsclient/update_browsercheck_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,10 @@ func TestUpdateBrowserCheck(t *testing.T) {

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

resp, _, err := testClient.UpdateBrowserCheck(10, updateBrowserCheckBody)
Expand Down
5 changes: 4 additions & 1 deletion syntheticsclient/update_httpcheck_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,10 @@ func TestUpdateHttpCheck(t *testing.T) {

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

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

0 comments on commit 198745b

Please sign in to comment.