func (m Mock) StatesWithStatus(status PreloadStatus) (domains []DomainState, err error) {
	if m.state.FailCalls == true {
		return domains, errors.New("forced failure")
	}
	for _, s := range m.ds {
		if s.Status == status {
			domains = append(domains, s)
		}
	}
	return domains, nil
}
StatesWithStatus mock method
package database
import "errors"
type Mock struct {
	ds map[string]DomainState
	state *MockController
}
type MockController struct {
	FailCalls bool
}
func NewMock() (m Mock, mc *MockController) {
	mc = &MockController{}
	m = Mock{
		ds:    map[string]DomainState{},
		state: mc,
	}
	return m, mc
}
func (m Mock) PutStates(updates []DomainState, logf func(format string, args ...interface{})) error {
	if m.state.FailCalls == true {
		return errors.New("forced failure")
	}
	for _, s := range updates {
		m.PutState(s)
	}
	return nil
}
func (m Mock) PutState(update DomainState) error {
	if m.state.FailCalls == true {
		return errors.New("forced failure")
	}
	m.ds[update.Name] = update
	return nil
}
func (m Mock) StateForDomain(domain string) (state DomainState, err error) {
	if m.state.FailCalls == true {
		return state, errors.New("forced failure")
	}
	s, ok := m.ds[domain]
	if ok {
		return s, nil
	}
	return DomainState{Status: StatusUnknown}, nil
}
func (m Mock) AllDomainStates() (states []DomainState, err error) {
	if m.state.FailCalls == true {
		return states, errors.New("forced failure")
	}
	for _, s := range m.ds {
		states = append(states, s)
	}
	return states, nil
}