Example #1
0
func (suite *DurableQueueSuite) TestDestReturnsTheDestination() {
	q := queue.NewDurableQueue(suite.Pool, "foo", "bar")

	dest := q.Dest()

	suite.Assert().Equal("bar", dest)
}
Example #2
0
func (suite *DurableQueueSuite) TestSetDestUpdatesTheDestination() {
	q := queue.NewDurableQueue(suite.Pool, "foo", "old")

	old := q.Dest()
	new := q.SetDest("new")

	suite.Assert().Equal("old", old)
	suite.Assert().Equal("new", new)
}
Example #3
0
func (suite *DurableQueueSuite) TestPullDelegatesToProcessor() {
	p := &MockProcessor{}
	p.On("PullTo",
		mock.Anything, "foo", "bar", time.Second).
		Return([]byte("baz"), fmt.Errorf("woot")).Once()

	q := queue.NewDurableQueue(suite.Pool, "foo", "bar")
	q.SetProcessor(p)
	data, err := q.Pull(time.Second)

	suite.Assert().Equal([]byte("baz"), data)
	suite.Assert().Equal("woot", err.Error())
}