Skip to content

Commit

Permalink
Updating to ginkgo v2. Custom reporters are deprecated/removed
Browse files Browse the repository at this point in the history
  • Loading branch information
KevinJCross committed Oct 4, 2022
1 parent da0ac9d commit 853a9bd
Show file tree
Hide file tree
Showing 25 changed files with 59 additions and 415 deletions.
2 changes: 1 addition & 1 deletion chug/chug_suite_test.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package chug_test

import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"

"testing"
Expand Down
41 changes: 20 additions & 21 deletions chug/chug_test.go
Original file line number Diff line number Diff line change
@@ -1,21 +1,20 @@
package chug_test

import (
"code.cloudfoundry.org/lager/chug"
"errors"
"io"
"time"

"code.cloudfoundry.org/lager"
. "code.cloudfoundry.org/lager/chug"

. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
)

var _ = Describe("Chug", func() {
var (
logger lager.Logger
stream chan Entry
stream chan chug.Entry
pipeReader *io.PipeReader
pipeWriter *io.PipeWriter
)
Expand All @@ -24,11 +23,11 @@ var _ = Describe("Chug", func() {
pipeReader, pipeWriter = io.Pipe()
logger = lager.NewLogger("chug-test")
logger.RegisterSink(lager.NewWriterSink(pipeWriter, lager.DEBUG))
stream = make(chan Entry, 100)
stream = make(chan chug.Entry, 100)
})

JustBeforeEach(func() {
go Chug(pipeReader, stream)
go chug.Chug(pipeReader, stream)
})

AfterEach(func() {
Expand All @@ -44,7 +43,7 @@ var _ = Describe("Chug", func() {

entry := <-stream
Expect(entry.IsLager).To(BeTrue())
Expect(entry.Log).To(MatchLogEntry(LogEntry{
Expect(entry.Log).To(MatchLogEntry(chug.LogEntry{
LogLevel: lager.DEBUG,
Source: "chug-test",
Message: "chug-test.chug",
Expand All @@ -53,7 +52,7 @@ var _ = Describe("Chug", func() {

entry = <-stream
Expect(entry.IsLager).To(BeTrue())
Expect(entry.Log).To(MatchLogEntry(LogEntry{
Expect(entry.Log).To(MatchLogEntry(chug.LogEntry{
LogLevel: lager.INFO,
Source: "chug-test",
Message: "chug-test.again",
Expand All @@ -72,7 +71,7 @@ var _ = Describe("Chug", func() {
It("should include the error", func() {
data := lager.Data{"some-float": 3.0, "some-string": "foo"}
logger.Error("chug", errors.New("some-error"), data)
Expect((<-stream).Log).To(MatchLogEntry(LogEntry{
Expect((<-stream).Log).To(MatchLogEntry(chug.LogEntry{
LogLevel: lager.ERROR,
Source: "chug-test",
Message: "chug-test.chug",
Expand All @@ -87,7 +86,7 @@ var _ = Describe("Chug", func() {
It("should not take the error out of the data map", func() {
data := lager.Data{"some-float": 3.0, "some-string": "foo", "error": "some-error"}
logger.Info("chug", data)
Expect((<-stream).Log).To(MatchLogEntry(LogEntry{
Expect((<-stream).Log).To(MatchLogEntry(chug.LogEntry{
LogLevel: lager.INFO,
Source: "chug-test",
Message: "chug-test.chug",
Expand All @@ -109,39 +108,39 @@ var _ = Describe("Chug", func() {
nestedSession = firstSession.Session("nested-session-2")
nestedSession.Info("modernify")

Expect((<-stream).Log).To(MatchLogEntry(LogEntry{
Expect((<-stream).Log).To(MatchLogEntry(chug.LogEntry{
LogLevel: lager.INFO,
Source: "chug-test",
Message: "chug-test.first-session.encabulate",
Session: "1",
Data: lager.Data{},
}))

Expect((<-stream).Log).To(MatchLogEntry(LogEntry{
Expect((<-stream).Log).To(MatchLogEntry(chug.LogEntry{
LogLevel: lager.INFO,
Source: "chug-test",
Message: "chug-test.first-session.nested-session-1.baconize",
Session: "1.1",
Data: lager.Data{},
}))

Expect((<-stream).Log).To(MatchLogEntry(LogEntry{
Expect((<-stream).Log).To(MatchLogEntry(chug.LogEntry{
LogLevel: lager.INFO,
Source: "chug-test",
Message: "chug-test.first-session.remodulate",
Session: "1",
Data: lager.Data{},
}))

Expect((<-stream).Log).To(MatchLogEntry(LogEntry{
Expect((<-stream).Log).To(MatchLogEntry(chug.LogEntry{
LogLevel: lager.INFO,
Source: "chug-test",
Message: "chug-test.first-session.nested-session-1.ergonomize",
Session: "1.1",
Data: lager.Data{},
}))

Expect((<-stream).Log).To(MatchLogEntry(LogEntry{
Expect((<-stream).Log).To(MatchLogEntry(chug.LogEntry{
LogLevel: lager.INFO,
Source: "chug-test",
Message: "chug-test.first-session.nested-session-2.modernify",
Expand All @@ -165,7 +164,7 @@ var _ = Describe("Chug", func() {

entry := <-stream
Expect(entry.IsLager).To(BeTrue())
Expect(entry.Log).To(MatchLogEntry(LogEntry{
Expect(entry.Log).To(MatchLogEntry(chug.LogEntry{
LogLevel: lager.DEBUG,
Source: "chug-test",
Message: "chug-test.chug",
Expand All @@ -174,7 +173,7 @@ var _ = Describe("Chug", func() {

entry = <-stream
Expect(entry.IsLager).To(BeTrue())
Expect(entry.Log).To(MatchLogEntry(LogEntry{
Expect(entry.Log).To(MatchLogEntry(chug.LogEntry{
LogLevel: lager.INFO,
Source: "chug-test",
Message: "chug-test.again",
Expand All @@ -186,7 +185,7 @@ var _ = Describe("Chug", func() {

Context("handling lager JSON that is surrounded by non-JSON", func() {
var input []byte
var entry Entry
var entry chug.Entry

JustBeforeEach(func() {
input = []byte(`[some-component][e]{"timestamp":"1407102779.028711081","source":"chug-test","message":"chug-test.chug","log_level":0,"data":{"some-float":3,"some-string":"foo"}}...some trailing stuff`)
Expand All @@ -211,7 +210,7 @@ var _ = Describe("Chug", func() {

Context("handling malformed/non-lager data", func() {
var input []byte
var entry Entry
var entry chug.Entry

JustBeforeEach(func() {
pipeWriter.Write(input)
Expand Down Expand Up @@ -273,7 +272,7 @@ var _ = Describe("Chug", func() {

Context("when writing is complete", func() {
var input []byte
var entry Entry
var entry chug.Entry

BeforeEach(func() {
input = []byte("hello")
Expand All @@ -295,7 +294,7 @@ var _ = Describe("Chug", func() {
})
})

func itReturnsRawData(entry Entry, input []byte) {
func itReturnsRawData(entry chug.Entry, input []byte) {
It("returns raw data", func() {
Expect(entry.IsLager).To(BeFalse())
Expect(entry.Log).To(BeZero())
Expand Down
155 changes: 0 additions & 155 deletions ginkgoreporter/ginkgo_reporter.go

This file was deleted.

13 changes: 0 additions & 13 deletions ginkgoreporter/ginkgoreporter_suite_test.go

This file was deleted.

Loading

0 comments on commit 853a9bd

Please sign in to comment.