Skip to content

Commit

Permalink
making linter happy
Browse files Browse the repository at this point in the history
  • Loading branch information
Claire.Nicholas authored and Claire.Nicholas committed Nov 27, 2023
1 parent d4a89a0 commit 0868ba6
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 5 deletions.
3 changes: 2 additions & 1 deletion cmd/vela-slack/plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ func (p *Plugin) Exec() error {
attachments []slack.Attachment
err error
)

logrus.Debug("running plugin with provided configuration")

// clean up newlines that could invalidate JSON
Expand All @@ -105,9 +106,9 @@ func (p *Plugin) Exec() error {
// parse the slack message file
if len(p.Path) != 0 {
logrus.Infof("Parsing provided template file, %s", p.Path)

if p.Remote {
attachments, err = getRemoteAttachment(p)

} else {
attachments, err = getAttachmentFromFile(p)
}
Expand Down
26 changes: 22 additions & 4 deletions cmd/vela-slack/plugin_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,11 @@ func TestSlack_Plugin_Exec_Remote_Attachment(t *testing.T) {
if err != nil {
t.Errorf("ReadFile error: %v", err)
}
w.Write(bytes)
_, err = w.Write(bytes)
if err != nil {
t.Errorf("Write error: %v", err)
}

w.WriteHeader(http.StatusOK)
}))
defer ta.Close()
Expand Down Expand Up @@ -171,7 +175,11 @@ func TestSlack_Plugin_Exec_Bad_Remote_Attachment_Parse(t *testing.T) {
if err != nil {
t.Errorf("ReadFile error: %v", err)
}
w.Write(bytes)
_, err = w.Write(bytes)
if err != nil {
t.Errorf("Write error: %v", err)
}

w.WriteHeader(http.StatusOK)
}))
defer ta.Close()
Expand Down Expand Up @@ -205,7 +213,12 @@ func TestSlack_Plugin_Exec_Bad_Remote_Attachment(t *testing.T) {
if err != nil {
t.Errorf("ReadFile error: %v", err)
}
w.Write(bytes)

_, err = w.Write(bytes)
if err != nil {
t.Errorf("Write error: %v", err)
}

w.WriteHeader(http.StatusOK)
}))
defer ta.Close()
Expand Down Expand Up @@ -239,7 +252,12 @@ func TestSlack_Plugin_Exec_Bad_Remote_Attachment_Unmarshal(t *testing.T) {
if err != nil {
t.Errorf("ReadFile error: %v", err)
}
w.Write(bytes)

_, err = w.Write(bytes)
if err != nil {
t.Errorf("Write error: %v", err)
}

w.WriteHeader(http.StatusOK)
}))
defer ta.Close()
Expand Down

0 comments on commit 0868ba6

Please sign in to comment.