@@ -296,10 +296,12 @@ func TestAcquireJob(t *testing.T) {
296
296
297
297
startPublished := make (chan struct {})
298
298
var closed bool
299
- closeStartSubscribe , err := ps .Subscribe (wspubsub .WorkspaceEventChannel (workspace .OwnerID ),
299
+ closeStartSubscribe , err := ps .SubscribeWithErr (wspubsub .WorkspaceEventChannel (workspace .OwnerID ),
300
300
wspubsub .HandleWorkspaceEvent (
301
- slogtest .Make (t , nil ),
302
- func (_ context.Context , e wspubsub.WorkspaceEvent ) {
301
+ func (_ context.Context , e wspubsub.WorkspaceEvent , err error ) {
302
+ if err != nil {
303
+ return
304
+ }
303
305
if e .Kind == wspubsub .WorkspaceEventKindStateChange && e .WorkspaceID == workspace .ID {
304
306
if ! closed {
305
307
close (startPublished )
@@ -404,10 +406,12 @@ func TestAcquireJob(t *testing.T) {
404
406
})
405
407
406
408
stopPublished := make (chan struct {})
407
- closeStopSubscribe , err := ps .Subscribe (wspubsub .WorkspaceEventChannel (workspace .OwnerID ),
409
+ closeStopSubscribe , err := ps .SubscribeWithErr (wspubsub .WorkspaceEventChannel (workspace .OwnerID ),
408
410
wspubsub .HandleWorkspaceEvent (
409
- slogtest .Make (t , nil ),
410
- func (_ context.Context , e wspubsub.WorkspaceEvent ) {
411
+ func (_ context.Context , e wspubsub.WorkspaceEvent , err error ) {
412
+ if err != nil {
413
+ return
414
+ }
411
415
if e .Kind == wspubsub .WorkspaceEventKindStateChange && e .WorkspaceID == workspace .ID {
412
416
close (stopPublished )
413
417
}
@@ -925,10 +929,12 @@ func TestFailJob(t *testing.T) {
925
929
require .NoError (t , err )
926
930
927
931
publishedWorkspace := make (chan struct {})
928
- closeWorkspaceSubscribe , err := ps .Subscribe (wspubsub .WorkspaceEventChannel (workspace .OwnerID ),
932
+ closeWorkspaceSubscribe , err := ps .SubscribeWithErr (wspubsub .WorkspaceEventChannel (workspace .OwnerID ),
929
933
wspubsub .HandleWorkspaceEvent (
930
- slogtest .Make (t , nil ),
931
- func (_ context.Context , e wspubsub.WorkspaceEvent ) {
934
+ func (_ context.Context , e wspubsub.WorkspaceEvent , err error ) {
935
+ if err != nil {
936
+ return
937
+ }
932
938
if e .Kind == wspubsub .WorkspaceEventKindStateChange && e .WorkspaceID == workspace .ID {
933
939
close (publishedWorkspace )
934
940
}
@@ -1321,10 +1327,12 @@ func TestCompleteJob(t *testing.T) {
1321
1327
require .NoError (t , err )
1322
1328
1323
1329
publishedWorkspace := make (chan struct {})
1324
- closeWorkspaceSubscribe , err := ps .Subscribe (wspubsub .WorkspaceEventChannel (workspace .OwnerID ),
1330
+ closeWorkspaceSubscribe , err := ps .SubscribeWithErr (wspubsub .WorkspaceEventChannel (workspace .OwnerID ),
1325
1331
wspubsub .HandleWorkspaceEvent (
1326
- slogtest .Make (t , nil ),
1327
- func (_ context.Context , e wspubsub.WorkspaceEvent ) {
1332
+ func (_ context.Context , e wspubsub.WorkspaceEvent , err error ) {
1333
+ if err != nil {
1334
+ return
1335
+ }
1328
1336
if e .Kind == wspubsub .WorkspaceEventKindStateChange && e .WorkspaceID == workspace .ID {
1329
1337
close (publishedWorkspace )
1330
1338
}
0 commit comments