Skip to content

Commit 17c9f8c

Browse files
committed
Fix creating ackChan too late in test.
1 parent 58a1f4b commit 17c9f8c

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

internal/backend/semtechudp/backend_test.go

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -442,6 +442,12 @@ func (ts *BackendTestSuite) TestTXAckRetryFailFail() {
442442
{Status: gw.TxAckStatus_IGNORED},
443443
}, cache.DefaultExpiration)
444444

445+
// Create ack channel
446+
ackChan := make(chan *gw.DownlinkTxAck, 1)
447+
ts.backend.SetDownlinkTxAckFunc(func(pl *gw.DownlinkTxAck) {
448+
ackChan <- pl
449+
})
450+
445451
// send a nack on the first downlink attempt
446452
ack1 := packets.TXACKPacket{
447453
ProtocolVersion: packets.ProtocolVersion2,
@@ -502,10 +508,6 @@ func (ts *BackendTestSuite) TestTXAckRetryFailFail() {
502508
assert.NoError(err)
503509

504510
// validate final ack
505-
ackChan := make(chan *gw.DownlinkTxAck, 1)
506-
ts.backend.SetDownlinkTxAckFunc(func(pl *gw.DownlinkTxAck) {
507-
ackChan <- pl
508-
})
509511
txAck := <-ackChan
510512
assert.Equal(&gw.DownlinkTxAck{
511513
GatewayId: "0102030405060708",

0 commit comments

Comments
 (0)