From cc0ce1f7e7b4319b9f6db1a90c45102d3cb362e2 Mon Sep 17 00:00:00 2001 From: josh <josh@elixxir.io> Date: Wed, 6 Apr 2022 14:30:05 -0700 Subject: [PATCH] Fix bad refactor (Manager -> State across codebase --- bindings/ud.go | 6 ++--- dummy/send_test.go | 8 +++--- e2e/ratchet/partner/manager.go | 2 +- e2e/ratchet/partner/manager_test.go | 8 +++--- e2e/ratchet/partner/session/session.go | 2 +- e2e/ratchet/partner/session/session_test.go | 2 +- e2e/ratchet/partner/utils_test.go | 10 +++---- e2e/ratchet/ratchet_test.go | 4 +-- e2e/ratchet/utils_test.go | 10 +++---- fileTransfer/oldTransferRecovery_test.go | 6 ++--- fileTransfer/receiveNew_test.go | 12 ++++----- fileTransfer/receive_test.go | 6 ++--- fileTransfer/sendNew_test.go | 4 +-- fileTransfer/send_test.go | 30 ++++++++++----------- fileTransfer/utils_test.go | 2 +- groupChat/makeGroup_test.go | 2 +- groupChat/manager_test.go | 4 +-- groupChat/receive_test.go | 24 ++++++++--------- groupChat/sendRequests_test.go | 8 +++--- groupChat/send_test.go | 12 ++++----- interfaces/networkManager.go | 4 +-- network/interface.go | 4 +-- single/manager_test.go | 2 +- storage/ud/facts.go | 2 +- ud/addFact_test.go | 2 +- ud/manager.go | 2 +- ud/manager_test.go | 2 +- ud/search_test.go | 2 +- 28 files changed, 91 insertions(+), 91 deletions(-) diff --git a/bindings/ud.go b/bindings/ud.go index 9ca14b918..df34f572d 100644 --- a/bindings/ud.go +++ b/bindings/ud.go @@ -35,12 +35,12 @@ type UserDiscovery struct { func NewUserDiscovery(client *Client) (*UserDiscovery, error) { single, err := client.getSingle() if err != nil { - return nil, errors.WithMessage(err, "Failed to create User Discovery State") + return nil, errors.WithMessage(err, "Failed to create User Discovery Manager") } m, err := ud.NewManager(&client.api, single) if err != nil { - return nil, errors.WithMessage(err, "Failed to create User Discovery State") + return nil, errors.WithMessage(err, "Failed to create User Discovery Manager") } else { return &UserDiscovery{ud: m}, nil } @@ -335,7 +335,7 @@ func (ud *UserDiscovery) SetAlternativeUserDiscovery(address, cert, contactFile } // UnsetAlternativeUserDiscovery clears out the information from -// the State object. +// the Manager object. func (ud *UserDiscovery) UnsetAlternativeUserDiscovery() error { return ud.ud.UnsetAlternativeUserDiscovery() } diff --git a/dummy/send_test.go b/dummy/send_test.go index ba299018a..6a5a91fef 100644 --- a/dummy/send_test.go +++ b/dummy/send_test.go @@ -19,7 +19,7 @@ import ( "time" ) -// Tests that State.sendThread sends multiple sets of messages. +// Tests that Manager.sendThread sends multiple sets of messages. func TestManager_sendThread(t *testing.T) { m := newTestManager(10, 50*time.Millisecond, 10*time.Millisecond, false, t) @@ -86,7 +86,7 @@ func TestManager_sendThread(t *testing.T) { } -// Tests that State.sendMessages sends all the messages with the correct +// Tests that Manager.sendMessages sends all the messages with the correct // recipient. func TestManager_sendMessages(t *testing.T) { m := newTestManager(100, 0, 0, false, t) @@ -135,7 +135,7 @@ func TestManager_sendMessages(t *testing.T) { } } -// Tests that State.newRandomMessages creates a non-empty map of messages and +// Tests that Manager.newRandomMessages creates a non-empty map of messages and // that each message is unique. func TestManager_newRandomMessages(t *testing.T) { m := newTestManager(10, 0, 0, false, t) @@ -161,7 +161,7 @@ func TestManager_newRandomMessages(t *testing.T) { } } -// Tests that State.newRandomCmixMessage generates a cMix message with +// Tests that Manager.newRandomCmixMessage generates a cMix message with // populated contents, fingerprint, and MAC. func TestManager_newRandomCmixMessage(t *testing.T) { m := newTestManager(0, 0, 0, false, t) diff --git a/e2e/ratchet/partner/manager.go b/e2e/ratchet/partner/manager.go index b76ec74bc..fe5621e41 100644 --- a/e2e/ratchet/partner/manager.go +++ b/e2e/ratchet/partner/manager.go @@ -25,7 +25,7 @@ import ( "golang.org/x/crypto/blake2b" ) -const managerPrefix = "State{partner:%s}" +const managerPrefix = "Manager{partner:%s}" const originMyPrivKeyKey = "originMyPrivKey" const originPartnerPubKey = "originPartnerPubKey" diff --git a/e2e/ratchet/partner/manager_test.go b/e2e/ratchet/partner/manager_test.go index 78b188bef..45a25e9ba 100644 --- a/e2e/ratchet/partner/manager_test.go +++ b/e2e/ratchet/partner/manager_test.go @@ -40,7 +40,7 @@ func Test_newManager(t *testing.T) { // Check if the new relationship matches the expected if !managersEqual(expectedM, m, t) { - t.Errorf("newManager() did not produce the expected State."+ + t.Errorf("newManager() did not produce the expected Manager."+ "\n\texpected: %+v\n\treceived: %+v", expectedM, m) } } @@ -59,7 +59,7 @@ func TestLoadManager(t *testing.T) { // Check if the loaded relationship matches the expected if !managersEqual(expectedM, m, t) { - t.Errorf("LoadManager() did not produce the expected State."+ + t.Errorf("LoadManager() did not produce the expected Manager."+ "\n\texpected: %+v\n\treceived: %+v", expectedM, m) } } @@ -167,7 +167,7 @@ func TestManager_NewSendSession(t *testing.T) { } } -//Tests happy path of State.GetKeyForSending. +//Tests happy path of Manager.GetKeyForSending. func TestManager_GetKeyForSending(t *testing.T) { // Set up test values m, _ := newTestManager(t) @@ -214,7 +214,7 @@ func TestManager_GetKeyForSending(t *testing.T) { } } -// Tests that State.GetKeyForSending returns an error for invalid SendType. +// Tests that Manager.GetKeyForSending returns an error for invalid SendType. func TestManager_GetKeyForSending_Error(t *testing.T) { // Set up test values m, _ := newTestManager(t) diff --git a/e2e/ratchet/partner/session/session.go b/e2e/ratchet/partner/session/session.go index dcb72b84a..a62cf9161 100644 --- a/e2e/ratchet/partner/session/session.go +++ b/e2e/ratchet/partner/session/session.go @@ -387,7 +387,7 @@ func (s *Session) Status() Status { // Moving from Unconfirmed to Sending and from Confirmed to NewSessionTriggered // is handled by Session.TriggerNegotiation() which is called by the -// State as part of State.TriggerNegotiations() and will be rejected +// Manager as part of Manager.TriggerNegotiations() and will be rejected // from this function var legalStateChanges = [][]bool{ diff --git a/e2e/ratchet/partner/session/session_test.go b/e2e/ratchet/partner/session/session_test.go index 049d4ecea..c22fdc582 100644 --- a/e2e/ratchet/partner/session/session_test.go +++ b/e2e/ratchet/partner/session/session_test.go @@ -157,7 +157,7 @@ func TestSession_Serialization(t *testing.T) { sDeserialized := &Session{ //relationship: &ratchet.relationship{ - // manager: &partner.State{ctx: ctx}, + // manager: &partner.Manager{ctx: ctx}, //}, grp: s.grp, kv: s.kv, diff --git a/e2e/ratchet/partner/utils_test.go b/e2e/ratchet/partner/utils_test.go index 3667f4d7e..7984535e2 100644 --- a/e2e/ratchet/partner/utils_test.go +++ b/e2e/ratchet/partner/utils_test.go @@ -89,31 +89,31 @@ func newTestManager(t *testing.T) (*Manager, *versioned.KV) { func managersEqual(expected, received *Manager, t *testing.T) bool { equal := true if !reflect.DeepEqual(expected.cyHandler, received.cyHandler) { - t.Errorf("Did not Receive expected State.ctx."+ + t.Errorf("Did not Receive expected Manager.cyHandler."+ "\n\texpected: %+v\n\treceived: %+v", expected.cyHandler, received.cyHandler) equal = false } if !reflect.DeepEqual(expected.kv, received.kv) { - t.Errorf("Did not Receive expected State.kv."+ + t.Errorf("Did not Receive expected Manager.kv."+ "\n\texpected: %+v\n\treceived: %+v", expected.kv, received.kv) equal = false } if !expected.partner.Cmp(received.partner) { - t.Errorf("Did not Receive expected State.partner."+ + t.Errorf("Did not Receive expected Manager.partner."+ "\n\texpected: %+v\n\treceived: %+v", expected.partner, received.partner) equal = false } if !relationshipsEqual(expected.receive, received.receive) { - t.Errorf("Did not Receive expected State.Receive."+ + t.Errorf("Did not Receive expected Manager.Receive."+ "\n\texpected: %+v\n\treceived: %+v", expected.receive, received.receive) equal = false } if !relationshipsEqual(expected.send, received.send) { - t.Errorf("Did not Receive expected State.Send."+ + t.Errorf("Did not Receive expected Manager.Send."+ "\n\texpected: %+v\n\treceived: %+v", expected.send, received.send) equal = false diff --git a/e2e/ratchet/ratchet_test.go b/e2e/ratchet/ratchet_test.go index e44d7676c..b6b03da10 100644 --- a/e2e/ratchet/ratchet_test.go +++ b/e2e/ratchet/ratchet_test.go @@ -116,7 +116,7 @@ func TestStore_AddPartner(t *testing.T) { m, exists := r.managers[relationshipId] if !exists { - t.Errorf("State does not exist in map.\n\tmap: %+v", + t.Errorf("Manager does not exist in map.\n\tmap: %+v", r.managers) } @@ -184,7 +184,7 @@ func TestStore_GetPartner(t *testing.T) { } if !reflect.DeepEqual(expectedManager, m) { - t.Errorf("GetPartner() returned wrong State."+ + t.Errorf("GetPartner() returned wrong Manager."+ "\n\texpected: %v\n\treceived: %v", expectedManager, m) } } diff --git a/e2e/ratchet/utils_test.go b/e2e/ratchet/utils_test.go index 8e61934e4..2856948e6 100644 --- a/e2e/ratchet/utils_test.go +++ b/e2e/ratchet/utils_test.go @@ -45,34 +45,34 @@ func makeTestRatchet() (*Ratchet, *versioned.KV, error) { func managersEqual(expected, received *partner.Manager, t *testing.T) bool { equal := true if !reflect.DeepEqual(expected.GetPartnerID(), received.GetPartnerID()) { - t.Errorf("Did not Receive expected State.partnerID."+ + t.Errorf("Did not Receive expected Manager.partnerID."+ "\n\texpected: %+v\n\treceived: %+v", expected.GetPartnerID(), received.GetPartnerID()) equal = false } if !strings.EqualFold(expected.GetRelationshipFingerprint(), received.GetRelationshipFingerprint()) { - t.Errorf("Did not Receive expected State.Receive."+ + t.Errorf("Did not Receive expected Manager.Receive."+ "\n\texpected: %+v\n\treceived: %+v", expected.GetRelationshipFingerprint(), received.GetRelationshipFingerprint()) equal = false } if !reflect.DeepEqual(expected.GetMyID(), received.GetMyID()) { - t.Errorf("Did not Receive expected State.myId."+ + t.Errorf("Did not Receive expected Manager.myId."+ "\n\texpected: %+v\n\treceived: %+v", expected.GetMyID(), received.GetPartnerID()) equal = false } if !reflect.DeepEqual(expected.GetMyOriginPrivateKey(), received.GetMyOriginPrivateKey()) { - t.Errorf("Did not Receive expected State.MyPrivateKey."+ + t.Errorf("Did not Receive expected Manager.MyPrivateKey."+ "\n\texpected: %+v\n\treceived: %+v", expected.GetMyOriginPrivateKey(), received.GetMyOriginPrivateKey()) equal = false } if !reflect.DeepEqual(expected.GetSendRelationshipFingerprint(), received.GetSendRelationshipFingerprint()) { - t.Errorf("Did not Receive expected State.SendRelationshipFingerprint."+ + t.Errorf("Did not Receive expected Manager.SendRelationshipFingerprint."+ "\n\texpected: %+v\n\treceived: %+v", expected.GetSendRelationshipFingerprint(), received.GetSendRelationshipFingerprint()) equal = false diff --git a/fileTransfer/oldTransferRecovery_test.go b/fileTransfer/oldTransferRecovery_test.go index 5a352a1d3..561785100 100644 --- a/fileTransfer/oldTransferRecovery_test.go +++ b/fileTransfer/oldTransferRecovery_test.go @@ -25,7 +25,7 @@ import ( "time" ) -// Tests that State.oldTransferRecovery adds all unsent parts to the queue. +// Tests that Manager.oldTransferRecovery adds all unsent parts to the queue. func TestManager_oldTransferRecovery(t *testing.T) { kv := versioned.NewKV(make(ekv.Memstore)) m, sti, _ := newTestManagerWithTransfers( @@ -188,7 +188,7 @@ func TestManager_oldTransferRecovery(t *testing.T) { } } -// Tests that State.updateSentRounds updates the status of each round +// Tests that Manager.updateSentRounds updates the status of each round // correctly by using the part tracker and checks that all the correct parts // were added to the queue. func TestManager_updateSentRounds(t *testing.T) { @@ -312,7 +312,7 @@ func TestManager_updateSentRounds(t *testing.T) { } } -// Error path: tests that State.updateSentRounds returns the expected error +// Error path: tests that Manager.updateSentRounds returns the expected error // when getRoundResults returns only errors. func TestManager_updateSentRounds_Error(t *testing.T) { kv := versioned.NewKV(make(ekv.Memstore)) diff --git a/fileTransfer/receiveNew_test.go b/fileTransfer/receiveNew_test.go index abc470cd0..4aea311fa 100644 --- a/fileTransfer/receiveNew_test.go +++ b/fileTransfer/receiveNew_test.go @@ -19,7 +19,7 @@ import ( "time" ) -// Tests that State.receiveNewFileTransfer receives the sent message and that +// Tests that Manager.receiveNewFileTransfer receives the sent message and that // it reports the correct data to the callback. func TestManager_receiveNewFileTransfer(t *testing.T) { // Create new ReceiveCallback that sends the results on a channel @@ -88,7 +88,7 @@ func TestManager_receiveNewFileTransfer(t *testing.T) { } } -// Tests that State.receiveNewFileTransfer stops receiving messages when the +// Tests that Manager.receiveNewFileTransfer stops receiving messages when the // stoppable is triggered. func TestManager_receiveNewFileTransfer_Stop(t *testing.T) { // Create new ReceiveCallback that sends the results on a channel @@ -149,7 +149,7 @@ func TestManager_receiveNewFileTransfer_Stop(t *testing.T) { } } -// Tests that State.receiveNewFileTransfer does not report on the callback +// Tests that Manager.receiveNewFileTransfer does not report on the callback // when the received message is of the wrong type. func TestManager_receiveNewFileTransfer_InvalidMessageError(t *testing.T) { // Create new ReceiveCallback that sends the results on a channel @@ -191,7 +191,7 @@ func TestManager_receiveNewFileTransfer_InvalidMessageError(t *testing.T) { } } -// Tests that State.readNewFileTransferMessage returns the expected sender ID, +// Tests that Manager.readNewFileTransferMessage returns the expected sender ID, // file size, and preview. func TestManager_readNewFileTransferMessage(t *testing.T) { m := newTestManager(false, nil, nil, nil, nil, t) @@ -251,7 +251,7 @@ func TestManager_readNewFileTransferMessage(t *testing.T) { } } -// Error path: tests that State.readNewFileTransferMessage returns the +// Error path: tests that Manager.readNewFileTransferMessage returns the // expected error when the message.Receive has the wrong MessageType. func TestManager_readNewFileTransferMessage_MessageTypeError(t *testing.T) { m := newTestManager(false, nil, nil, nil, nil, t) @@ -271,7 +271,7 @@ func TestManager_readNewFileTransferMessage_MessageTypeError(t *testing.T) { } } -// Error path: tests that State.readNewFileTransferMessage returns the +// Error path: tests that Manager.readNewFileTransferMessage returns the // expected error when the payload of the message.Receive cannot be // unmarshalled. func TestManager_readNewFileTransferMessage_ProtoUnmarshalError(t *testing.T) { diff --git a/fileTransfer/receive_test.go b/fileTransfer/receive_test.go index 5a24712ce..cc28fc24f 100644 --- a/fileTransfer/receive_test.go +++ b/fileTransfer/receive_test.go @@ -20,7 +20,7 @@ import ( "time" ) -// Tests that State.receive returns the correct progress on the callback when +// Tests that Manager.receive returns the correct progress on the callback when // receiving a single message. func TestManager_receive(t *testing.T) { // Build a manager for sending and a manger for receiving @@ -133,7 +133,7 @@ func TestManager_receive(t *testing.T) { <-done } -// Tests that State.receive the progress callback is not called when the +// Tests that Manager.receive the progress callback is not called when the // stoppable is triggered. func TestManager_receive_Stop(t *testing.T) { // Build a manager for sending and a manger for receiving @@ -232,7 +232,7 @@ func TestManager_receive_Stop(t *testing.T) { <-done1 } -// Tests that State.readMessage reads the message without errors and that it +// Tests that Manager.readMessage reads the message without errors and that it // reports the correct progress on the callback. It also gets the file and // checks that the part is where it should be. func TestManager_readMessage(t *testing.T) { diff --git a/fileTransfer/sendNew_test.go b/fileTransfer/sendNew_test.go index f7accd75b..8a4da00a6 100644 --- a/fileTransfer/sendNew_test.go +++ b/fileTransfer/sendNew_test.go @@ -23,7 +23,7 @@ import ( "testing" ) -// Tests that the E2E message sent via State.sendNewFileTransfer matches +// Tests that the E2E message sent via Manager.sendNewFileTransfer matches // expected. func TestManager_sendNewFileTransfer(t *testing.T) { m := newTestManager(false, nil, nil, nil, nil, t) @@ -69,7 +69,7 @@ func TestManager_sendNewFileTransfer(t *testing.T) { } } -// Error path: tests that State.sendNewFileTransfer returns the expected error +// Error path: tests that Manager.sendNewFileTransfer returns the expected error // when SendE2E fails. func TestManager_sendNewFileTransfer_E2eError(t *testing.T) { // Create new test manager with a SendE2E error triggered diff --git a/fileTransfer/send_test.go b/fileTransfer/send_test.go index c4c2a4132..35e1f239a 100644 --- a/fileTransfer/send_test.go +++ b/fileTransfer/send_test.go @@ -35,7 +35,7 @@ import ( "time" ) -// Tests that State.sendThread successfully sends the parts and reports their +// Tests that Manager.sendThread successfully sends the parts and reports their // progress on the callback. func TestManager_sendThread(t *testing.T) { m, sti, _ := newTestManagerWithTransfers( @@ -114,7 +114,7 @@ func TestManager_sendThread(t *testing.T) { } } -// Tests that State.sendThread successfully sends the parts and reports their +// Tests that Manager.sendThread successfully sends the parts and reports their // progress on the callback. func TestManager_sendThread_NetworkNotHealthy(t *testing.T) { m, _, _ := newTestManagerWithTransfers( @@ -156,7 +156,7 @@ func TestManager_sendThread_NetworkNotHealthy(t *testing.T) { } } -// Tests that State.sendThread successfully sends a partially filled batch +// Tests that Manager.sendThread successfully sends a partially filled batch // of the correct length when its times out waiting for messages. func TestManager_sendThread_Timeout(t *testing.T) { m, sti, _ := newTestManagerWithTransfers( @@ -232,7 +232,7 @@ func TestManager_sendThread_Timeout(t *testing.T) { } } -// Tests that State.sendParts sends all the correct cMix messages and calls +// Tests that Manager.sendParts sends all the correct cMix messages and calls // the progress callbacks with the correct values. func TestManager_sendParts(t *testing.T) { m, sti, _ := newTestManagerWithTransfers( @@ -316,7 +316,7 @@ func TestManager_sendParts(t *testing.T) { wg.Wait() } -// Error path: tests that, on SendManyCMIX failure, State.sendParts adds the +// Error path: tests that, on SendManyCMIX failure, Manager.sendParts adds the // parts back into the queue, does not call the callback, and does not update // the progress. func TestManager_sendParts_SendManyCmixError(t *testing.T) { @@ -374,7 +374,7 @@ func TestManager_sendParts_SendManyCmixError(t *testing.T) { wg.Wait() } -// Error path: tests that State.sendParts returns the expected error whe +// Error path: tests that Manager.sendParts returns the expected error whe // getRoundResults returns an error. func TestManager_sendParts_RoundResultsError(t *testing.T) { m, sti, _ := newTestManagerWithTransfers( @@ -410,7 +410,7 @@ func TestManager_sendParts_RoundResultsError(t *testing.T) { } } -// Tests that State.buildMessages returns the expected values for a group +// Tests that Manager.buildMessages returns the expected values for a group // of 11 file parts from three different transfers. func TestManager_buildMessages(t *testing.T) { m, sti, _ := newTestManagerWithTransfers( @@ -505,7 +505,7 @@ func TestManager_buildMessages(t *testing.T) { } } -// Tests that State.buildMessages skips file parts with deleted transfers or +// Tests that Manager.buildMessages skips file parts with deleted transfers or // transfers that have run out of fingerprints. func TestManager_buildMessages_MessageBuildFailureError(t *testing.T) { m := newTestManager(false, nil, nil, nil, nil, t) @@ -601,7 +601,7 @@ func TestManager_buildMessages_MessageBuildFailureError(t *testing.T) { } } -// Tests that State.buildMessages returns the expected error when a queued +// Tests that Manager.buildMessages returns the expected error when a queued // part has an invalid part number. func TestManager_buildMessages_NewCmixMessageError(t *testing.T) { m := newTestManager(false, nil, nil, nil, nil, t) @@ -631,7 +631,7 @@ func TestManager_buildMessages_NewCmixMessageError(t *testing.T) { } -// Tests that State.newCmixMessage returns a format.Message with the correct +// Tests that Manager.newCmixMessage returns a format.Message with the correct // MAC, fingerprint, and contents. func TestManager_newCmixMessage(t *testing.T) { m := newTestManager(false, nil, nil, nil, nil, t) @@ -679,7 +679,7 @@ func TestManager_newCmixMessage(t *testing.T) { } } -// Tests that State.makeRoundEventCallback returns a callback that calls the +// Tests that Manager.makeRoundEventCallback returns a callback that calls the // progress callback when a round succeeds. func TestManager_makeRoundEventCallback(t *testing.T) { sendE2eChan := make(chan message.Receive, 100) @@ -783,7 +783,7 @@ func TestManager_makeRoundEventCallback(t *testing.T) { } } -// Tests that State.makeRoundEventCallback returns a callback that calls the +// Tests that Manager.makeRoundEventCallback returns a callback that calls the // progress callback with no parts sent on round failure. Also checks that the // file parts were added back into the queue. func TestManager_makeRoundEventCallback_RoundFailure(t *testing.T) { @@ -873,7 +873,7 @@ func TestManager_makeRoundEventCallback_RoundFailure(t *testing.T) { } } -// Tests that State.sendEndE2eMessage sends an E2E message with the expected +// Tests that Manager.sendEndE2eMessage sends an E2E message with the expected // recipient and message type. This does not test round tracking or critical // messages. func TestManager_sendEndE2eMessage(t *testing.T) { @@ -918,7 +918,7 @@ func TestManager_sendEndE2eMessage(t *testing.T) { } } -// Tests that State.queueParts adds all the expected parts to the sendQueue +// Tests that Manager.queueParts adds all the expected parts to the sendQueue // channel. func TestManager_queueParts(t *testing.T) { m := newTestManager(false, nil, nil, nil, nil, t) @@ -996,7 +996,7 @@ func Test_makeListOfPartNums(t *testing.T) { } } -// Tests that the part size returned by State.GetPartSize matches the manually +// Tests that the part size returned by Manager.GetPartSize matches the manually // calculated part size. func TestManager_getPartSize(t *testing.T) { m := newTestManager(false, nil, nil, nil, nil, t) diff --git a/fileTransfer/utils_test.go b/fileTransfer/utils_test.go index fc07d1394..0ea0e5386 100644 --- a/fileTransfer/utils_test.go +++ b/fileTransfer/utils_test.go @@ -392,7 +392,7 @@ type receivedTransferInfo struct { } //////////////////////////////////////////////////////////////////////////////// -// Test Network State // +// Test Network Manager // //////////////////////////////////////////////////////////////////////////////// func newTestNetworkManager(sendErr bool, sendChan, diff --git a/groupChat/makeGroup_test.go b/groupChat/makeGroup_test.go index 76a89fb3e..274505b1d 100644 --- a/groupChat/makeGroup_test.go +++ b/groupChat/makeGroup_test.go @@ -130,7 +130,7 @@ func TestManager_MakeGroup_AddGroupError(t *testing.T) { } } -// Unit test of State.buildMembership. +// Unit test of Manager.buildMembership. func TestManager_buildMembership(t *testing.T) { prng := rand.New(rand.NewSource(42)) m, _ := newTestManager(prng, t) diff --git a/groupChat/manager_test.go b/groupChat/manager_test.go index 3455b45d4..48ee13ea8 100644 --- a/groupChat/manager_test.go +++ b/groupChat/manager_test.go @@ -20,7 +20,7 @@ import ( "time" ) -// Unit test of State.newManager. +// Unit test of Manager.newManager. func Test_newManager(t *testing.T) { kv := versioned.NewKV(make(ekv.Memstore)) user := group.Member{ @@ -63,7 +63,7 @@ func Test_newManager(t *testing.T) { } } -// Tests that State.newManager loads a group storage when it exists. +// Tests that Manager.newManager loads a group storage when it exists. func Test_newManager_LoadStorage(t *testing.T) { prng := rand.New(rand.NewSource(42)) kv := versioned.NewKV(make(ekv.Memstore)) diff --git a/groupChat/receive_test.go b/groupChat/receive_test.go index c20bb6fdb..f353b83a6 100644 --- a/groupChat/receive_test.go +++ b/groupChat/receive_test.go @@ -21,13 +21,13 @@ import ( "time" ) -// Tests that State.receive returns the correct message on the callback. +// Tests that Manager.receive returns the correct message on the callback. func TestManager_receive(t *testing.T) { // Setup callback msgChan := make(chan MessageReceive) receiveFunc := func(msg MessageReceive) { msgChan <- msg } - // Create new test State and Group + // Create new test Manager and Group prng := rand.New(rand.NewSource(42)) m, g := newTestManagerWithStore(prng, 10, 0, nil, receiveFunc, t) @@ -85,7 +85,7 @@ func TestManager_receive_ReadMessageError(t *testing.T) { msgChan := make(chan MessageReceive) receiveFunc := func(msg MessageReceive) { msgChan <- msg } - // Create new test State and Group + // Create new test Manager and Group prng := rand.New(rand.NewSource(42)) m, _ := newTestManagerWithStore(prng, 10, 0, nil, receiveFunc, t) @@ -107,7 +107,7 @@ func TestManager_receive_ReadMessageError(t *testing.T) { // Tests that the quit channel exits the function. func TestManager_receive_QuitChan(t *testing.T) { - // Create new test State and Group + // Create new test Manager and Group prng := rand.New(rand.NewSource(42)) m, _ := newTestManagerWithStore(prng, 10, 0, nil, nil, t) @@ -131,10 +131,10 @@ func TestManager_receive_QuitChan(t *testing.T) { } } -// Tests that State.readMessage returns the message data for the correct +// Tests that Manager.readMessage returns the message data for the correct // group. func TestManager_readMessage(t *testing.T) { - // Create new test State and Group + // Create new test Manager and Group prng := rand.New(rand.NewSource(42)) m, expectedGrp := newTestManagerWithStore(prng, 10, 0, nil, nil, t) @@ -203,7 +203,7 @@ func TestManager_readMessage(t *testing.T) { // Error path: an error is returned when a group with a matching group // fingerprint cannot be found. func TestManager_readMessage_FindGroupKpError(t *testing.T) { - // Create new test State and Group + // Create new test Manager and Group prng := rand.New(rand.NewSource(42)) m, g := newTestManagerWithStore(prng, 10, 0, nil, nil, t) @@ -237,10 +237,10 @@ func TestManager_readMessage_FindGroupKpError(t *testing.T) { } } -// Tests that a cMix message created by State.newCmixMsg can be read by -// State.readMessage. +// Tests that a cMix message created by Manager.newCmixMsg can be read by +// Manager.readMessage. func TestManager_decryptMessage(t *testing.T) { - // Create new test State and Group + // Create new test Manager and Group prng := rand.New(rand.NewSource(42)) m, g := newTestManager(prng, t) @@ -296,7 +296,7 @@ func TestManager_decryptMessage(t *testing.T) { // Error path: an error is returned when the wrong timestamp is passed in and // the decryption key cannot be generated because of the wrong epoch. func TestManager_decryptMessage_GetCryptKeyError(t *testing.T) { - // Create new test State and Group + // Create new test Manager and Group prng := rand.New(rand.NewSource(42)) m, g := newTestManager(prng, t) @@ -326,7 +326,7 @@ func TestManager_decryptMessage_GetCryptKeyError(t *testing.T) { // Error path: an error is returned when the decrypted payload cannot be // unmarshalled. func TestManager_decryptMessage_UnmarshalInternalMsgError(t *testing.T) { - // Create new test State and Group + // Create new test Manager and Group prng := rand.New(rand.NewSource(42)) m, g := newTestManager(prng, t) diff --git a/groupChat/sendRequests_test.go b/groupChat/sendRequests_test.go index 397636890..14e5cb624 100644 --- a/groupChat/sendRequests_test.go +++ b/groupChat/sendRequests_test.go @@ -119,7 +119,7 @@ func TestManager_ResendRequest_GetGroupError(t *testing.T) { } } -// Tests that State.sendRequests sends all expected requests successfully. +// Tests that Manager.sendRequests sends all expected requests successfully. func TestManager_sendRequests(t *testing.T) { prng := rand.New(rand.NewSource(42)) m, g := newTestManagerWithStore(prng, 10, 0, nil, nil, t) @@ -196,7 +196,7 @@ func TestManager_sendRequests(t *testing.T) { } } -// Tests that State.sendRequests returns the correct status when all sends +// Tests that Manager.sendRequests returns the correct status when all sends // fail. func TestManager_sendRequests_SendAllFail(t *testing.T) { prng := rand.New(rand.NewSource(42)) @@ -225,7 +225,7 @@ func TestManager_sendRequests_SendAllFail(t *testing.T) { } } -// Tests that State.sendRequests returns the correct status when some sends +// Tests that Manager.sendRequests returns the correct status when some sends // fail. func TestManager_sendRequests_SendPartialSent(t *testing.T) { prng := rand.New(rand.NewSource(42)) @@ -267,7 +267,7 @@ func TestManager_sendRequests_SendPartialSent(t *testing.T) { } } -// Unit test of State.sendRequest. +// Unit test of Manager.sendRequest. func TestManager_sendRequest(t *testing.T) { prng := rand.New(rand.NewSource(42)) m, g := newTestManagerWithStore(prng, 10, 0, nil, nil, t) diff --git a/groupChat/send_test.go b/groupChat/send_test.go index 66af7fe0f..662c76ece 100644 --- a/groupChat/send_test.go +++ b/groupChat/send_test.go @@ -136,7 +136,7 @@ func TestManager_Send_SendManyCMIXError(t *testing.T) { } } -// Tests that State.createMessages generates the messages for the correct +// Tests that Manager.createMessages generates the messages for the correct // group. func TestManager_createMessages(t *testing.T) { prng := rand.New(rand.NewSource(42)) @@ -199,7 +199,7 @@ func TestManager_createMessages(t *testing.T) { func TestManager_createMessages_InvalidGroupIdError(t *testing.T) { expectedErr := strings.SplitN(newNoGroupErr, "%", 2)[0] - // Create new test State and Group + // Create new test Manager and Group prng := rand.New(rand.NewSource(42)) m, _ := newTestManagerWithStore(prng, 10, 0, nil, nil, t) @@ -212,7 +212,7 @@ func TestManager_createMessages_InvalidGroupIdError(t *testing.T) { } } -// Tests that State.newMessage returns messages with correct data. +// Tests that Manager.newMessage returns messages with correct data. func TestGroup_newMessages(t *testing.T) { prng := rand.New(rand.NewSource(42)) m, g := newTestManager(prng, t) @@ -275,7 +275,7 @@ func TestGroup_newMessages(t *testing.T) { } } -// Error path: an error is returned when State.neCmixMsg returns an error. +// Error path: an error is returned when Manager.neCmixMsg returns an error. func TestGroup_newMessages_NewCmixMsgError(t *testing.T) { expectedErr := strings.SplitN(newCmixErr, "%", 2)[0] prng := rand.New(rand.NewSource(42)) @@ -290,7 +290,7 @@ func TestGroup_newMessages_NewCmixMsgError(t *testing.T) { // Tests that the message returned by newCmixMsg has all the expected parts. func TestGroup_newCmixMsg(t *testing.T) { - // Create new test State and Group + // Create new test Manager and Group prng := rand.New(rand.NewSource(42)) m, g := newTestManager(prng, t) @@ -387,7 +387,7 @@ func TestGroup_newCmixMsg_SaltReaderError(t *testing.T) { func TestGroup_newCmixMsg_InternalMsgSizeError(t *testing.T) { expectedErr := strings.SplitN(messageLenErr, "%", 2)[0] - // Create new test State and Group + // Create new test Manager and Group prng := rand.New(rand.NewSource(42)) m, g := newTestManager(prng, t) diff --git a/interfaces/networkManager.go b/interfaces/networkManager.go index 2450f4038..b5104d101 100644 --- a/interfaces/networkManager.go +++ b/interfaces/networkManager.go @@ -137,7 +137,7 @@ type NetworkManager interface { /*===Nodes================================================================*/ /* Keys must be registed with nodes in order to send messages throug them. - this process is in general automatically handled by the Network State*/ + this process is in general automatically handled by the Network Manager*/ // HasNode can be used to determine if a keying relationship exists with a // node. @@ -153,7 +153,7 @@ type NetworkManager interface { /*===Historical Rounds====================================================*/ /* A complete set of round info is not kept on the client, and sometimes the network will need to be queried to get round info. Historical rounds - is the system internal to the Network State to do this. + is the system internal to the Network Manager to do this. It can be used externally as well.*/ // LookupHistoricalRound - looks up the passed historical round on the diff --git a/network/interface.go b/network/interface.go index 6992bd3f3..b43308c3e 100644 --- a/network/interface.go +++ b/network/interface.go @@ -204,7 +204,7 @@ type Manager interface { /* === Nodes ============================================================ */ /* Keys must be registered with nodes in order to send messages through them. This process is, in general, automatically handled by the Network - State. */ + Manager. */ // HasNode can be used to determine if a keying relationship exists with a // node. @@ -221,7 +221,7 @@ type Manager interface { /* === Rounds =========================================================== */ /* A complete set of round info is not kept on the client, and sometimes the network will need to be queried to get round info. Historical rounds - is the system internal to the Network State to do this. It can be used + is the system internal to the Network Manager to do this. It can be used externally as well. */ // GetRoundResults adjudicates on the rounds requested. Checks if they are diff --git a/single/manager_test.go b/single/manager_test.go index 754433c16..1af9467c0 100644 --- a/single/manager_test.go +++ b/single/manager_test.go @@ -52,7 +52,7 @@ func Test_newManager(t *testing.T) { if e.client != m.client || e.store != m.store || e.net != m.net || e.rng != m.rng || !reflect.DeepEqual(e.p, m.p) { - t.Errorf("NewHandler() did not return the expected new State."+ + t.Errorf("NewHandler() did not return the expected new Manager."+ "\nexpected: %+v\nreceived: %+v", e, m) } } diff --git a/storage/ud/facts.go b/storage/ud/facts.go index db60c8819..9762bc068 100644 --- a/storage/ud/facts.go +++ b/storage/ud/facts.go @@ -23,7 +23,7 @@ const ( factNotInStoreErr = "Fact %v does not exist in store" ) -// Store is the storage object for the higher level ud.State object. +// Store is the storage object for the higher level ud.Manager object. // This storage implementation is written for client side. type Store struct { // confirmedFacts contains facts that have been confirmed diff --git a/ud/addFact_test.go b/ud/addFact_test.go index 9e9699a98..7fecfc4d6 100644 --- a/ud/addFact_test.go +++ b/ud/addFact_test.go @@ -45,7 +45,7 @@ func TestAddFact(t *testing.T) { t.Errorf("Failed to start client comms: %+v", err) } - // Create our State object + // Create our Manager object m := Manager{ comms: comms, net: newTestNetworkManager(t), diff --git a/ud/manager.go b/ud/manager.go index b8cee0a49..e0c0d8ea3 100644 --- a/ud/manager.go +++ b/ud/manager.go @@ -63,7 +63,7 @@ func NewManager(client *api.Client, single *single.Manager) (*Manager, error) { jww.INFO.Println("ud.NewManager()") if client.NetworkFollowerStatus() != api.Running { return nil, errors.New( - "cannot start UD State when network follower is not running.") + "cannot start UD Manager when network follower is not running.") } m := &Manager{ diff --git a/ud/manager_test.go b/ud/manager_test.go index e7ddfe111..1dcb6c273 100644 --- a/ud/manager_test.go +++ b/ud/manager_test.go @@ -67,7 +67,7 @@ func TestManager_SetAlternativeUserDiscovery(t *testing.T) { t.Errorf("Failed to start client comms: %+v", err) } - // Create our State object + // Create our Manager object m := Manager{ comms: comms, net: newTestNetworkManager(t), diff --git a/ud/search_test.go b/ud/search_test.go index 5fb6b33ce..9a34441b1 100644 --- a/ud/search_test.go +++ b/ud/search_test.go @@ -105,7 +105,7 @@ func TestManager_Search(t *testing.T) { // func TestManager_Search_CallbackError(t *testing.T) { // isReg := uint32(1) // // Set up manager -// m := &State{ +// m := &Manager{ // rng: fastRNG.NewStreamGenerator(12, 3, csprng.NewSystemRNG), // grp: cyclic.NewGroup(large.NewInt(107), large.NewInt(2)), // storage: storage.InitTestingSession(t), -- GitLab