-
Notifications
You must be signed in to change notification settings - Fork 40
/
matchers.go
45 lines (36 loc) · 1.69 KB
/
matchers.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
package testutil
import (
"context"
operatorsv1 "github.com/operator-framework/api/pkg/operators/v1"
operatorsv1alpha1 "github.com/operator-framework/api/pkg/operators/v1alpha1"
monitoringv1 "github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring/v1"
"github.com/stretchr/testify/mock"
corev1 "k8s.io/api/core/v1"
networkingv1 "k8s.io/api/networking/v1"
"sigs.k8s.io/controller-runtime/pkg/client"
addonsv1alpha1 "github.com/openshift/addon-operator/apis/addons/v1alpha1"
)
// custom testify/mock matchers
var (
// core
IsCoreV1NamespacePtr = mock.IsType(&corev1.Namespace{})
IsCoreV1NamespaceListPtr = mock.IsType(&corev1.NamespaceList{})
IsConfigMapPtr = mock.IsType(&corev1.ConfigMap{})
// networking
IsNetworkingV1NetworkPolicyPtr = mock.IsType(&networkingv1.NetworkPolicy{})
// olm
IsOperatorsV1OperatorGroupPtr = mock.IsType(&operatorsv1.OperatorGroup{})
IsOperatorsV1Alpha1CatalogSourcePtr = mock.IsType(&operatorsv1alpha1.CatalogSource{})
IsOperatorsV1Alpha1SubscriptionPtr = mock.IsType(&operatorsv1alpha1.Subscription{})
IsOperatorsV1OperatorPtr = mock.IsType(&operatorsv1.Operator{})
// prom
IsMonitoringV1ServiceMonitorPtr = mock.IsType(&monitoringv1.ServiceMonitor{})
// addon.managed.openshift.io/v1alpha1
IsAddonsv1alpha1AddonPtr = mock.IsType(&addonsv1alpha1.Addon{})
IsAddonsv1alpha1AddonListPtr = mock.IsType(&addonsv1alpha1.AddonList{})
IsAddonsv1alpha1AddonOperatorPtr = mock.IsType(&addonsv1alpha1.AddonOperator{})
IsAddonsv1alpha1AddonOperatorListPtr = mock.IsType(&addonsv1alpha1.AddonOperatorList{})
// misc
IsContext = mock.IsType(context.TODO())
IsObjectKey = mock.IsType(client.ObjectKey{})
)