1
0
Fork 0
mirror of https://github.com/kubernetes-sigs/node-feature-discovery.git synced 2025-03-31 04:04:51 +00:00
node-feature-discovery/test_sources.go

29 lines
797 B
Go
Raw Normal View History

package main
////////////////////////////////////////////////////////////////////////////////
// Fake Source (used only for testing)
// Implements main.FeatureSource.
type fakeSource struct{}
func (s fakeSource) Name() string { return "fake" }
func (s fakeSource) Discover() ([]string, error) {
features := []string{}
// Adding three fake features.
features = append(features, "fakefeature1", "fakefeature2", "fakefeature3")
return features, nil
}
////////////////////////////////////////////////////////////////////////////////
// Fake Panic Source (used only for testing)
// Implements main.FeatureSource.
type fakePanicSource struct{}
func (s fakePanicSource) Name() string { return "fakepanic" }
func (s fakePanicSource) Discover() ([]string, error) {
panic("fake panic error")
}