Skip to content

Commit 6a800a8

Browse files
committed
Fix race condition in service tests
1 parent 1a0902f commit 6a800a8

3 files changed

Lines changed: 7 additions & 7 deletions

File tree

identity/tests/v2ClientTests.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,8 @@ static std::shared_ptr<Aws::Crt::Mqtt5::Mqtt5Client> s_createProtocolClient5(Aws
7979
{
8080
std::lock_guard<std::mutex> guard(lock);
8181
connected = true;
82+
signal.notify_all();
8283
}
83-
signal.notify_all();
8484
});
8585

8686
client = Aws::Crt::Mqtt5::Mqtt5Client::NewMqtt5Client(mqtt5Options, allocator);
@@ -145,8 +145,8 @@ static std::shared_ptr<Aws::Crt::Mqtt::MqttConnection> s_createProtocolClient311
145145
{
146146
std::lock_guard<std::mutex> guard(lock);
147147
connected = true;
148+
signal.notify_all();
148149
}
149-
signal.notify_all();
150150
};
151151

152152
auto uuid = Aws::Crt::UUID().ToString();

jobs/tests/v2ClientTests.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,8 @@ static std::shared_ptr<Aws::Crt::Mqtt5::Mqtt5Client> s_createProtocolClient5(Aws
6565
{
6666
std::lock_guard<std::mutex> guard(lock);
6767
connected = true;
68+
signal.notify_all();
6869
}
69-
signal.notify_all();
7070
});
7171

7272
client = Aws::Crt::Mqtt5::Mqtt5Client::NewMqtt5Client(mqtt5Options, allocator);
@@ -131,8 +131,8 @@ static std::shared_ptr<Aws::Crt::Mqtt::MqttConnection> s_createProtocolClient311
131131
{
132132
std::lock_guard<std::mutex> guard(lock);
133133
connected = true;
134+
signal.notify_all();
134135
}
135-
signal.notify_all();
136136
};
137137

138138
auto uuid = Aws::Crt::UUID().ToString();

shadow/tests/v2ClientTests.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,8 @@ static std::shared_ptr<Aws::Crt::Mqtt5::Mqtt5Client> s_createProtocolClient5(Aws
7676
{
7777
std::lock_guard<std::mutex> guard(lock);
7878
connected = true;
79+
signal.notify_all();
7980
}
80-
signal.notify_all();
8181
});
8282

8383
client = Aws::Crt::Mqtt5::Mqtt5Client::NewMqtt5Client(mqtt5Options, allocator);
@@ -142,8 +142,8 @@ static std::shared_ptr<Aws::Crt::Mqtt::MqttConnection> s_createProtocolClient311
142142
{
143143
std::lock_guard<std::mutex> guard(lock);
144144
connected = true;
145+
signal.notify_all();
145146
}
146-
signal.notify_all();
147147
};
148148

149149
auto uuid = Aws::Crt::UUID().ToString();
@@ -620,4 +620,4 @@ static int s_ShadowV2ClientDeltaUpdateNamedShadow311(Aws::Crt::Allocator *alloca
620620

621621
return result;
622622
}
623-
AWS_TEST_CASE(ShadowV2ClientDeltaUpdateNamedShadow311, s_ShadowV2ClientDeltaUpdateNamedShadow311)
623+
AWS_TEST_CASE(ShadowV2ClientDeltaUpdateNamedShadow311, s_ShadowV2ClientDeltaUpdateNamedShadow311)

0 commit comments

Comments
 (0)