From 79408f6ed86c1c70d81456290e77393def5dae4c Mon Sep 17 00:00:00 2001
From: Georgy Moshkin <gmoshkin@picodata.io>
Date: Tue, 23 Jan 2024 16:15:07 +0300
Subject: [PATCH] test: use .proc_runtime_info in tests

---
 src/luamod.rs                | 25 -------------------------
 test/int/test_replication.py |  2 +-
 test/int/test_snapshot.py    |  6 ++++--
 3 files changed, 5 insertions(+), 28 deletions(-)

diff --git a/src/luamod.rs b/src/luamod.rs
index baee8b5444..6f5c6d2a9f 100644
--- a/src/luamod.rs
+++ b/src/luamod.rs
@@ -275,31 +275,6 @@ pub(crate) fn setup(args: &args::Run) {
         tlua::function0(|| traft::node::global().map(|n| n.status())),
     );
 
-    ///////////////////////////////////////////////////////////////////////////
-    // FIXME: too many statuses
-    luamod_set(
-        &l,
-        "_governor_loop_status",
-        indoc! {"
-        pico._governor_loop_status()
-        ==================
-
-        Returns the governor loop status.
-
-        Returns:
-
-            (string)
-            or
-            (nil, string) in case of an error, if the raft node is
-                not initialized yet
-
-        "},
-        tlua::Function::new(|| -> traft::Result<&'static str> {
-            let node = traft::node::global()?;
-            Ok(node.governor_loop.status.get().governor_loop_status)
-        }),
-    );
-
     luamod_set(
         &l,
         "raft_tick",
diff --git a/test/int/test_replication.py b/test/int/test_replication.py
index 651e12db47..3bd4baecc9 100644
--- a/test/int/test_replication.py
+++ b/test/int/test_replication.py
@@ -195,7 +195,7 @@ def wait_governor_status(i: Instance, expected_status, timeout=5):
         pass
 
     def impl():
-        actual_status = i.call("pico._governor_loop_status")
+        actual_status = i.call(".proc_runtime_info")["internal"]["governor_loop_status"]
         if actual_status == "not a leader":
             raise NotALeader("not a leader")
 
diff --git a/test/int/test_snapshot.py b/test/int/test_snapshot.py
index 20febb93f6..d04e3359e1 100644
--- a/test/int/test_snapshot.py
+++ b/test/int/test_snapshot.py
@@ -212,7 +212,8 @@ def test_large_snapshot(cluster: Cluster):
     # Wait for i4 to start receiving the snapshot
     Retriable(10, 60).call(
         lambda: assert_eq(
-            i4.eval("return pico.raft_status().main_loop_status"), "receiving snapshot"
+            i4.call(".proc_runtime_info")["internal"]["main_loop_status"],
+            "receiving snapshot",
         )
     )
 
@@ -230,7 +231,8 @@ def test_large_snapshot(cluster: Cluster):
     # Wait for i5 to start receiving the snapshot
     Retriable(10, 60).call(
         lambda: assert_eq(
-            i5.eval("return pico.raft_status().main_loop_status"), "receiving snapshot"
+            i5.call(".proc_runtime_info")["internal"]["main_loop_status"],
+            "receiving snapshot",
         )
     )
 
-- 
GitLab