Documentation ¶
Index ¶
- Constants
- type ClientCreationOpts
- type LanguageBindings
- type RPCBackpaginate
- type RPCCheck
- type RPCClient
- func (c *RPCClient) Backpaginate(t ct.TestLike, roomID string, count int) error
- func (c *RPCClient) BackupKeys(t ct.TestLike) (recoveryKey string, err error)
- func (c *RPCClient) Close(t ct.TestLike)
- func (c *RPCClient) CurrentAccessToken(t ct.TestLike) string
- func (c *RPCClient) DeletePersistentStorage(t ct.TestLike)
- func (c *RPCClient) ForceClose(t ct.TestLike)
- func (c *RPCClient) GetEvent(t ct.TestLike, roomID, eventID string) (*api.Event, error)
- func (c *RPCClient) GetNotification(t ct.TestLike, roomID, eventID string) (*api.Notification, error)
- func (c *RPCClient) InviteUser(t ct.TestLike, roomID, userID string) error
- func (c *RPCClient) IsRoomEncrypted(t ct.TestLike, roomID string) (bool, error)
- func (c *RPCClient) ListenForVerificationRequests(t ct.TestLike) chan api.VerificationStage
- func (c *RPCClient) LoadBackup(t ct.TestLike, recoveryKey string) error
- func (c *RPCClient) Logf(t ct.TestLike, format string, args ...interface{})
- func (c *RPCClient) Login(t ct.TestLike, opts api.ClientCreationOpts) error
- func (c *RPCClient) Opts() api.ClientCreationOpts
- func (c *RPCClient) RequestOwnUserVerification(t ct.TestLike) chan api.VerificationStage
- func (c *RPCClient) SendMessage(t ct.TestLike, roomID, text string) (eventID string, err error)
- func (c *RPCClient) StartSyncing(t ct.TestLike) (stopSyncing func(), err error)
- func (c *RPCClient) Type() api.ClientTypeLang
- func (c *RPCClient) UserID() string
- func (c *RPCClient) WaitUntilEventInRoom(t ct.TestLike, roomID string, checker func(e api.Event) bool) api.Waiter
- type RPCGetEvent
- type RPCGetNotification
- type RPCSendMessage
- type RPCServerWaiter
- type RPCWait
- type RPCWaitUntilEvent
- type RPCWaiter
- type Server
- func (s *Server) Backpaginate(input RPCBackpaginate, void *int) error
- func (s *Server) BackupKeys(testName string, recoveryKey *string) error
- func (s *Server) Close(testName string, void *int) error
- func (s *Server) CurrentAccessToken(testName string, token *string) error
- func (s *Server) DeletePersistentStorage(testName string, void *int) error
- func (s *Server) GetEvent(input RPCGetEvent, output *api.Event) error
- func (s *Server) GetNotification(input RPCGetNotification, output *api.Notification) (err error)
- func (s *Server) IsRoomEncrypted(roomID string, isEncrypted *bool) error
- func (s *Server) LoadBackup(recoveryKey string, void *int) error
- func (s *Server) Logf(input string, void *int) error
- func (s *Server) Login(opts api.ClientCreationOpts, void *int) error
- func (s *Server) MustCreateClient(opts ClientCreationOpts, void *int) error
- func (s *Server) Opts(void int, opts *api.ClientCreationOpts) error
- func (s *Server) SendMessage(msg RPCSendMessage, eventID *string) error
- func (s *Server) StartSyncing(testName string, void *int) error
- func (s *Server) StopSyncing(testName string, void *int) error
- func (s *Server) Type(void int, clientType *api.ClientTypeLang) error
- func (s *Server) UserID(void int, userID *string) error
- func (s *Server) WaitUntilEventInRoom(input RPCWaitUntilEvent, waiterID *int) error
- func (s *Server) WaiterPoll(waiterID int, eventsToCheck *[]api.Event) error
- func (s *Server) WaiterStart(input RPCWait, void *int) error
Constants ¶
const InactivityThreshold = 60 * time.Second
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ClientCreationOpts ¶
type ClientCreationOpts struct { api.ClientCreationOpts Lang api.ClientTypeLang // need to know the type for pulling out the corret bindings ContextID string }
type LanguageBindings ¶
type LanguageBindings struct {
// contains filtered or unexported fields
}
LanguageBindings implements api.LanguageBindings and instead issues RPC calls to a remote server.
func NewLanguageBindings ¶
func NewLanguageBindings(rpcBinaryPath string, clientType api.ClientTypeLang, contextPrefix string) (*LanguageBindings, error)
func (*LanguageBindings) MustCreateClient ¶
func (r *LanguageBindings) MustCreateClient(t ct.TestLike, cfg api.ClientCreationOpts) api.Client
MustCreateClient starts the RPC server and configures it to use the correct language. Returns an error if:
- the binary cannot be found or run
- the server cannot be started
- IPC via stdout fails (used to extract the random high numbered port)
- the client cannot talk to the rpc server
func (*LanguageBindings) PostTestRun ¶
func (r *LanguageBindings) PostTestRun(contextID string)
func (*LanguageBindings) PreTestRun ¶
func (r *LanguageBindings) PreTestRun(contextID string)
type RPCBackpaginate ¶
Backpaginate in this room by `count` events.
type RPCClient ¶
type RPCClient struct {
// contains filtered or unexported fields
}
RPCClient implements api.Client by making RPC calls to an RPC server, which actually has a concrete api.Client
func (*RPCClient) Backpaginate ¶
Backpaginate in this room by `count` events.
func (*RPCClient) BackupKeys ¶
BackupKeys will backup E2EE keys, else return an error.
func (*RPCClient) Close ¶
Close is called to clean up resources. Specifically, we need to shut off existing browsers and any FFI bindings. If we get callbacks/events after this point, tests may panic if the callbacks log messages.
func (*RPCClient) DeletePersistentStorage ¶
Remove any persistent storage, if it was enabled.
func (*RPCClient) ForceClose ¶
func (*RPCClient) GetEvent ¶
GetEvent will return the client's view of this event, or return an error if the event cannot be found.
func (*RPCClient) GetNotification ¶
func (*RPCClient) InviteUser ¶
func (*RPCClient) IsRoomEncrypted ¶
IsRoomEncrypted returns true if the room is encrypted. May return an error e.g if you provide a bogus room ID.
func (*RPCClient) ListenForVerificationRequests ¶
func (c *RPCClient) ListenForVerificationRequests(t ct.TestLike) chan api.VerificationStage
func (*RPCClient) LoadBackup ¶
LoadBackup will recover E2EE keys from the latest backup, else return an error.
func (*RPCClient) Opts ¶
func (c *RPCClient) Opts() api.ClientCreationOpts
func (*RPCClient) RequestOwnUserVerification ¶
func (c *RPCClient) RequestOwnUserVerification(t ct.TestLike) chan api.VerificationStage
func (*RPCClient) SendMessage ¶
SendMessage tries to send the message, but can fail.
func (*RPCClient) StartSyncing ¶
StartSyncing to begin syncing from sync v2 / sliding sync. Tests should call stopSyncing() at the end of the test. MUST BLOCK until the initial sync is complete. Returns an error if there was a problem syncing.
func (*RPCClient) Type ¶
func (c *RPCClient) Type() api.ClientTypeLang
func (*RPCClient) WaitUntilEventInRoom ¶
func (c *RPCClient) WaitUntilEventInRoom(t ct.TestLike, roomID string, checker func(e api.Event) bool) api.Waiter
Wait until an event is seen in the given room. The checker functions can be custom or you can use a pre-defined one like api.CheckEventHasMembership, api.CheckEventHasBody, or api.CheckEventHasEventID.
type RPCGetEvent ¶
type RPCGetNotification ¶
type RPCSendMessage ¶
type RPCServerWaiter ¶
type RPCWaitUntilEvent ¶
type RPCWaiter ¶
type RPCWaiter struct {
// contains filtered or unexported fields
}
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server exposes the api.Client interface over the wire, consumed via net/rpc. Args and return params must be encodable with encoding/gob. All functions on this struct must meet the form:
func (t *T) MethodName(argType T1, replyType *T2) error
func (*Server) Backpaginate ¶
func (s *Server) Backpaginate(input RPCBackpaginate, void *int) error
func (*Server) BackupKeys ¶
BackupKeys will backup E2EE keys, else fail the test.
func (*Server) CurrentAccessToken ¶
func (*Server) DeletePersistentStorage ¶
func (*Server) GetEvent ¶
func (s *Server) GetEvent(input RPCGetEvent, output *api.Event) error
GetEvent will return the client's view of this event, or returns an error if the event cannot be found.
func (*Server) GetNotification ¶
func (s *Server) GetNotification(input RPCGetNotification, output *api.Notification) (err error)
func (*Server) IsRoomEncrypted ¶
func (*Server) MustCreateClient ¶
func (s *Server) MustCreateClient(opts ClientCreationOpts, void *int) error
MustCreateClient creates a given client and returns it to the caller, else returns an error.
func (*Server) SendMessage ¶
func (s *Server) SendMessage(msg RPCSendMessage, eventID *string) error
func (*Server) WaitUntilEventInRoom ¶
func (s *Server) WaitUntilEventInRoom(input RPCWaitUntilEvent, waiterID *int) error