mirror of
https://github.com/vmware-tanzu/pinniped.git
synced 2026-01-07 05:57:02 +00:00
Add integration and more unit tests
- Add integration test for serving cert auto-generation and rotation - Add unit test for `WithInitialEvent` of the cert manager controller - Move UpdateAPIService() into the `apicerts` package, since that is the only user of the function.
This commit is contained in:
@@ -8,23 +8,24 @@ package testutil
|
||||
import "github.com/suzerain-io/controller-go"
|
||||
|
||||
type ObservableWithInformerOption struct {
|
||||
InformerToFilterMap map[controller.InformerGetter]controller.Filter
|
||||
informerToFilterMap map[controller.InformerGetter]controller.Filter
|
||||
}
|
||||
|
||||
func NewObservableWithInformerOption() *ObservableWithInformerOption {
|
||||
return &ObservableWithInformerOption{
|
||||
InformerToFilterMap: make(map[controller.InformerGetter]controller.Filter),
|
||||
informerToFilterMap: make(map[controller.InformerGetter]controller.Filter),
|
||||
}
|
||||
}
|
||||
|
||||
func (i *ObservableWithInformerOption) WithInformer(
|
||||
getter controller.InformerGetter,
|
||||
filter controller.Filter,
|
||||
opt controller.InformerOption) controller.Option {
|
||||
i.InformerToFilterMap[getter] = filter
|
||||
opt controller.InformerOption,
|
||||
) controller.Option {
|
||||
i.informerToFilterMap[getter] = filter
|
||||
return controller.WithInformer(getter, filter, opt)
|
||||
}
|
||||
|
||||
func (i *ObservableWithInformerOption) GetFilterForInformer(getter controller.InformerGetter) controller.Filter {
|
||||
return i.InformerToFilterMap[getter]
|
||||
return i.informerToFilterMap[getter]
|
||||
}
|
||||
|
||||
25
internal/testutil/observable_with_initial_event_option.go
Normal file
25
internal/testutil/observable_with_initial_event_option.go
Normal file
@@ -0,0 +1,25 @@
|
||||
/*
|
||||
Copyright 2020 VMware, Inc.
|
||||
SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
package testutil
|
||||
|
||||
import "github.com/suzerain-io/controller-go"
|
||||
|
||||
type ObservableWithInitialEventOption struct {
|
||||
key controller.Key
|
||||
}
|
||||
|
||||
func NewObservableWithInitialEventOption() *ObservableWithInitialEventOption {
|
||||
return &ObservableWithInitialEventOption{}
|
||||
}
|
||||
|
||||
func (i *ObservableWithInitialEventOption) WithInitialEvent(key controller.Key) controller.Option {
|
||||
i.key = key
|
||||
return controller.WithInitialEvent(key)
|
||||
}
|
||||
|
||||
func (i *ObservableWithInitialEventOption) GetInitialEventKey() controller.Key {
|
||||
return i.key
|
||||
}
|
||||
Reference in New Issue
Block a user