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
Branches
Tags
No related merge requests found
......@@ -315,7 +315,7 @@ func (cl *Client) InitListeners() error {
// Initialize UDB and nickname "bot" stuff here
bots.InitBots(cl.session, cl.receptionManager, cl.topology, id.NewUserFromBytes(cl.ndf.UDB.ID), transmissionHost)
// 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
}
......
......@@ -617,7 +617,6 @@ func TestClient_LogoutHappyPath(t *testing.T) {
t.Fail()
}
//Test that the things that should not be nil are not nil
if tc.ndf == nil {
t.Logf("NDF should not be set to nil")
......
......@@ -114,6 +114,7 @@ func sessionInitialization() (*id.User, string, *api.Client) {
}
globals.Log.INFO.Println("Initialized Ram Storage")
register = true
} else {
var sessionA, sessionB string
......@@ -428,8 +429,8 @@ var rootCmd = &cobra.Command{
globals.Log.FATAL.Panicf("Could Not start message reciever: %s\n", err)
}
globals.Log.INFO.Println("Logged In!")
if username != "" {
globals.Log.INFO.Printf("session prior to udb reg: %v", client.GetSession())
if username != "" && !utils.FileExists(sessionFile) {
err := client.RegisterWithUDB(username, 2*time.Minute)
if err != nil {
globals.Log.ERROR.Printf("%+v", err)
......@@ -515,9 +516,16 @@ var rootCmd = &cobra.Command{
if message != "" {
// Wait up to 45s to receive a message
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)
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
}
if numMsgReceived != lastCnt {
......
......@@ -88,7 +88,7 @@ func (l *rekeyConfirmListener) Hear(msg switchboard.Item, isHeardElsewhere bool,
}
// 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{}
rekeyList = rekeyListener{}
......@@ -97,6 +97,8 @@ func InitRekey(s user.Session, m io.Communications, t *connect.Circuit, rekeyCha
session = s
topology = t
comms = m
transmissionHost = host
rekeyChan = rekeyChan2
l := session.GetSwitchboard()
......
......@@ -83,7 +83,7 @@ func TestMain(m *testing.M) {
}
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
// Generate baseKey
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment