Esempio n. 1
0
func TestProspectorInitInputTypeLogError(t *testing.T) {

	prospector := Prospector{
		config: prospectorConfig{},
	}

	states := file.NewStates()
	states.SetStates([]file.State{})
	err := prospector.Init(*states)
	// Error should be returned because no path is set
	assert.Error(t, err)
}
Esempio n. 2
0
func New(registryFile string) (*Registrar, error) {

	r := &Registrar{
		registryFile: registryFile,
		done:         make(chan struct{}),
		states:       file.NewStates(),
		Channel:      make(chan []*Event, 1),
		wg:           sync.WaitGroup{},
	}
	err := r.Init()

	return r, err
}
Esempio n. 3
0
func New(registryFile string, out publisher.SuccessLogger) (*Registrar, error) {

	r := &Registrar{
		registryFile: registryFile,
		done:         make(chan struct{}),
		states:       file.NewStates(),
		Channel:      make(chan []*input.Event, 1),
		out:          out,
		wg:           sync.WaitGroup{},
	}
	err := r.Init()

	return r, err
}
Esempio n. 4
0
// TestInit checks that the correct states are in a prospector after the init phase
// This means only the ones that match the glob and not exclude files
func TestInit(t *testing.T) {

	for _, test := range initStateTests {
		p := ProspectorLog{
			Prospector: &Prospector{
				states: &file.States{},
				outlet: TestOutlet{},
			},
			config: prospectorConfig{
				Paths: test.paths,
			},
		}
		states := file.NewStates()
		states.SetStates(test.states)
		err := p.Init(*states)
		assert.NoError(t, err)
		assert.Equal(t, test.count, p.Prospector.states.Count())
	}

}