Skip to content

Commit

Permalink
Add drain reset function
Browse files Browse the repository at this point in the history
  • Loading branch information
nicklas-dohrn committed Feb 19, 2025
1 parent 4966266 commit 82dc11c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
3 changes: 1 addition & 2 deletions src/pkg/egress/syslog/https_batch_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ var _ = Describe("HTTPS_batch", func() {

BeforeEach(func() {
drain = newBatchMockDrain(200)
drain.Reset()
b = buildURLBinding(
drain.URL,
"test-app-id",
Expand Down Expand Up @@ -132,8 +133,6 @@ func newBatchMockDrain(status int) *SpyDrain {
Expect(err).ToNot(HaveOccurred())
defer r.Body.Close()

println(body)

message := &rfc5424.Message{}

messages := bytes.SplitAfter(body, []byte("\n"))
Expand Down
5 changes: 5 additions & 0 deletions src/pkg/egress/syslog/https_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,11 @@ type SpyDrain struct {
headers []http.Header
}

func (d *SpyDrain) Reset() {
d.messages = nil
d.headers = nil
}

func (d *SpyDrain) appendMessage(message *rfc5424.Message) {
d.mu.Lock()
defer d.mu.Unlock()
Expand Down

0 comments on commit 82dc11c

Please sign in to comment.