mirror of
https://github.com/kubernetes-sigs/node-feature-discovery.git
synced 2025-03-16 21:38:23 +00:00
Fix unit tests (#98)
* Update unit tests Make the unit tests pass, again. * Update project dependencies * Enable unittests in travis
This commit is contained in:
parent
680f55d07b
commit
b999a1a6f4
6 changed files with 140 additions and 156 deletions
|
@ -5,3 +5,4 @@ services:
|
||||||
|
|
||||||
script:
|
script:
|
||||||
- docker build -t quay.io/kubernetes_incubator/node-feature-discovery .
|
- docker build -t quay.io/kubernetes_incubator/node-feature-discovery .
|
||||||
|
- docker run --entrypoint=go quay.io/kubernetes_incubator/node-feature-discovery test
|
||||||
|
|
271
glide.lock
generated
271
glide.lock
generated
|
@ -1,43 +1,18 @@
|
||||||
hash: f43fa3ac02ea7f1a8669981c2244722bf001e9237002d659d0c0a508d9a067c9
|
hash: 472684ea7631ee1754656f2dd2f76d419b3cb360c2339fdf8260e95e0f053726
|
||||||
updated: 2017-08-25T19:17:17.781888283+08:00
|
updated: 2018-02-21T13:16:26.752071939+02:00
|
||||||
imports:
|
imports:
|
||||||
- name: cloud.google.com/go
|
|
||||||
version: 3b1ae45394a234c385be014e9a488f2bb6eef821
|
|
||||||
subpackages:
|
|
||||||
- compute/metadata
|
|
||||||
- internal
|
|
||||||
- name: github.com/blang/semver
|
|
||||||
version: 31b736133b98f26d5e078ec9eb591666edfd091f
|
|
||||||
- name: github.com/coreos/go-oidc
|
|
||||||
version: 5644a2f50e2d2d5ba0b474bc5bc55fea1925936d
|
|
||||||
subpackages:
|
|
||||||
- http
|
|
||||||
- jose
|
|
||||||
- key
|
|
||||||
- oauth2
|
|
||||||
- oidc
|
|
||||||
- name: github.com/coreos/pkg
|
|
||||||
version: fa29b1d70f0beaddd4c7021607cc3c3be8ce94b8
|
|
||||||
subpackages:
|
|
||||||
- health
|
|
||||||
- httputil
|
|
||||||
- timeutil
|
|
||||||
- name: github.com/davecgh/go-spew
|
- name: github.com/davecgh/go-spew
|
||||||
version: 6d212800a42e8ab5c146b8ace3490ee17e5225f9
|
version: 87df7c60d5820d0f8ae11afede5aa52325c09717
|
||||||
subpackages:
|
subpackages:
|
||||||
- spew
|
- spew
|
||||||
- name: github.com/docker/distribution
|
|
||||||
version: cd27f179f2c10c5d300e6d09025b538c475b0d51
|
|
||||||
subpackages:
|
|
||||||
- digest
|
|
||||||
- reference
|
|
||||||
- name: github.com/docopt/docopt-go
|
- name: github.com/docopt/docopt-go
|
||||||
version: 784ddc588536785e7299f7272f39101f7faccc3f
|
version: 784ddc588536785e7299f7272f39101f7faccc3f
|
||||||
- name: github.com/emicklei/go-restful
|
- name: github.com/emicklei/go-restful
|
||||||
version: 89ef8af493ab468a45a42bb0d89a06fccdd2fb22
|
version: ff4f55a206334ef123e4f79bbf348980da81ca46
|
||||||
subpackages:
|
subpackages:
|
||||||
- log
|
- log
|
||||||
- swagger
|
- name: github.com/emicklei/go-restful-swagger12
|
||||||
|
version: dcef7f55730566d41eae5db10e7d6981829720f6
|
||||||
- name: github.com/ghodss/yaml
|
- name: github.com/ghodss/yaml
|
||||||
version: 73d445a93680fa1a78ae23a5839bad48f32ba1ee
|
version: 73d445a93680fa1a78ae23a5839bad48f32ba1ee
|
||||||
- name: github.com/go-openapi/jsonpointer
|
- name: github.com/go-openapi/jsonpointer
|
||||||
|
@ -49,22 +24,38 @@ imports:
|
||||||
- name: github.com/go-openapi/swag
|
- name: github.com/go-openapi/swag
|
||||||
version: 1d0bd113de87027671077d3c71eb3ac5d7dbba72
|
version: 1d0bd113de87027671077d3c71eb3ac5d7dbba72
|
||||||
- name: github.com/gogo/protobuf
|
- name: github.com/gogo/protobuf
|
||||||
version: e18d7aa8f8c624c915db340349aad4c49b10d173
|
version: c0656edd0d9eab7c66d1eb0c568f9039345796f7
|
||||||
subpackages:
|
subpackages:
|
||||||
- proto
|
- proto
|
||||||
- sortkeys
|
- sortkeys
|
||||||
- name: github.com/golang/glog
|
- name: github.com/golang/glog
|
||||||
version: 44145f04b68cf362d9c4df2182967c2275eaefed
|
version: 44145f04b68cf362d9c4df2182967c2275eaefed
|
||||||
- name: github.com/golang/protobuf
|
- name: github.com/golang/protobuf
|
||||||
version: 8616e8ee5e20a1704615e6c8d7afcdac06087a67
|
version: 4bd1920723d7b7c925de087aa32e2187708897f7
|
||||||
subpackages:
|
subpackages:
|
||||||
- proto
|
- proto
|
||||||
|
- ptypes
|
||||||
|
- ptypes/any
|
||||||
|
- ptypes/duration
|
||||||
|
- ptypes/timestamp
|
||||||
|
- name: github.com/google/btree
|
||||||
|
version: 7d79101e329e5a3adf994758c578dab82b90c017
|
||||||
- name: github.com/google/gofuzz
|
- name: github.com/google/gofuzz
|
||||||
version: bbcb9da2d746f8bdbd6a936686a0a6067ada0ec5
|
version: 44d81051d367757e1c7c6a5a86423ece9afcf63c
|
||||||
- name: github.com/jonboulle/clockwork
|
- name: github.com/googleapis/gnostic
|
||||||
version: 72f9bd7c4e0c2a40055ab3d0f09654f730cce982
|
version: 0c5108395e2debce0d731cf0287ddf7242066aba
|
||||||
|
subpackages:
|
||||||
|
- OpenAPIv2
|
||||||
|
- compiler
|
||||||
|
- extensions
|
||||||
|
- name: github.com/gregjones/httpcache
|
||||||
|
version: 787624de3eb7bd915c329cba748687a3b22666a6
|
||||||
|
subpackages:
|
||||||
|
- diskcache
|
||||||
|
- name: github.com/json-iterator/go
|
||||||
|
version: 36b14963da70d11297d313183d7e6388c8510e1e
|
||||||
- name: github.com/juju/ratelimit
|
- name: github.com/juju/ratelimit
|
||||||
version: 77ed1c8a01217656d2080ad51981f6e99adaa177
|
version: 5b9ff866471762aa2ab2dced63c9fb6f53921342
|
||||||
- name: github.com/klauspost/cpuid
|
- name: github.com/klauspost/cpuid
|
||||||
version: ae7887de9fa5d2db4eaa8174a7eff2c1ac00f2da
|
version: ae7887de9fa5d2db4eaa8174a7eff2c1ac00f2da
|
||||||
- name: github.com/mailru/easyjson
|
- name: github.com/mailru/easyjson
|
||||||
|
@ -73,10 +64,10 @@ imports:
|
||||||
- buffer
|
- buffer
|
||||||
- jlexer
|
- jlexer
|
||||||
- jwriter
|
- jwriter
|
||||||
- name: github.com/pborman/uuid
|
- name: github.com/peterbourgon/diskv
|
||||||
version: ca53cad383cad2479bbba7f7a1a05797ec1386e4
|
version: 5f041e8faa004a95c88a202771f4cc3e991971e6
|
||||||
- name: github.com/pmezard/go-difflib
|
- name: github.com/pmezard/go-difflib
|
||||||
version: d8ed2627bdf02c080bf22230dbb337003b7aba2d
|
version: 792786c7400a136282c1664665ae0a8db921c6c2
|
||||||
subpackages:
|
subpackages:
|
||||||
- difflib
|
- difflib
|
||||||
- name: github.com/PuerkitoBio/purell
|
- name: github.com/PuerkitoBio/purell
|
||||||
|
@ -84,20 +75,16 @@ imports:
|
||||||
- name: github.com/PuerkitoBio/urlesc
|
- name: github.com/PuerkitoBio/urlesc
|
||||||
version: 5bd2802263f21d8788851d5305584c82a5c75d7e
|
version: 5bd2802263f21d8788851d5305584c82a5c75d7e
|
||||||
- name: github.com/spf13/pflag
|
- name: github.com/spf13/pflag
|
||||||
version: 5ccb023bc27df288a957c5e994cd44fd19619465
|
version: 9ff6c6923cfffbcd502984b8e0c80539a94968b7
|
||||||
- name: github.com/stretchr/objx
|
- name: github.com/stretchr/objx
|
||||||
version: cbeaeb16a013161a98496fad62933b1d21786672
|
version: 8a3f7159479fbc75b30357fbc48f380b7320f08e
|
||||||
- name: github.com/stretchr/testify
|
- name: github.com/stretchr/testify
|
||||||
version: 69483b4bd14f5845b5a1e55bca19e954e827f1d0
|
version: 12b6f73e6084dad08a7c6e575284b177ecafbc71
|
||||||
subpackages:
|
subpackages:
|
||||||
- assert
|
- assert
|
||||||
- mock
|
- mock
|
||||||
- name: github.com/ugorji/go
|
|
||||||
version: f1f1a805ed361a0e078bb537e4ea78cd37dcf065
|
|
||||||
subpackages:
|
|
||||||
- codec
|
|
||||||
- name: golang.org/x/net
|
- name: golang.org/x/net
|
||||||
version: e90d6d0afc4c315a0d87a568ae68577cc15149a0
|
version: 1c05540f6879653db88113bc4a2b70aec4bd491f
|
||||||
subpackages:
|
subpackages:
|
||||||
- context
|
- context
|
||||||
- context/ctxhttp
|
- context/ctxhttp
|
||||||
|
@ -105,17 +92,11 @@ imports:
|
||||||
- http2/hpack
|
- http2/hpack
|
||||||
- idna
|
- idna
|
||||||
- lex/httplex
|
- lex/httplex
|
||||||
- name: golang.org/x/oauth2
|
|
||||||
version: 3c3a985cb79f52a3190fbc056984415ca6763d01
|
|
||||||
subpackages:
|
|
||||||
- google
|
|
||||||
- internal
|
|
||||||
- jws
|
|
||||||
- jwt
|
|
||||||
- name: golang.org/x/text
|
- name: golang.org/x/text
|
||||||
version: 2910a502d2bf9e43193af9d68ca516529614eed3
|
version: b19bf474d317b857955b12035d2c5acb57ce8b01
|
||||||
subpackages:
|
subpackages:
|
||||||
- cases
|
- cases
|
||||||
|
- internal
|
||||||
- internal/tag
|
- internal/tag
|
||||||
- language
|
- language
|
||||||
- runes
|
- runes
|
||||||
|
@ -125,92 +106,57 @@ imports:
|
||||||
- unicode/bidi
|
- unicode/bidi
|
||||||
- unicode/norm
|
- unicode/norm
|
||||||
- width
|
- width
|
||||||
- name: google.golang.org/appengine
|
|
||||||
version: 4f7eeb5305a4ba1966344836ba4af9996b7b4e05
|
|
||||||
subpackages:
|
|
||||||
- internal
|
|
||||||
- internal/app_identity
|
|
||||||
- internal/base
|
|
||||||
- internal/datastore
|
|
||||||
- internal/log
|
|
||||||
- internal/modules
|
|
||||||
- internal/remote_api
|
|
||||||
- internal/urlfetch
|
|
||||||
- urlfetch
|
|
||||||
- name: gopkg.in/inf.v0
|
- name: gopkg.in/inf.v0
|
||||||
version: 3887ee99ecf07df5b447e9b00d9c0b2adaa9f3e4
|
version: 3887ee99ecf07df5b447e9b00d9c0b2adaa9f3e4
|
||||||
- name: gopkg.in/yaml.v2
|
- name: gopkg.in/yaml.v2
|
||||||
version: 53feefa2559fb8dfa8d81baad31be332c97d6c77
|
version: 53feefa2559fb8dfa8d81baad31be332c97d6c77
|
||||||
- name: k8s.io/client-go
|
- name: k8s.io/api
|
||||||
version: e121606b0d09b2e1c467183ee46217fa85a6b672
|
version: 6c6dac0277229b9e9578c5ca3f74a4345d35cdc2
|
||||||
subpackages:
|
subpackages:
|
||||||
- 1.4/kubernetes
|
- admissionregistration/v1alpha1
|
||||||
- 1.4/pkg/api
|
- apps/v1beta1
|
||||||
- 1.4/rest
|
- apps/v1beta2
|
||||||
- discovery
|
- authentication/v1
|
||||||
- kubernetes
|
- authentication/v1beta1
|
||||||
- kubernetes/typed/apps/v1beta1
|
- authorization/v1
|
||||||
- kubernetes/typed/authentication/v1beta1
|
- authorization/v1beta1
|
||||||
- kubernetes/typed/authorization/v1beta1
|
- autoscaling/v1
|
||||||
- kubernetes/typed/autoscaling/v1
|
- autoscaling/v2beta1
|
||||||
- kubernetes/typed/batch/v1
|
- batch/v1
|
||||||
- kubernetes/typed/batch/v2alpha1
|
- batch/v1beta1
|
||||||
- kubernetes/typed/certificates/v1alpha1
|
- batch/v2alpha1
|
||||||
- kubernetes/typed/core/v1
|
- certificates/v1beta1
|
||||||
- kubernetes/typed/extensions/v1beta1
|
- core/v1
|
||||||
- kubernetes/typed/policy/v1beta1
|
- extensions/v1beta1
|
||||||
- kubernetes/typed/rbac/v1alpha1
|
- networking/v1
|
||||||
- kubernetes/typed/storage/v1beta1
|
- policy/v1beta1
|
||||||
- pkg/api
|
- rbac/v1
|
||||||
|
- rbac/v1alpha1
|
||||||
|
- rbac/v1beta1
|
||||||
|
- scheduling/v1alpha1
|
||||||
|
- settings/v1alpha1
|
||||||
|
- storage/v1
|
||||||
|
- storage/v1beta1
|
||||||
|
- name: k8s.io/apimachinery
|
||||||
|
version: 019ae5ada31de202164b118aee88ee2d14075c31
|
||||||
|
subpackages:
|
||||||
|
- pkg/api/equality
|
||||||
- pkg/api/errors
|
- pkg/api/errors
|
||||||
- pkg/api/install
|
|
||||||
- pkg/api/meta
|
- pkg/api/meta
|
||||||
- pkg/api/meta/metatypes
|
|
||||||
- pkg/api/resource
|
- pkg/api/resource
|
||||||
- pkg/api/unversioned
|
|
||||||
- pkg/api/v1
|
|
||||||
- pkg/api/validation/path
|
|
||||||
- pkg/apimachinery
|
- pkg/apimachinery
|
||||||
- pkg/apimachinery/announced
|
|
||||||
- pkg/apimachinery/registered
|
- pkg/apimachinery/registered
|
||||||
- pkg/apis/apps
|
- pkg/apis/meta/internalversion
|
||||||
- pkg/apis/apps/install
|
- pkg/apis/meta/v1
|
||||||
- pkg/apis/apps/v1beta1
|
- pkg/apis/meta/v1/unstructured
|
||||||
- pkg/apis/authentication
|
- pkg/apis/meta/v1alpha1
|
||||||
- pkg/apis/authentication/install
|
|
||||||
- pkg/apis/authentication/v1beta1
|
|
||||||
- pkg/apis/authorization
|
|
||||||
- pkg/apis/authorization/install
|
|
||||||
- pkg/apis/authorization/v1beta1
|
|
||||||
- pkg/apis/autoscaling
|
|
||||||
- pkg/apis/autoscaling/install
|
|
||||||
- pkg/apis/autoscaling/v1
|
|
||||||
- pkg/apis/batch
|
|
||||||
- pkg/apis/batch/install
|
|
||||||
- pkg/apis/batch/v1
|
|
||||||
- pkg/apis/batch/v2alpha1
|
|
||||||
- pkg/apis/certificates
|
|
||||||
- pkg/apis/certificates/install
|
|
||||||
- pkg/apis/certificates/v1alpha1
|
|
||||||
- pkg/apis/extensions
|
|
||||||
- pkg/apis/extensions/install
|
|
||||||
- pkg/apis/extensions/v1beta1
|
|
||||||
- pkg/apis/policy
|
|
||||||
- pkg/apis/policy/install
|
|
||||||
- pkg/apis/policy/v1beta1
|
|
||||||
- pkg/apis/rbac
|
|
||||||
- pkg/apis/rbac/install
|
|
||||||
- pkg/apis/rbac/v1alpha1
|
|
||||||
- pkg/apis/storage
|
|
||||||
- pkg/apis/storage/install
|
|
||||||
- pkg/apis/storage/v1beta1
|
|
||||||
- pkg/auth/user
|
|
||||||
- pkg/conversion
|
- pkg/conversion
|
||||||
- pkg/conversion/queryparams
|
- pkg/conversion/queryparams
|
||||||
|
- pkg/conversion/unstructured
|
||||||
- pkg/fields
|
- pkg/fields
|
||||||
- pkg/genericapiserver/openapi/common
|
|
||||||
- pkg/labels
|
- pkg/labels
|
||||||
- pkg/runtime
|
- pkg/runtime
|
||||||
|
- pkg/runtime/schema
|
||||||
- pkg/runtime/serializer
|
- pkg/runtime/serializer
|
||||||
- pkg/runtime/serializer/json
|
- pkg/runtime/serializer/json
|
||||||
- pkg/runtime/serializer/protobuf
|
- pkg/runtime/serializer/protobuf
|
||||||
|
@ -218,49 +164,84 @@ imports:
|
||||||
- pkg/runtime/serializer/streaming
|
- pkg/runtime/serializer/streaming
|
||||||
- pkg/runtime/serializer/versioning
|
- pkg/runtime/serializer/versioning
|
||||||
- pkg/selection
|
- pkg/selection
|
||||||
- pkg/third_party/forked/golang/reflect
|
|
||||||
- pkg/third_party/forked/golang/template
|
|
||||||
- pkg/types
|
- pkg/types
|
||||||
- pkg/util
|
- pkg/util/cache
|
||||||
- pkg/util/cert
|
|
||||||
- pkg/util/clock
|
- pkg/util/clock
|
||||||
|
- pkg/util/diff
|
||||||
- pkg/util/errors
|
- pkg/util/errors
|
||||||
- pkg/util/flowcontrol
|
|
||||||
- pkg/util/framer
|
- pkg/util/framer
|
||||||
- pkg/util/integer
|
- pkg/util/httpstream
|
||||||
|
- pkg/util/httpstream/spdy
|
||||||
- pkg/util/intstr
|
- pkg/util/intstr
|
||||||
- pkg/util/json
|
- pkg/util/json
|
||||||
- pkg/util/jsonpath
|
- pkg/util/mergepatch
|
||||||
- pkg/util/labels
|
|
||||||
- pkg/util/net
|
- pkg/util/net
|
||||||
- pkg/util/parsers
|
- pkg/util/remotecommand
|
||||||
- pkg/util/rand
|
|
||||||
- pkg/util/runtime
|
- pkg/util/runtime
|
||||||
- pkg/util/sets
|
- pkg/util/sets
|
||||||
- pkg/util/uuid
|
- pkg/util/strategicpatch
|
||||||
- pkg/util/validation
|
- pkg/util/validation
|
||||||
- pkg/util/validation/field
|
- pkg/util/validation/field
|
||||||
- pkg/util/wait
|
- pkg/util/wait
|
||||||
- pkg/util/yaml
|
- pkg/util/yaml
|
||||||
- pkg/version
|
- pkg/version
|
||||||
- pkg/watch
|
- pkg/watch
|
||||||
- pkg/watch/versioned
|
- third_party/forked/golang/json
|
||||||
- plugin/pkg/client/auth
|
- third_party/forked/golang/netutil
|
||||||
- plugin/pkg/client/auth/gcp
|
- third_party/forked/golang/reflect
|
||||||
- plugin/pkg/client/auth/oidc
|
- name: k8s.io/client-go
|
||||||
|
version: 2ae454230481a7cb5544325e12ad7658ecccd19b
|
||||||
|
subpackages:
|
||||||
|
- discovery
|
||||||
|
- kubernetes
|
||||||
|
- kubernetes/scheme
|
||||||
|
- kubernetes/typed/admissionregistration/v1alpha1
|
||||||
|
- kubernetes/typed/apps/v1beta1
|
||||||
|
- kubernetes/typed/apps/v1beta2
|
||||||
|
- kubernetes/typed/authentication/v1
|
||||||
|
- kubernetes/typed/authentication/v1beta1
|
||||||
|
- kubernetes/typed/authorization/v1
|
||||||
|
- kubernetes/typed/authorization/v1beta1
|
||||||
|
- kubernetes/typed/autoscaling/v1
|
||||||
|
- kubernetes/typed/autoscaling/v2beta1
|
||||||
|
- kubernetes/typed/batch/v1
|
||||||
|
- kubernetes/typed/batch/v1beta1
|
||||||
|
- kubernetes/typed/batch/v2alpha1
|
||||||
|
- kubernetes/typed/certificates/v1beta1
|
||||||
|
- kubernetes/typed/core/v1
|
||||||
|
- kubernetes/typed/extensions/v1beta1
|
||||||
|
- kubernetes/typed/networking/v1
|
||||||
|
- kubernetes/typed/policy/v1beta1
|
||||||
|
- kubernetes/typed/rbac/v1
|
||||||
|
- kubernetes/typed/rbac/v1alpha1
|
||||||
|
- kubernetes/typed/rbac/v1beta1
|
||||||
|
- kubernetes/typed/scheduling/v1alpha1
|
||||||
|
- kubernetes/typed/settings/v1alpha1
|
||||||
|
- kubernetes/typed/storage/v1
|
||||||
|
- kubernetes/typed/storage/v1beta1
|
||||||
|
- pkg/version
|
||||||
- rest
|
- rest
|
||||||
|
- rest/watch
|
||||||
- tools/clientcmd/api
|
- tools/clientcmd/api
|
||||||
- tools/metrics
|
- tools/metrics
|
||||||
|
- tools/reference
|
||||||
- transport
|
- transport
|
||||||
|
- util/cert
|
||||||
|
- util/flowcontrol
|
||||||
|
- util/integer
|
||||||
|
- name: k8s.io/kube-openapi
|
||||||
|
version: 868f2f29720b192240e18284659231b440f9cda5
|
||||||
|
subpackages:
|
||||||
|
- pkg/common
|
||||||
testImports:
|
testImports:
|
||||||
- name: github.com/gopherjs/gopherjs
|
- name: github.com/gopherjs/gopherjs
|
||||||
version: e34a5cd6a1bc7c4fde759f2d3039852fc68b5fcc
|
version: 3926a9f66452f7a8c8d9c0e4e3074383f9aff5cd
|
||||||
subpackages:
|
subpackages:
|
||||||
- js
|
- js
|
||||||
- name: github.com/jtolds/gls
|
- name: github.com/jtolds/gls
|
||||||
version: 8ddce2a84170772b95dd5d576c48d517b22cac63
|
version: 77f18212c9c7edc9bd6a33d383a7b545ce62f064
|
||||||
- name: github.com/smartystreets/assertions
|
- name: github.com/smartystreets/assertions
|
||||||
version: e60cfa771e3f4d18723a4119f1833898c9c62066
|
version: 0b37b35ec7434b77e77a4bb29b79677cced992ea
|
||||||
subpackages:
|
subpackages:
|
||||||
- internal/go-render/render
|
- internal/go-render/render
|
||||||
- internal/oglematchers
|
- internal/oglematchers
|
||||||
|
|
9
main.go
9
main.go
|
@ -7,6 +7,7 @@ import (
|
||||||
"regexp"
|
"regexp"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
"github.com/docopt/docopt-go"
|
||||||
"github.com/kubernetes-incubator/node-feature-discovery/source"
|
"github.com/kubernetes-incubator/node-feature-discovery/source"
|
||||||
"github.com/kubernetes-incubator/node-feature-discovery/source/cpuid"
|
"github.com/kubernetes-incubator/node-feature-discovery/source/cpuid"
|
||||||
"github.com/kubernetes-incubator/node-feature-discovery/source/fake"
|
"github.com/kubernetes-incubator/node-feature-discovery/source/fake"
|
||||||
|
@ -14,10 +15,10 @@ import (
|
||||||
"github.com/kubernetes-incubator/node-feature-discovery/source/panic_fake"
|
"github.com/kubernetes-incubator/node-feature-discovery/source/panic_fake"
|
||||||
"github.com/kubernetes-incubator/node-feature-discovery/source/pstate"
|
"github.com/kubernetes-incubator/node-feature-discovery/source/pstate"
|
||||||
"github.com/kubernetes-incubator/node-feature-discovery/source/rdt"
|
"github.com/kubernetes-incubator/node-feature-discovery/source/rdt"
|
||||||
|
api "k8s.io/api/core/v1"
|
||||||
|
meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
k8sclient "k8s.io/client-go/kubernetes"
|
k8sclient "k8s.io/client-go/kubernetes"
|
||||||
api "k8s.io/client-go/pkg/api/v1"
|
|
||||||
restclient "k8s.io/client-go/rest"
|
restclient "k8s.io/client-go/rest"
|
||||||
"github.com/docopt/docopt-go"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
@ -291,14 +292,14 @@ func (h k8sHelpers) GetNode(cli *k8sclient.Clientset) (*api.Node, error) {
|
||||||
stdoutLogger.Printf("%s: %s", PodNamespaceEnv, podns)
|
stdoutLogger.Printf("%s: %s", PodNamespaceEnv, podns)
|
||||||
|
|
||||||
// Get the pod object using the pod name and pod namespace
|
// Get the pod object using the pod name and pod namespace
|
||||||
pod, err := cli.Core().Pods(podns).Get(podName)
|
pod, err := cli.Core().Pods(podns).Get(podName, meta_v1.GetOptions{})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
stderrLogger.Printf("can't get pods: %s", err.Error())
|
stderrLogger.Printf("can't get pods: %s", err.Error())
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the node object using the pod name and pod namespace
|
// Get the node object using the pod name and pod namespace
|
||||||
node, err := cli.Core().Nodes().Get(pod.Spec.NodeName)
|
node, err := cli.Core().Nodes().Get(pod.Spec.NodeName, meta_v1.GetOptions{})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
stderrLogger.Printf("can't get node: %s", err.Error())
|
stderrLogger.Printf("can't get node: %s", err.Error())
|
||||||
return nil, err
|
return nil, err
|
||||||
|
|
11
main_test.go
11
main_test.go
|
@ -10,8 +10,9 @@ import (
|
||||||
"github.com/kubernetes-incubator/node-feature-discovery/source/panic_fake"
|
"github.com/kubernetes-incubator/node-feature-discovery/source/panic_fake"
|
||||||
. "github.com/smartystreets/goconvey/convey"
|
. "github.com/smartystreets/goconvey/convey"
|
||||||
"github.com/vektra/errors"
|
"github.com/vektra/errors"
|
||||||
|
api "k8s.io/api/core/v1"
|
||||||
|
meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
k8sclient "k8s.io/client-go/kubernetes"
|
k8sclient "k8s.io/client-go/kubernetes"
|
||||||
api "k8s.io/client-go/pkg/api/v1"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestDiscoveryWithMockSources(t *testing.T) {
|
func TestDiscoveryWithMockSources(t *testing.T) {
|
||||||
|
@ -131,7 +132,7 @@ func TestArgsParse(t *testing.T) {
|
||||||
|
|
||||||
Convey("noPublish is set and sourcesArg is set to the default value", func() {
|
Convey("noPublish is set and sourcesArg is set to the default value", func() {
|
||||||
So(noPublish, ShouldBeTrue)
|
So(noPublish, ShouldBeTrue)
|
||||||
So(sourcesArg, ShouldResemble, []string{"cpuid", "rdt", "pstate"})
|
So(sourcesArg, ShouldResemble, []string{"cpuid", "rdt", "pstate", "network"})
|
||||||
So(len(whiteListArg), ShouldEqual, 0)
|
So(len(whiteListArg), ShouldEqual, 0)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
@ -151,7 +152,7 @@ func TestArgsParse(t *testing.T) {
|
||||||
|
|
||||||
Convey("whiteListArg is set to appropriate value and sourcesArg is set to default value", func() {
|
Convey("whiteListArg is set to appropriate value and sourcesArg is set to default value", func() {
|
||||||
So(noPublish, ShouldBeFalse)
|
So(noPublish, ShouldBeFalse)
|
||||||
So(sourcesArg, ShouldResemble, []string{"cpuid", "rdt", "pstate"})
|
So(sourcesArg, ShouldResemble, []string{"cpuid", "rdt", "pstate", "network"})
|
||||||
So(whiteListArg, ShouldResemble, ".*rdt.*")
|
So(whiteListArg, ShouldResemble, ".*rdt.*")
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
@ -269,7 +270,7 @@ func TestAddLabels(t *testing.T) {
|
||||||
helper := k8sHelpers{}
|
helper := k8sHelpers{}
|
||||||
labels := Labels{}
|
labels := Labels{}
|
||||||
n := &api.Node{
|
n := &api.Node{
|
||||||
ObjectMeta: api.ObjectMeta{
|
ObjectMeta: meta_v1.ObjectMeta{
|
||||||
Labels: map[string]string{},
|
Labels: map[string]string{},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
@ -295,7 +296,7 @@ func TestRemoveLabels(t *testing.T) {
|
||||||
Convey("When removing labels", t, func() {
|
Convey("When removing labels", t, func() {
|
||||||
helper := k8sHelpers{}
|
helper := k8sHelpers{}
|
||||||
n := &api.Node{
|
n := &api.Node{
|
||||||
ObjectMeta: api.ObjectMeta{
|
ObjectMeta: meta_v1.ObjectMeta{
|
||||||
Labels: map[string]string{
|
Labels: map[string]string{
|
||||||
"single": "123",
|
"single": "123",
|
||||||
"multiple_A": "a",
|
"multiple_A": "a",
|
||||||
|
|
|
@ -2,8 +2,8 @@ package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/stretchr/testify/mock"
|
"github.com/stretchr/testify/mock"
|
||||||
|
api "k8s.io/api/core/v1"
|
||||||
k8sclient "k8s.io/client-go/kubernetes"
|
k8sclient "k8s.io/client-go/kubernetes"
|
||||||
api "k8s.io/client-go/pkg/api/v1"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type MockAPIHelpers struct {
|
type MockAPIHelpers struct {
|
||||||
|
|
|
@ -22,5 +22,5 @@ type Source struct{}
|
||||||
func (s Source) Name() string { return "panic_fake" }
|
func (s Source) Name() string { return "panic_fake" }
|
||||||
|
|
||||||
func (s Source) Discover() ([]string, error) {
|
func (s Source) Discover() ([]string, error) {
|
||||||
panic("panic fake error")
|
panic("fake panic error")
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue