Fix HPA unit tests with new fake client

The new fake client properly represents the resource of `PodMetrics` as
"pods" and the resource of `NodeMetrics` as "nodes".  Previously, it
used "podmetricses" and "nodemetrics", respectively.

This fixes up `horizontal_test.go` and `replica_calc_test.go` to use the
new names.
pull/6/head
Solly Ross 2017-05-03 18:11:22 -04:00
parent 0b43fffa48
commit b4ee4e2e80
3 changed files with 3 additions and 4 deletions

View File

@ -360,8 +360,7 @@ func (tc *testCase) prepareTestClient(t *testing.T) (*fake.Clientset, *metricsfa
fakeClient.AddWatchReactor("*", core.DefaultWatchReactor(fakeWatch, nil))
fakeMetricsClient := &metricsfake.Clientset{}
// NB: we have to sound like Gollum due to gengo's inability to handle already-plural resource names
fakeMetricsClient.AddReactor("list", "podmetricses", func(action core.Action) (handled bool, ret runtime.Object, err error) {
fakeMetricsClient.AddReactor("list", "pods", func(action core.Action) (handled bool, ret runtime.Object, err error) {
tc.Lock()
defer tc.Unlock()

View File

@ -74,7 +74,7 @@ func (tc *restClientTestCase) prepareTestClient(t *testing.T) (*metricsfake.Clie
fakeCMClient := &cmfake.FakeCustomMetricsClient{}
if isResource {
fakeMetricsClient.AddReactor("list", "podmetricses", func(action core.Action) (handled bool, ret runtime.Object, err error) {
fakeMetricsClient.AddReactor("list", "pods", func(action core.Action) (handled bool, ret runtime.Object, err error) {
metrics := &metricsapi.PodMetricsList{}
for i, containers := range tc.reportedPodMetrics {
metric := metricsapi.PodMetrics{

View File

@ -135,7 +135,7 @@ func (tc *replicaCalcTestCase) prepareTestClient(t *testing.T) (*fake.Clientset,
fakeMetricsClient := &metricsfake.Clientset{}
// NB: we have to sound like Gollum due to gengo's inability to handle already-plural resource names
fakeMetricsClient.AddReactor("list", "podmetricses", func(action core.Action) (handled bool, ret runtime.Object, err error) {
fakeMetricsClient.AddReactor("list", "pods", func(action core.Action) (handled bool, ret runtime.Object, err error) {
if tc.resource != nil {
metrics := &metricsapi.PodMetricsList{}
for i, resValue := range tc.resource.levels {