Skip to content

Commit

Permalink
Fix exchange manager test to not NewPairing on an uninitialized Secur…
Browse files Browse the repository at this point in the history
…eSessionManager.
  • Loading branch information
bzbarsky-apple committed Nov 19, 2020
1 parent d513b63 commit f9ca0e2
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/messaging/tests/TestExchangeMgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,11 @@ void CheckExchangeMessages(nlTestSuite * inSuite, void * inContext)
CHIP_ERROR err;

SecureSessionMgr<LoopbackTransport> conn;
ctx.GetInetLayer().SystemLayer()->Init(nullptr);

err = conn.Init(kSourceNodeId, ctx.GetInetLayer().SystemLayer(), "LOOPBACK");
NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR);

IPAddress addr;
IPAddress::FromString("127.0.0.1", addr);
SecurePairingUsingTestSecret pairing1(Optional<NodeId>::Value(kSourceNodeId), 1, 2);
Expand All @@ -209,11 +214,6 @@ void CheckExchangeMessages(nlTestSuite * inSuite, void * inContext)
err = conn.NewPairing(peer2, kDestinationNodeId, &pairing2);
NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR);

ctx.GetInetLayer().SystemLayer()->Init(nullptr);

err = conn.Init(kSourceNodeId, ctx.GetInetLayer().SystemLayer(), "LOOPBACK");
NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR);

ExchangeManager exchangeMgr;
err = exchangeMgr.Init(&conn);
NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR);
Expand Down

0 comments on commit f9ca0e2

Please sign in to comment.