mirror of
https://github.com/kubernetes-sigs/node-feature-discovery.git
synced 2025-03-28 02:37:11 +00:00
Merge pull request #26 from balajismaniam/fake-source
Automatic merge from submit-queue Added fake feature source for testing purposes. The fake source adds three fake features. I tested it manually. ```sh >docker run quay.io/kubernetes_incubator/node-feature-discovery:31ec894-dirty --source=fake --no-publish 2016-10-25 22:04:09.446666 I | node.alpha.intel.com/node-feature-discovery.version = 31ec894-dirty 2016-10-25 22:04:09.446939 I | node.alpha.intel.com/31ec894-dirty-fake-fakefeature1 = true 2016-10-25 22:04:09.447595 I | node.alpha.intel.com/31ec894-dirty-fake-fakefeature2 = true 2016-10-25 22:04:09.447659 I | node.alpha.intel.com/31ec894-dirty-fake-fakefeature3 = true ```
This commit is contained in:
commit
2e58484ea1
2 changed files with 17 additions and 0 deletions
1
main.go
1
main.go
|
@ -98,6 +98,7 @@ func main() {
|
|||
cpuidSource{},
|
||||
rdtSource{},
|
||||
pstateSource{},
|
||||
fakeSource{},
|
||||
}
|
||||
|
||||
sources := []FeatureSource{}
|
||||
|
|
16
sources.go
16
sources.go
|
@ -102,3 +102,19 @@ func (s pstateSource) Discover() ([]string, error) {
|
|||
|
||||
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