Skip to content

Commit

Permalink
removal of deprecated functions in test file
Browse files Browse the repository at this point in the history
Signed-off-by: manisha kumari <manisha.kumari@calsoftinc.com>
  • Loading branch information
ManishaKumari295 committed May 30, 2024
1 parent 753e018 commit 5904f40
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ jobs:
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Go 1.14
- name: Set up Go 1.22
uses: actions/setup-go@v1
with:
go-version: 1.14
go-version: 1.22
id: go
- name: Test
run: go test -v ./...
run: go test -v ./...
6 changes: 3 additions & 3 deletions main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package main

import (
"encoding/json"
"io/ioutil"
"io"
"net/http"
"net/http/httptest"
"os"
Expand Down Expand Up @@ -108,7 +108,7 @@ func TestSendMessage(t *testing.T) {
event := corev2.FixtureEvent("entity1", "check1")

var apiStub = httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
body, _ := ioutil.ReadAll(r.Body)
body, _ := io.ReadAll(r.Body)
expectedBody := `{"channel":"#test","attachments":[{"color":"good","fallback":"RESOLVED - entity1/check1:","title":"Description","text":"","fields":[{"title":"Status","value":"Resolved","short":false},{"title":"Entity","value":"entity1","short":true},{"title":"Check","value":"check1","short":true}]}]}`
assert.Equal(expectedBody, string(body))
w.WriteHeader(http.StatusOK)
Expand All @@ -125,7 +125,7 @@ func TestSendMessage(t *testing.T) {

func TestMain(t *testing.T) {
assert := assert.New(t)
file, _ := ioutil.TempFile(os.TempDir(), "sensu-handler-slack-")
file, _ := os.CreateTemp(os.TempDir(), "sensu-handler-slack-")
defer func() {
_ = os.Remove(file.Name())
}()
Expand Down

0 comments on commit 5904f40

Please sign in to comment.