MCPcopy Create free account
hub / github.com/chirpstack/chirpstack / test_queue

Function test_queue

chirpstack/src/storage/multicast.rs:1064–1228  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1062
1063 #[tokio::test]
1064 async fn test_queue() {
1065 let _guard = test::prepare().await;
1066
1067 let t = tenant::create(tenant::Tenant {
1068 name: "test-tenant".into(),
1069 can_have_gateways: true,
1070 ..Default::default()
1071 })
1072 .await
1073 .unwrap();
1074
1075 let app = application::create(application::Application {
1076 name: "test-app".into(),
1077 tenant_id: t.id,
1078 ..Default::default()
1079 })
1080 .await
1081 .unwrap();
1082
1083 let gw = gateway::create(gateway::Gateway {
1084 gateway_id: EUI64::from_be_bytes([1, 2, 3, 4, 5, 6, 7, 8]),
1085 name: "test-gw".into(),
1086 tenant_id: t.id,
1087 stats_interval_secs: 30,
1088 last_seen_at: Some(Utc::now()),
1089 ..Default::default()
1090 })
1091 .await
1092 .unwrap();
1093
1094 let mut mg = create(MulticastGroup {
1095 application_id: app.id,
1096 name: "test-mg".into(),
1097 region: CommonName::EU868,
1098 mc_addr: DevAddr::from_be_bytes([1, 2, 3, 4]),
1099 mc_nwk_s_key: AES128Key::from_bytes([1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8]),
1100 f_cnt: 10,
1101 group_type: "C".into(),
1102 dr: 1,
1103 frequency: 868100000,
1104 class_b_ping_slot_periodicity: 1,
1105 class_c_scheduling_type: fields::MulticastGroupSchedulingType::DELAY,
1106 ..Default::default()
1107 })
1108 .await
1109 .unwrap();
1110
1111 // invalid f_port
1112 assert!(
1113 enqueue(
1114 MulticastGroupQueueItem {
1115 multicast_group_id: mg.id,
1116 gateway_id: gw.gateway_id,
1117 f_cnt: 1,
1118 f_port: 0,
1119 data: vec![3, 2, 1],
1120 ..Default::default()
1121 },

Callers

nothing calls this directly

Calls 9

prepareFunction · 0.85
get_queue_itemFunction · 0.85
delete_queue_itemFunction · 0.85
flush_queueFunction · 0.85
unwrapMethod · 0.80
createFunction · 0.70
enqueueFunction · 0.70
updateFunction · 0.70
intoMethod · 0.45

Tested by

no test coverage detected