Skip to content

Commit

Permalink
Fix creating ackChan too late in test.
Browse files Browse the repository at this point in the history
  • Loading branch information
brocaar committed Apr 11, 2023
1 parent 58a1f4b commit 17c9f8c
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions internal/backend/semtechudp/backend_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -442,6 +442,12 @@ func (ts *BackendTestSuite) TestTXAckRetryFailFail() {
{Status: gw.TxAckStatus_IGNORED},
}, cache.DefaultExpiration)

// Create ack channel
ackChan := make(chan *gw.DownlinkTxAck, 1)
ts.backend.SetDownlinkTxAckFunc(func(pl *gw.DownlinkTxAck) {
ackChan <- pl
})

// send a nack on the first downlink attempt
ack1 := packets.TXACKPacket{
ProtocolVersion: packets.ProtocolVersion2,
Expand Down Expand Up @@ -502,10 +508,6 @@ func (ts *BackendTestSuite) TestTXAckRetryFailFail() {
assert.NoError(err)

// validate final ack
ackChan := make(chan *gw.DownlinkTxAck, 1)
ts.backend.SetDownlinkTxAckFunc(func(pl *gw.DownlinkTxAck) {
ackChan <- pl
})
txAck := <-ackChan
assert.Equal(&gw.DownlinkTxAck{
GatewayId: "0102030405060708",
Expand Down

0 comments on commit 17c9f8c

Please sign in to comment.