Skip to content

Commit

Permalink
ns: Fix downlink tests
Browse files Browse the repository at this point in the history
  • Loading branch information
halimi committed Sep 23, 2024
1 parent 11483ce commit 6db97d6
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
10 changes: 10 additions & 0 deletions pkg/networkserver/downlink_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -861,6 +861,7 @@ func TestProcessDownlinkTask(t *testing.T) {
Rx1Frequency: dev.MacState.CurrentParameters.Channels[lastUp.DeviceChannelIndex].DownlinkFrequency,
Rx2DataRate: rx2DataRateFromIndex(dev, a, t),
Rx2Frequency: dev.MacState.CurrentParameters.Rx2Frequency,
Rx2Mic: test.DefaultRX2Mic,
FrequencyPlanId: dev.FrequencyPlanId,
}
},
Expand Down Expand Up @@ -1012,6 +1013,7 @@ func TestProcessDownlinkTask(t *testing.T) {
Rx1Frequency: dev.MacState.CurrentParameters.Channels[lastUp.DeviceChannelIndex].DownlinkFrequency,
Rx2DataRate: rx2DataRateFromIndex(dev, a, t),
Rx2Frequency: dev.MacState.CurrentParameters.Rx2Frequency,
Rx2Mic: test.DefaultRX2Mic,
FrequencyPlanId: dev.FrequencyPlanId,
}
},
Expand Down Expand Up @@ -1167,6 +1169,7 @@ func TestProcessDownlinkTask(t *testing.T) {
Rx1Frequency: dev.MacState.CurrentParameters.Channels[lastUp.DeviceChannelIndex].DownlinkFrequency,
Rx2DataRate: rx2DataRateFromIndex(dev, a, t),
Rx2Frequency: dev.MacState.CurrentParameters.Rx2Frequency,
Rx2Mic: test.DefaultRX2Mic,
FrequencyPlanId: dev.FrequencyPlanId,
}
},
Expand Down Expand Up @@ -1326,6 +1329,7 @@ func TestProcessDownlinkTask(t *testing.T) {
Rx1DataRate: lastUp.Settings.DataRate,
Rx1Delay: dev.MacState.CurrentParameters.Rx1Delay,
Rx1Frequency: dev.MacState.CurrentParameters.Channels[lastUp.DeviceChannelIndex].DownlinkFrequency,
Rx2Mic: test.DefaultRX2Mic,
FrequencyPlanId: dev.FrequencyPlanId,
}
},
Expand Down Expand Up @@ -1479,6 +1483,7 @@ func TestProcessDownlinkTask(t *testing.T) {
},
},
Rx2Frequency: DefaultEU868RX2Frequency,
Rx2Mic: test.DefaultRX2Mic,
AbsoluteTime: timestamppb.New(pingAt),
FrequencyPlanId: dev.FrequencyPlanId,
}
Expand Down Expand Up @@ -1635,6 +1640,7 @@ func TestProcessDownlinkTask(t *testing.T) {
Rx1Frequency: dev.MacState.CurrentParameters.Channels[lastUp.DeviceChannelIndex].DownlinkFrequency,
Rx2DataRate: rx2DataRateFromIndex(dev, a, t),
Rx2Frequency: dev.MacState.CurrentParameters.Rx2Frequency,
Rx2Mic: test.DefaultRX2Mic,
FrequencyPlanId: dev.FrequencyPlanId,
}
},
Expand Down Expand Up @@ -1778,6 +1784,7 @@ func TestProcessDownlinkTask(t *testing.T) {
Priority: ttnpb.TxSchedulePriority_HIGH,
Rx2DataRate: rx2DataRateFromIndex(dev, a, t),
Rx2Frequency: dev.MacState.CurrentParameters.Rx2Frequency,
Rx2Mic: test.DefaultRX2Mic,
FrequencyPlanId: dev.FrequencyPlanId,
}
},
Expand Down Expand Up @@ -1918,6 +1925,7 @@ func TestProcessDownlinkTask(t *testing.T) {
},
},
Rx2Frequency: DefaultEU868RX2Frequency,
Rx2Mic: test.DefaultRX2Mic,
AbsoluteTime: timestamppb.New(now.Add(InfrastructureDelay)),
FrequencyPlanId: dev.FrequencyPlanId,
}
Expand Down Expand Up @@ -2049,6 +2057,7 @@ func TestProcessDownlinkTask(t *testing.T) {
AbsoluteTime: timestamppb.New(now.Add(AbsoluteTimeSchedulingDelay)),
Rx2DataRate: rx2DataRateFromIndex(dev, a, t),
Rx2Frequency: dev.MacState.CurrentParameters.Rx2Frequency,
Rx2Mic: test.DefaultRX2Mic,
FrequencyPlanId: dev.FrequencyPlanId,
}
},
Expand Down Expand Up @@ -2208,6 +2217,7 @@ func TestProcessDownlinkTask(t *testing.T) {
Priority: ttnpb.TxSchedulePriority_HIGH,
Rx2DataRate: rx2DataRateFromIndex(dev, a, t),
Rx2Frequency: dev.MacState.CurrentParameters.Rx2Frequency,
Rx2Mic: test.DefaultRX2Mic,
FrequencyPlanId: dev.FrequencyPlanId,
}
},
Expand Down
2 changes: 2 additions & 0 deletions pkg/util/test/test.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,8 @@ var (
DefaultMACVersion = ttnpb.MACVersion_MAC_V1_1
DefaultPHYVersion = ttnpb.PHYVersion_RP001_V1_1_REV_B
DefaultFrequencyPlanID = EUFrequencyPlanID

DefaultRX2Mic = []byte{0x00, 0x00, 0x00, 0x00}
)

func NewWithContext(ctx context.Context, tb testing.TB) (*assertions.Assertion, context.Context) {
Expand Down

0 comments on commit 6db97d6

Please sign in to comment.