-
Notifications
You must be signed in to change notification settings - Fork 493
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Try to use persistent connection for CI tests
Store a persistent websocket client connection in the truenas_server object we allocate for test runs, and use this for general case where test simply uses `call` test utility. This is to avoid potentially running into issues with rate-limiting on auth endpoints.
- Loading branch information
Showing
3 changed files
with
111 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,12 @@ | ||
# -*- coding=utf-8 -*- | ||
from .client import client | ||
from .client import client, truenas_server | ||
|
||
__all__ = ["call"] | ||
|
||
|
||
def call(*args, **kwargs): | ||
with client(**kwargs.pop("client_kwargs", {})) as c: | ||
if not (client_kwargs := kwargs.pop("client_kwargs", {})) and truenas_server.ip: | ||
return truenas_server.client.call(*args, **kwargs) | ||
|
||
with client(client_kwargs) as c: | ||
return c.call(*args, **kwargs) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters