ci(tutorials): add smoke test for code (#85)

This commit is contained in:
vladopajic
2026-07-23 17:29:14 +00:00
committed by GitHub
parent 8fbe82c38d
commit cfbe14af07
10 changed files with 216 additions and 92 deletions
+25 -17
View File
@@ -65,14 +65,18 @@ int main()
/// Verify that the node is actually listening on the configured port:
auto info = node.peerInfo();
if (info.success) {
printf("\nNode is live!\n");
printf(" Peer ID: %s\n",
info.value["peerId"].get<std::string>().c_str());
for (const auto& addr : info.value["addrs"]) {
printf(" Listening on: %s\n",
addr.get<std::string>().c_str());
}
if (!info.success) {
fprintf(stderr, "Failed to get node info: %s\n",
info.error.c_str());
return 1;
}
printf("\nNode is live!\n");
printf(" Peer ID: %s\n",
info.value["peerId"].get<std::string>().c_str());
for (const auto& addr : info.value["addrs"]) {
printf(" Listening on: %s\n",
addr.get<std::string>().c_str());
}
node.stop();
@@ -114,14 +118,18 @@ int main()
}
auto info2 = nodeFromJson.peerInfo();
if (info2.success) {
printf("\nJSON-configured node is live!\n");
printf(" Peer ID: %s\n",
info2.value["peerId"].get<std::string>().c_str());
for (const auto& addr : info2.value["addrs"]) {
printf(" Listening on: %s\n",
addr.get<std::string>().c_str());
}
if (!info2.success) {
fprintf(stderr, "Failed to get JSON-configured node info: %s\n",
info2.error.c_str());
return 1;
}
printf("\nJSON-configured node is live!\n");
printf(" Peer ID: %s\n",
info2.value["peerId"].get<std::string>().c_str());
for (const auto& addr : info2.value["addrs"]) {
printf(" Listening on: %s\n",
addr.get<std::string>().c_str());
}
nodeFromJson.stop();
@@ -157,4 +165,4 @@ int main()
///
/// ```bash
/// ./build/tutorial/tutorial_2_custom_config
/// ```
/// ```