()
| 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 | }, |
nothing calls this directly
no test coverage detected