Skip to content
Snippets Groups Projects
Commit e66b3194 authored by Josh Brooks's avatar Josh Brooks
Browse files

Fix issues with integration tests

parent 13890fed
No related branches found
No related tags found
No related merge requests found
...@@ -315,7 +315,7 @@ func (cl *Client) InitListeners() error { ...@@ -315,7 +315,7 @@ func (cl *Client) InitListeners() error {
// Initialize UDB and nickname "bot" stuff here // Initialize UDB and nickname "bot" stuff here
bots.InitBots(cl.session, cl.receptionManager, cl.topology, id.NewUserFromBytes(cl.ndf.UDB.ID), transmissionHost) bots.InitBots(cl.session, cl.receptionManager, cl.topology, id.NewUserFromBytes(cl.ndf.UDB.ID), transmissionHost)
// Initialize Rekey listeners // Initialize Rekey listeners
rekey.InitRekey(cl.session, cl.receptionManager, cl.topology, cl.rekeyChan) rekey.InitRekey(cl.session, cl.receptionManager, cl.topology, transmissionHost, cl.rekeyChan)
return nil return nil
} }
......
...@@ -617,7 +617,6 @@ func TestClient_LogoutHappyPath(t *testing.T) { ...@@ -617,7 +617,6 @@ func TestClient_LogoutHappyPath(t *testing.T) {
t.Fail() t.Fail()
} }
//Test that the things that should not be nil are not nil //Test that the things that should not be nil are not nil
if tc.ndf == nil { if tc.ndf == nil {
t.Logf("NDF should not be set to nil") t.Logf("NDF should not be set to nil")
......
...@@ -114,6 +114,7 @@ func sessionInitialization() (*id.User, string, *api.Client) { ...@@ -114,6 +114,7 @@ func sessionInitialization() (*id.User, string, *api.Client) {
} }
globals.Log.INFO.Println("Initialized Ram Storage") globals.Log.INFO.Println("Initialized Ram Storage")
register = true register = true
} else { } else {
var sessionA, sessionB string var sessionA, sessionB string
...@@ -428,8 +429,8 @@ var rootCmd = &cobra.Command{ ...@@ -428,8 +429,8 @@ var rootCmd = &cobra.Command{
globals.Log.FATAL.Panicf("Could Not start message reciever: %s\n", err) globals.Log.FATAL.Panicf("Could Not start message reciever: %s\n", err)
} }
globals.Log.INFO.Println("Logged In!") globals.Log.INFO.Println("Logged In!")
globals.Log.INFO.Printf("session prior to udb reg: %v", client.GetSession())
if username != "" { if username != "" && !utils.FileExists(sessionFile) {
err := client.RegisterWithUDB(username, 2*time.Minute) err := client.RegisterWithUDB(username, 2*time.Minute)
if err != nil { if err != nil {
globals.Log.ERROR.Printf("%+v", err) globals.Log.ERROR.Printf("%+v", err)
...@@ -515,9 +516,16 @@ var rootCmd = &cobra.Command{ ...@@ -515,9 +516,16 @@ var rootCmd = &cobra.Command{
if message != "" { if message != "" {
// Wait up to 45s to receive a message // Wait up to 45s to receive a message
lastCnt := int64(0) lastCnt := int64(0)
for end, timeout := false, time.After(45*time.Second); !end; { ticker := time.Tick(1 * time.Second)
for end, timeout := false, time.After(50*time.Second); !end; {
numMsgReceived := atomic.LoadInt64(&text.MessagesReceived) numMsgReceived := atomic.LoadInt64(&text.MessagesReceived)
if numMsgReceived == int64(waitForMessages) {
select {
case <-ticker:
globals.Log.INFO.Printf("Messages recieved: %v\n\tMessages needed: %v", numMsgReceived, waitForMessages)
}
if numMsgReceived >= int64(waitForMessages) {
end = true end = true
} }
if numMsgReceived != lastCnt { if numMsgReceived != lastCnt {
......
...@@ -88,7 +88,7 @@ func (l *rekeyConfirmListener) Hear(msg switchboard.Item, isHeardElsewhere bool, ...@@ -88,7 +88,7 @@ func (l *rekeyConfirmListener) Hear(msg switchboard.Item, isHeardElsewhere bool,
} }
// InitRekey is called internally by the Login API // InitRekey is called internally by the Login API
func InitRekey(s user.Session, m io.Communications, t *connect.Circuit, rekeyChan2 chan struct{}) { func InitRekey(s user.Session, m io.Communications, t *connect.Circuit, host *connect.Host, rekeyChan2 chan struct{}) {
rekeyTriggerList = rekeyTriggerListener{} rekeyTriggerList = rekeyTriggerListener{}
rekeyList = rekeyListener{} rekeyList = rekeyListener{}
...@@ -97,6 +97,8 @@ func InitRekey(s user.Session, m io.Communications, t *connect.Circuit, rekeyCha ...@@ -97,6 +97,8 @@ func InitRekey(s user.Session, m io.Communications, t *connect.Circuit, rekeyCha
session = s session = s
topology = t topology = t
comms = m comms = m
transmissionHost = host
rekeyChan = rekeyChan2 rekeyChan = rekeyChan2
l := session.GetSwitchboard() l := session.GetSwitchboard()
......
...@@ -83,7 +83,7 @@ func TestMain(m *testing.M) { ...@@ -83,7 +83,7 @@ func TestMain(m *testing.M) {
} }
rekeyChan2 := make(chan struct{}, 50) rekeyChan2 := make(chan struct{}, 50)
InitRekey(session, fakeComm, connect.NewCircuit([]*id.Node{id.NewNodeFromBytes(make([]byte, id.NodeIdLen))}), rekeyChan2) InitRekey(session, fakeComm, connect.NewCircuit([]*id.Node{id.NewNodeFromBytes(make([]byte, id.NodeIdLen))}), nil, rekeyChan2)
// Create E2E relationship with partner // Create E2E relationship with partner
// Generate baseKey // Generate baseKey
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment