Start a minimal plugin and ensure it is well-behaved
(node_factory)
| 80 | |
| 81 | |
| 82 | def test_plugin_options_handle_defaults(node_factory): |
| 83 | """Start a minimal plugin and ensure it is well-behaved |
| 84 | """ |
| 85 | bin_path = Path.cwd() / "target" / RUST_PROFILE / "examples" / "cln-plugin-startup" |
| 86 | l1 = node_factory.get_node( |
| 87 | options={ |
| 88 | "plugin": str(bin_path), |
| 89 | "opt-option": 31337, |
| 90 | "test-option": 31338, |
| 91 | "multi-str-option": ["String1", "String2"], |
| 92 | "multi-str-option-default": ["NotDefault1", "NotDefault2"], |
| 93 | "multi-i64-option": [1, 2, 3, 4], |
| 94 | "multi-i64-option-default": [5, 6], |
| 95 | } |
| 96 | ) |
| 97 | opts = l1.rpc.testoptions() |
| 98 | assert opts["opt-option"] == 31337 |
| 99 | assert opts["test-option"] == 31338 |
| 100 | assert opts["multi-str-option"] == ["String1", "String2"] |
| 101 | assert opts["multi-str-option-default"] == ["NotDefault1", "NotDefault2"] |
| 102 | assert opts["multi-i64-option"] == [1, 2, 3, 4] |
| 103 | assert opts["multi-i64-option-default"] == [5, 6] |
| 104 | |
| 105 | # Do not set any value, should be None now |
| 106 | l1 = node_factory.get_node(options={"plugin": str(bin_path)}) |
| 107 | opts = l1.rpc.testoptions() |
| 108 | assert opts["opt-option"] is None, "opt-option has no default" |
| 109 | assert opts["test-option"] == 42, "test-option has a default of 42" |
| 110 | assert opts["multi-str-option"] is None |
| 111 | assert opts["multi-str-option-default"] == ["Default1"] |
| 112 | assert opts["multi-i64-option"] is None |
| 113 | assert opts["multi-i64-option-default"] == [-42] |
| 114 | |
| 115 | |
| 116 | def test_plugin_log_levels(node_factory): |