github.com/leg100/ots@v0.0.7-0.20210919080622-034055ced4bd/agent/job_getter_mock.go (about)

     1  package agent
     2  
     3  import "github.com/leg100/ots"
     4  
     5  type MockJobGetter struct {
     6  	queue chan ots.Job
     7  }
     8  
     9  func NewMockJobGetter(job ...ots.Job) *MockJobGetter {
    10  	queue := make(chan ots.Job, len(job))
    11  	for _, r := range job {
    12  		queue <- r
    13  	}
    14  	return &MockJobGetter{queue: queue}
    15  }
    16  
    17  func (s *MockJobGetter) GetJob() <-chan ots.Job {
    18  	return s.queue
    19  }