Extend test SetupMocks() to take arbitrary Canary resources

SetupMocks() currently takes a bool switch that tells it to configure
against either a shifting canary or an A-B canary.  I'll need a third
canary that has mirroring turned on so I changed this to an interface
that just takes the canary to configure (and configs the default
shifting canary if you pass nil).
This commit is contained in:
Andrew Jenkins
2019-09-24 16:15:45 -06:00
parent 2e079ba7a1
commit 655df36913
2 changed files with 11 additions and 13 deletions
+3 -5
View File
@@ -42,11 +42,9 @@ type Mocks struct {
router router.Interface
}
func SetupMocks(abtest bool) Mocks {
// init canary
c := newTestCanary()
if abtest {
c = newTestCanaryAB()
func SetupMocks(c *v1alpha3.Canary) Mocks {
if c == nil {
c = newTestCanary()
}
flaggerClient := fakeFlagger.NewSimpleClientset(c)