@@ -11,6 +11,8 @@ import (
1111 metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
1212 "k8s.io/apimachinery/pkg/runtime"
1313 "k8s.io/apimachinery/pkg/util/intstr"
14+ kt "k8s.io/client-go/testing"
15+
1416 v1addr "knative.dev/pkg/client/injection/ducks/duck/v1/addressable"
1517 "knative.dev/pkg/configmap"
1618 "knative.dev/pkg/controller"
@@ -20,7 +22,6 @@ import (
2022 fakeeventingclient "github.com/triggermesh/triggermesh-core/pkg/client/generated/injection/client/fake"
2123 "github.com/triggermesh/triggermesh-core/pkg/client/generated/injection/reconciler/eventing/v1alpha1/memorybroker"
2224 "github.com/triggermesh/triggermesh-core/pkg/reconciler/common"
23- "github.com/triggermesh/triggermesh-core/pkg/reconciler/resources"
2425 tmt "github.com/triggermesh/triggermesh-core/pkg/reconciler/testing"
2526 tmtv1alpha1 "github.com/triggermesh/triggermesh-core/pkg/reconciler/testing/v1alpha1"
2627)
@@ -62,19 +63,52 @@ func TestAllCases(t *testing.T) {
6263 newDeploymentForBroker (tNamespace , tName ),
6364 newServiceForBroker (tNamespace , tName ),
6465 },
66+ WantStatusUpdates : []kt.UpdateActionImpl {
67+ {
68+ Object : tmtv1alpha1 .NewMemoryBroker (tNamespace , tName ,
69+ // tmtv1alpha1.MemoryBrokerWithStatusAddress("http://"+tName+"-mb-broker."+tNamespace+".svc.cluster.local"),
70+ tmtv1alpha1 .MemoryBrokerWithStatusCondition ("Addressable" , corev1 .ConditionUnknown , "" , "" ),
71+ tmtv1alpha1 .MemoryBrokerWithStatusCondition ("BrokerConfigSecretReady" , corev1 .ConditionTrue , "" , "" ),
72+ tmtv1alpha1 .MemoryBrokerWithStatusCondition ("BrokerDeploymentReady" , corev1 .ConditionUnknown , "" , "" ),
73+ tmtv1alpha1 .MemoryBrokerWithStatusCondition ("BrokerEndpointsReady" , corev1 .ConditionFalse , "UnavailableEndpoints" , "Endpoints for broker service do not exist" ),
74+ tmtv1alpha1 .MemoryBrokerWithStatusCondition ("BrokerServiceAccountReady" , corev1 .ConditionTrue , "" , "" ),
75+ tmtv1alpha1 .MemoryBrokerWithStatusCondition ("BrokerServiceReady" , corev1 .ConditionTrue , "" , "" ),
76+ tmtv1alpha1 .MemoryBrokerWithStatusCondition ("MemoryBrokerBrokerRoleBinding" , corev1 .ConditionTrue , "" , "" ),
77+ tmtv1alpha1 .MemoryBrokerWithStatusCondition ("Ready" , corev1 .ConditionFalse , "UnavailableEndpoints" , "Endpoints for broker service do not exist" ),
78+ ),
79+ },
80+ },
81+
6582 WantEvents : []string {
6683 knt .Eventf (corev1 .EventTypeWarning , "UnavailableEndpoints" , `Endpoints for broker service "` + tNamespace + `/` + tName + `-mb-broker" do not exist` ),
6784 },
68- }, {
69- Name : "deleting broker" ,
70- Key : tKey ,
71- Objects : []runtime.Object {
72- tmtv1alpha1 .NewMemoryBroker (tNamespace , tName ,
73- tmtv1alpha1 .MemoryBrokerWithMetaOptions (resources .MetaSetDeletion (& tNow ))),
74- },
75- WantCreates : []runtime.Object {
76- // Reconciliation is skipped and no objects are created.
77- },
85+
86+ // }, {
87+ // Name: "update status",
88+ // Key: tKey,
89+ // Objects: []runtime.Object{
90+ // tmtv1alpha1.NewMemoryBroker(tNamespace, tName),
91+ // },
92+ // WantCreates: []runtime.Object{
93+ // newSecretForBroker(tNamespace, tName),
94+ // newServiceAccountForBroker(tNamespace, tName),
95+ // newRoleBindingForBroker(tNamespace, tName),
96+ // newDeploymentForBroker(tNamespace, tName),
97+ // newServiceForBroker(tNamespace, tName),
98+ // },
99+ // WantEvents: []string{
100+ // knt.Eventf(corev1.EventTypeWarning, "UnavailableEndpoints", `Endpoints for broker service "`+tNamespace+`/`+tName+`-mb-broker" do not exist`),
101+ // },
102+ // }, {
103+ // Name: "deleting broker",
104+ // Key: tKey,
105+ // Objects: []runtime.Object{
106+ // tmtv1alpha1.NewMemoryBroker(tNamespace, tName,
107+ // tmtv1alpha1.MemoryBrokerWithMetaOptions(resources.MetaSetDeletion(&tNow))),
108+ // },
109+ // WantCreates: []runtime.Object{
110+ // // Reconciliation is skipped and no objects are created.
111+ // },
78112 },
79113 }
80114
@@ -102,7 +136,7 @@ func TestAllCases(t *testing.T) {
102136 listers .GetMemoryBrokerLister (),
103137 controller .GetEventRecorder (ctx ),
104138 r ,
105- controller.Options {SkipStatusUpdates : true })
139+ controller.Options {SkipStatusUpdates : false })
106140 }, false , logger ))
107141}
108142
0 commit comments