Skip to content

Commit ace8db0

Browse files
author
Bret Ambrose
committed
Fix rejoin session test
1 parent 0df4aef commit ace8db0

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

tests/Mqtt5ClientTest.cpp

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1425,11 +1425,19 @@ static int s_TestMqtt5NegotiatedSettingsRejoinAlways(Aws::Crt::Allocator *alloca
14251425
{
14261426
ApiHandle apiHandle(allocator);
14271427

1428+
static const uint32_t SESSION_EXPIRY_INTERVAL_SEC = 3600;
1429+
1430+
std::shared_ptr<Aws::Crt::Mqtt5::ConnectPacket> packetConnect =
1431+
Aws::Crt::MakeShared<Aws::Crt::Mqtt5::ConnectPacket>(allocator);
1432+
packetConnect->WithSessionExpiryIntervalSec(SESSION_EXPIRY_INTERVAL_SEC);
1433+
packetConnect->WithClientId(Aws::Crt::UUID().ToString());
1434+
14281435
Mqtt5TestContext testContext1 = createTestContext(
14291436
allocator,
14301437
MQTT5CONNECT_DIRECT_IOT_CORE,
1431-
[](Mqtt5ClientOptions &options, const Mqtt5TestEnvVars &, Mqtt5TestContext &context)
1438+
[packetConnect](Mqtt5ClientOptions &options, const Mqtt5TestEnvVars &, Mqtt5TestContext &context)
14321439
{
1440+
options.WithConnectOptions(packetConnect);
14331441
options.WithClientConnectionSuccessCallback(
14341442
[&](const OnConnectionSuccessEventData &eventData)
14351443
{
@@ -1452,14 +1460,16 @@ static int s_TestMqtt5NegotiatedSettingsRejoinAlways(Aws::Crt::Allocator *alloca
14521460

14531461
ASSERT_TRUE(mqtt5Client1->Start());
14541462
ASSERT_TRUE(testContext1.connectionPromise.get_future().get());
1463+
14551464
ASSERT_TRUE(mqtt5Client1->Stop());
14561465
testContext1.stoppedPromise.get_future().get();
14571466

14581467
Mqtt5TestContext testContext2 = createTestContext(
14591468
allocator,
14601469
MQTT5CONNECT_DIRECT_IOT_CORE,
1461-
[](Mqtt5ClientOptions &options, const Mqtt5TestEnvVars &, Mqtt5TestContext &context)
1470+
[packetConnect](Mqtt5ClientOptions &options, const Mqtt5TestEnvVars &, Mqtt5TestContext &context)
14621471
{
1472+
options.WithConnectOptions(packetConnect);
14631473
options.WithClientConnectionSuccessCallback(
14641474
[&](const OnConnectionSuccessEventData &eventData)
14651475
{
@@ -1473,10 +1483,6 @@ static int s_TestMqtt5NegotiatedSettingsRejoinAlways(Aws::Crt::Allocator *alloca
14731483

14741484
return AWS_OP_SUCCESS;
14751485
});
1476-
if (testContext2.testDirective == AWS_OP_SKIP)
1477-
{
1478-
return AWS_OP_SKIP;
1479-
}
14801486

14811487
std::shared_ptr<Mqtt5Client> mqtt5Client2 = testContext2.client;
14821488
ASSERT_TRUE(mqtt5Client2);

0 commit comments

Comments
 (0)