mirror of
https://github.com/kubernetes-sigs/node-feature-discovery.git
synced 2025-03-30 19:54:46 +00:00
Added fake feature source for testing purposes.
This commit is contained in:
parent
31ec89474a
commit
af0f97dcef
2 changed files with 17 additions and 0 deletions
1
main.go
1
main.go
|
@ -94,6 +94,7 @@ func main() {
|
||||||
cpuidSource{},
|
cpuidSource{},
|
||||||
rdtSource{},
|
rdtSource{},
|
||||||
pstateSource{},
|
pstateSource{},
|
||||||
|
fakeSource{},
|
||||||
}
|
}
|
||||||
|
|
||||||
sources := []FeatureSource{}
|
sources := []FeatureSource{}
|
||||||
|
|
16
sources.go
16
sources.go
|
@ -102,3 +102,19 @@ func (s pstateSource) Discover() ([]string, error) {
|
||||||
|
|
||||||
return features, nil
|
return features, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// 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
|
||||||
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue