Skip to content

Commit 9088c3a

Browse files
committed
Try to fix CI tests
1 parent 84b61c8 commit 9088c3a

File tree

5 files changed

+54
-11
lines changed

5 files changed

+54
-11
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
/*
2+
*
3+
* Copyright (c) 2024 Project CHIP Authors
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License");
6+
* you may not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
18+
#include "app/server/Server.h"
19+
#include "lib/core/DataModelTypes.h"
20+
21+
namespace chip {
22+
namespace app {
23+
namespace Clusters {
24+
namespace ThreadBorderRouterManagement {
25+
26+
bool IsFailSafeArmed(FabricIndex accessingFabricIndex)
27+
{
28+
auto & failSafeContext = Server::GetInstance().GetFailSafeContext();
29+
return failSafeContext.IsFailSafeArmed(accessingFabricIndex);
30+
}
31+
32+
void DisarmFailSafeTimer()
33+
{
34+
auto & failSafeContext = Server::GetInstance().GetFailSafeContext();
35+
failSafeContext.DisarmFailSafe();
36+
}
37+
38+
} // namespace ThreadBorderRouterManagement
39+
} // namespace Clusters
40+
} // namespace app
41+
} // namespace chip

src/app/clusters/thread-border-router-management-server/thread-br-mgmt-server.cpp

+2-10
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
#include "app/MessageDef/StatusIB.h"
3030
#include "app/clusters/general-commissioning-server/general-commissioning-server.h"
3131
#include "app/data-model/Nullable.h"
32-
#include "app/server/Server.h"
3332
#include "crypto/RandUtils.h"
3433
#include "lib/core/CHIPError.h"
3534
#include "lib/support/CodeUtils.h"
@@ -53,12 +52,6 @@ static bool IsOverCASESession(CommandHandlerInterface::HandlerContext & ctx)
5352
exchangeCtx->GetSessionHandle()->AsSecureSession()->GetSecureSessionType() == Transport::SecureSession::Type::kCASE;
5453
}
5554

56-
static bool IsFailSafeArmed(CommandHandlerInterface::HandlerContext & ctx)
57-
{
58-
auto & failSafeContext = Server::GetInstance().GetFailSafeContext();
59-
return failSafeContext.IsFailSafeArmed(ctx.mCommandHandler.GetAccessingFabricIndex());
60-
}
61-
6255
Status ServerInstance::HandleGetDatasetRequest(bool isOverCASESession, Delegate::DatasetType type,
6356
Thread::OperationalDataset & dataset)
6457
{
@@ -165,7 +158,7 @@ void ServerInstance::InvokeCommand(HandlerContext & ctxt)
165158
mPath = ctx.mRequestPath;
166159
mAsyncCommandHandle = CommandHandler::Handle(&ctx.mCommandHandler);
167160
ctx.mCommandHandler.FlushAcksRightAwayOnSlowCommand();
168-
Status status = HandleSetActiveDatasetRequest(IsFailSafeArmed(ctx), req);
161+
Status status = HandleSetActiveDatasetRequest(IsFailSafeArmed(ctx.mCommandHandler.GetAccessingFabricIndex()), req);
169162
if (status != Status::Success)
170163
{
171164
OnActivateDatasetComplete(mRandomNumber, ChipError(ChipError::SdkPart::kIMGlobalStatus, to_underlying(status)));
@@ -341,8 +334,7 @@ void ServerInstance::OnActivateDatasetComplete(uint32_t randomNumber, CHIP_ERROR
341334
if (error == CHIP_NO_ERROR)
342335
{
343336
// The successful completion of the activation process SHALL disarm the fail-safe timer.
344-
auto & failSafeContext = Server::GetInstance().GetFailSafeContext();
345-
failSafeContext.DisarmFailSafe();
337+
DisarmFailSafeTimer();
346338
CommitSavedBreadcrumb();
347339
}
348340
else

src/app/clusters/thread-border-router-management-server/thread-br-mgmt-server.h

+4
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,10 @@ class ServerInstance : public CommandHandlerInterface, public AttributeAccessInt
8989
uint32_t mRandomNumber;
9090
};
9191

92+
bool IsFailSafeArmed(FabricIndex accessingFabricIndex);
93+
94+
void DisarmFailSafeTimer();
95+
9296
} // namespace ThreadBorderRouterManagement
9397
} // namespace Clusters
9498
} // namespace app

src/app/tests/BUILD.gn

-1
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,6 @@ source_set("thread-border-router-management-test-srcs") {
126126
public_deps = [
127127
"${chip_root}/src/app",
128128
"${chip_root}/src/app/common:cluster-objects",
129-
"${chip_root}/src/app/server",
130129
"${chip_root}/src/app/util/mock:mock_ember",
131130
"${chip_root}/src/lib/core",
132131
]

src/app/tests/TestThreadBorderRouterManagementCluster.cpp

+7
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,13 @@ void SetBreadcrumb(Attributes::Breadcrumb::TypeInfo::Type breadcrumb) {}
3838
} // namespace GeneralCommissioning
3939

4040
namespace ThreadBorderRouterManagement {
41+
// Mock functions
42+
bool IsFailSafeArmed(FabricIndex accessingFabricIndex)
43+
{
44+
return true;
45+
}
46+
47+
void DisarmFailSafeTimer() {}
4148

4249
class TestDelegate : public Delegate
4350
{

0 commit comments

Comments
 (0)