]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
nvmeofgw*: test for encode/decode of new types added for epoch-filter feature
authorLeonid Chernin <leonidc@il.ibm.com>
Wed, 22 Jan 2025 18:08:48 +0000 (20:08 +0200)
committerleonidc <leonidc@il.ibm.com>
Sun, 16 Feb 2025 19:57:09 +0000 (21:57 +0200)
Signed-off-by: Leonid Chernin <leonidc@il.ibm.com>
src/test/test_nvmeof_mon_encoding.cc

index d66efb77fe6d249127033e3eb9eb481ffab3029a..d7cbf44fd3a661733da2e700a82226e47c83d24b 100644 (file)
@@ -79,12 +79,21 @@ void test_MNVMeofGwMap() {
 
   ceph::buffer::list bl;
   encode(map, bl, CEPH_FEATURES_ALL);
-  dout(0) << "encode: " << map << dendl;
+  dout(0) << "encoded: " << map << dendl;
   decode(map, bl);
   dout(0) << "decode: " << map << dendl;
 
   BeaconSubsystem sub = { nqn, {}, {} };
   NVMeofGwMap pending_map;
+  pending_map.epoch = 2;
+  auto msg1 = make_message<MNVMeofGwMap>(pending_map);
+  dout(0) << "before encode empty msg: " << *msg1 << " epoch " << msg1->get_gwmap_epoch() << dendl;
+  msg1->encode_payload(CEPH_FEATURES_ALL);
+  dout(0) << "after encode empty msg: " << *msg1 << dendl;
+  msg1->decode_payload();
+  int epoch = msg1->get_gwmap_epoch();
+  dout(0) << "after decode empty msg: " << *msg1 << " epoch " << epoch <<  dendl;
+
   pending_map.cfg_add_gw("GW1" ,group_key);
   pending_map.cfg_add_gw("GW2" ,group_key);
   pending_map.cfg_add_gw("GW3" ,group_key);
@@ -101,7 +110,9 @@ void test_MNVMeofGwMap() {
   dout(0) << "False pending map: " << pending_map << dendl;
 
   auto msg = make_message<MNVMeofGwMap>(pending_map);
-  msg->encode_payload(0);
+  dout(0) << "before encode msg: " << *msg << dendl;
+  msg->encode_payload(CEPH_FEATURES_ALL);
+  dout(0) << "after encode msg: " << *msg << dendl;
   msg->decode_payload();
   dout(0) << "decode msg: " << *msg << dendl;