fix_: create/restore account error signal (#6174)

* fix_: publish node.login signal with error

* test_: use node.login signal instead of node.ready
This commit is contained in:
Igor Sirotin 2024-12-06 20:45:28 +00:00 committed by GitHub
parent e7cc535292
commit 3a0080281f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 16 additions and 7 deletions

View File

@ -531,7 +531,7 @@ func createAccountAndLogin(requestJSON string) string {
_, err := statusBackend.CreateAccountAndLogin(&request)
if err != nil {
logutils.ZapLogger().Error("failed to create account", zap.Error(err))
return err
return statusBackend.LoggedIn("", err)
}
logutils.ZapLogger().Debug("started a node, and created account")
return nil
@ -603,7 +603,7 @@ func restoreAccountAndLogin(requestJSON string) string {
if err != nil {
logutils.ZapLogger().Error("failed to restore account", zap.Error(err))
return err
return statusBackend.LoggedIn("", err)
}
logutils.ZapLogger().Debug("started a node, and restored account")
return nil

View File

@ -87,6 +87,12 @@ class SignalClient:
return self.received_signals[signal_type]["received"][-1]
return self.received_signals[signal_type]["received"][-delta_count:]
def wait_for_login(self):
signal = self.wait_for_signal(SignalType.NODE_LOGIN.value)
if "error" in signal["event"]:
assert not signal["event"]["error"]
return signal
def find_signal_containing_pattern(self, signal_type, event_pattern, timeout=20):
start_time = time.time()
while True:

View File

@ -64,6 +64,9 @@ class StatusBackend(RpcClient, SignalClient):
method = "InitializeApplication"
data = {
"dataDir": data_dir,
"logEnabled": True,
"logLevel": "DEBUG",
"apiLogging": True,
}
return self.api_valid_request(method, data)
@ -76,7 +79,7 @@ class StatusBackend(RpcClient, SignalClient):
"password": password,
"customizationColor": "primary",
"logEnabled": True,
"logLevel": "INFO",
"logLevel": "DEBUG",
}
return self.api_valid_request(method, data)
@ -90,7 +93,7 @@ class StatusBackend(RpcClient, SignalClient):
"mnemonic": user.passphrase,
"customizationColor": "blue",
"logEnabled": True,
"logLevel": "INFO",
"logLevel": "DEBUG",
"testNetworksEnabled": True,
"networkId": 31337,
"networksOverride": [

View File

@ -25,7 +25,7 @@ class StatusDTestCase:
class StatusBackendTestCase:
await_signals = [
SignalType.NODE_READY.value
SignalType.NODE_LOGIN.value
]
def setup_class(self):
@ -33,7 +33,7 @@ class StatusBackendTestCase:
self.rpc_client.init_status_backend()
self.rpc_client.restore_account_and_login()
self.rpc_client.wait_for_signal(SignalType.NODE_READY.value)
self.rpc_client.wait_for_login()
self.network_id = 31337

View File

@ -30,7 +30,7 @@ class TestInitialiseApp:
backend_client.verify_json_schema(
backend_client.wait_for_signal(SignalType.NODE_READY.value), "signal_node_ready")
backend_client.verify_json_schema(
backend_client.wait_for_signal(SignalType.NODE_LOGIN.value), "signal_node_login")
backend_client.wait_for_login(), "signal_node_login")
@pytest.mark.rpc