Use narrowly scoped interfaces for client access

Use custom narrowly scoped interfaces for client access from the
RollingUpdater and Resizer. This allows for more flexible downstream
integration and unit testing without imposing a burden to implement
the entire client.Interface for just a handful of methods.
This commit is contained in:
Dan Mace
2015-04-15 14:28:59 -04:00
parent d912398d07
commit 312ccad3c1
7 changed files with 81 additions and 25 deletions

View File

@@ -253,7 +253,7 @@ Update succeeded. Deleting foo-v1
for _, test := range tests {
updater := RollingUpdater{
fakeClientFor("default", test.responses),
&RealRollingUpdaterClient{fakeClientFor("default", test.responses)},
"default",
}
var buffer bytes.Buffer
@@ -296,7 +296,7 @@ Update succeeded. Deleting foo-v1
{newRc(3, 3), nil},
{newRc(3, 3), nil},
}
updater := RollingUpdater{fakeClientFor("default", responses), "default"}
updater := RollingUpdater{&RealRollingUpdaterClient{fakeClientFor("default", responses)}, "default"}
var buffer bytes.Buffer
if err := updater.Update(&buffer, rc, rcExisting, 0, time.Millisecond, time.Millisecond); err != nil {