예제 #1
0
func (s *GnatsdTestSuite) TestPubSub() {
	jobUUID := queue.UUID()

	w := make(chan bool)
	processor := func(q queue.Connection, d db.Connection, m *queue.Message) {
		assert.Equal(s.T(), "http://example.com", m.URL)
		assert.Equal(s.T(), jobUUID, m.JobUUID)
		assert.Equal(s.T(), 0, m.Depth)
		w <- true
	}

	s.conn.Subscribe(processor)
	s.conn.Publish(jobUUID, "http://example.com", 0)
	<-w
}
예제 #2
0
func (s *RiakTestSuite) SetupTest() {
	s.jobUUID = queue.UUID()

	err := s.conn.CreateJob(s.jobUUID)
	assert.NoError(s.T(), err)
}
예제 #3
0
func (s *Server) createNewJob() (string, error) {
	jobUUID := queue.UUID()
	return jobUUID, s.context.Db.CreateJob(jobUUID)
}