ct_rpc(3erl)

πŸ“¦
version 25.3.2.8 Β· 4 versions
, in ubuntu noble

πŸ¦‹ ct_rpc β€” Erlang Module Definition πŸ¦‹

okay so bestie, welcome to ct_rpc β€” the manual page for the module ct_rpc, straight out of common_test, and it's literally the Common Test specific layer on Erlang/OTP rpc. iykyk. πŸ’…


✨ NAME ✨

ct_rpc β€” Common Test specific layer on Erlang/OTP rpc. that's the whole vibe, no cap.


🌸 DESCRIPTION 🌸

Common Test specific layer on Erlang/OTP rpc. like, that's it, that's the description β€” it sits on top of Erlang/OTP's rpc and gives it that Common Test glow-up ✨


πŸ‘‘ EXPORTS πŸ‘‘

πŸŽ€ app_node(App, Candidates) -> NodeName

Types:

App = atom()
Candidates = [NodeName]
NodeName = atom()

so basically: from a set of candidate nodes, this figures out which one of them is running the application App. icon behavior, truly.

but β€” plot twist β€” if none of the candidate nodes is running App, the function makes the test case that's calling this function fail 😭 so like, don't sleep on it.

this one is exactly the same as calling app_node(App, Candidates, true). periodt.


πŸ¦‹ app_node(App, Candidates, FailOnBadRPC) -> NodeName

Types:

App = atom()
Candidates = [NodeName]
NodeName = atom()
FailOnBadRPC = true | false

same as ct_rpc:app_node/2, except that the argument FailOnBadRPC determines if the search for a candidate node is to stop if badrpc is received at some point. so like, FailOnBadRPC is the main character deciding whether the search keeps going or just taps out πŸ™ˆ


Types:

App = atom()
Candidates = [NodeName]
NodeName = atom()
FailOnBadRPC = true | false
Cookie = atom()

same as ct_rpc:app_node/2, except that the argument FailOnBadRPC determines if the search for a candidate node is to stop if badrpc is received at some point. yes bestie, same caveat as before πŸ’–

and also: the cookie on the client node is set to Cookie for this rpc operation (used to match the server node cookie). so the cookies have to match, it's giving friendship bracelet energy 🫢


πŸ’œ call(Node, Module, Function, Args) -> term() | {badrpc, Reason}

same as call(Node, Module, Function, Args, infinity). infinity!! we love an unlimited timeout πŸ•°οΈβœ¨


πŸ”₯ call(Node, Module, Function, Args, TimeOut) -> term() | {badrpc, Reason}

Types:

Node = NodeName | {Fun, FunArgs}
Fun = function()
FunArgs = term()
NodeName = atom()
Module = atom()
Function = atom()
Args = [term()]
Reason = timeout | term()

evaluates apply(Module, Function, Args) on the node Node. 🧚

returns either whatever Function returns, or {badrpc, Reason} if the remote procedure call fails. no in-between, it's giving all or nothing.

and if Node is {Fun, FunArgs}, then applying Fun to FunArgs is to return a node name. cute little indirection moment.


Types:

Node = NodeName | {Fun, FunArgs}
Fun = function()
FunArgs = term()
NodeName = atom()
Module = atom()
Function = atom()
Args = [term()]
Reason = timeout | term()
Cookie = atom()

evaluates apply(Module, Function, Args) on the node Node. same deal as above πŸ’«

returns either whatever Function returns, or {badrpc, Reason} if the remote procedure call fails. if Node is {Fun, FunArgs}, applying Fun to FunArgs is to return a node name.

and the extra sprinkle: the cookie on the client node is set to Cookie for this rpc operation (used to match the server node cookie). cookie match = vibe match πŸͺ


🧚 cast(Node, Module, Function, Args) -> ok

Types:

Node = NodeName | {Fun, FunArgs}
Fun = function()
FunArgs = term()
NodeName = atom()
Module = atom()
Function = atom()
Args = [term()]
Reason = timeout | term()

evaluates apply(Module, Function, Args) on the node Node.

no response is delivered and the process that makes the call is not suspended until the evaluation is completed as in the case of call/3,4. like, it just fires it off into the void and keeps it moving πŸ’€ fire-and-forget main character energy.

if Node is {Fun, FunArgs}, applying Fun to FunArgs is to return a node name.


Types:

Node = NodeName | {Fun, FunArgs}
Fun = function()
FunArgs = term()
NodeName = atom()
Module = atom()
Function = atom()
Args = [term()]
Reason = timeout | term()
Cookie = atom()

evaluates apply(Module, Function, Args) on the node Node. no response is delivered and the process that makes the call is not suspended until the evaluation is completed as in the case of call/3,4. same silent-queen behavior as cast/4 πŸ‘‘

if Node is {Fun, FunArgs}, applying Fun to FunArgs is to return a node name.

and once again: the cookie on the client node is set to Cookie for this rpc operation (used to match the server node cookie). πŸͺπŸ’–


ngl bestie, quick recap of the whole page: app_node finds the node running an app (and fails your test case if nobody is), call actually waits for an answer and hands you {badrpc, Reason} if it goes sideways, and cast just yeets it and returns ok with zero waiting. the Cookie variants set the client node cookie for the operation so it matches the server node cookie. that's the tea β˜•

made with love by Ericsson AB πŸ’œ β€” this is common_test version 1.24.0.1, and the page itself is ct_rpc(3erl). slay, go write some tests, mwah πŸŽ€βœ¨

πŸ“¦ where this page comes from