@@ -2,6 +2,7 @@ package component
22
33import (
44 "context"
5+ "fmt"
56 "testing"
67
78 "github.com/stretchr/testify/require"
@@ -35,7 +36,7 @@ type MyObject struct {
3536}
3637type MyObjectStatus struct {
3738 ObservedGeneration int64 `json:"observedGeneration,omitempty" protobuf:"varint,3,opt,name=observedGeneration"`
38- conditions.StatusConditions `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type " protobuf:"bytes,1,rep,name=conditions"`
39+ conditions.StatusConditions `json:"conditions,omitempty" patchMergeKey:"type" patchStrategy:"merge " protobuf:"bytes,1,rep,name=conditions"`
3940}
4041
4142func TestEnsureServiceHandler (t * testing.T ) {
@@ -78,7 +79,7 @@ func TestEnsureServiceHandler(t *testing.T) {
7879 "example.com/component" : "the-main-service-component" ,
7980 },
8081 Annotations : map [string ]string {
81- hashKey : "n649h58dh598h654hc4hc9hbbh689q " ,
82+ hashKey : "76251aaa1ff6c84f " ,
8283 },
8384 }},
8485 },
@@ -93,7 +94,7 @@ func TestEnsureServiceHandler(t *testing.T) {
9394 "example.com/component" : "the-main-service-component" ,
9495 },
9596 Annotations : map [string ]string {
96- hashKey : "n649h58dh598h654hc4hc9hbbh689q " ,
97+ hashKey : "76251aaa1ff6c84f " ,
9798 },
9899 },
99100 }, & corev1.Service {ObjectMeta : metav1.ObjectMeta {
@@ -108,7 +109,7 @@ func TestEnsureServiceHandler(t *testing.T) {
108109 }
109110 for _ , tt := range tests {
110111 t .Run (tt .name , func (t * testing.T ) {
111- ctx , cancel := context .WithCancel (context . Background ())
112+ ctx , cancel := context .WithCancel (t . Context ())
112113 defer cancel ()
113114
114115 ctrls := & fake.FakeInterface {}
@@ -145,8 +146,9 @@ func TestEnsureServiceHandler(t *testing.T) {
145146 hash .NewObjectHash (), hashKey ),
146147 ctxOwner ,
147148 queueOps ,
148- func (_ context.Context , _ * applycorev1.ServiceApplyConfiguration ) (* corev1.Service , error ) {
149+ func (_ context.Context , sac * applycorev1.ServiceApplyConfiguration ) (* corev1.Service , error ) {
149150 applyCalled = true
151+ fmt .Print (sac .Annotations )
150152 return nil , nil
151153 },
152154 func (_ context.Context , _ types.NamespacedName ) error {
0 commit comments