Beispiel #1
0
	. "github.com/onsi/gomega"
)

var _ = Describe("loggregator logs repository", func() {
	var (
		fakeConsumer       *testapi.FakeLoggregatorConsumer
		logsRepo           LogsRepository
		configRepo         core_config.ReadWriter
		fakeTokenRefresher *testapi.FakeAuthenticationRepository
	)

	BeforeEach(func() {
		BufferTime = 1 * time.Millisecond
		fakeConsumer = testapi.NewFakeLoggregatorConsumer()
		configRepo = testconfig.NewRepositoryWithDefaults()
		configRepo.SetLoggregatorEndpoint("loggregator-server.test.com")
		configRepo.SetAccessToken("the-access-token")
		fakeTokenRefresher = &testapi.FakeAuthenticationRepository{}
	})

	JustBeforeEach(func() {
		logsRepo = NewLoggregatorLogsRepository(configRepo, fakeConsumer, fakeTokenRefresher)
	})

	Describe("RecentLogsFor", func() {
		Context("when a noaa_errors.UnauthorizedError occurs", func() {
			BeforeEach(func() {
				fakeConsumer.RecentReturns.Err = []error{
					noaa_errors.NewUnauthorizedError("i'm sorry dave"),
					nil,
				}