|
19 | 19 | #include <data-model-providers/codegen/tests/EmberInvokeOverride.h>
|
20 | 20 | #include <data-model-providers/codegen/tests/EmberReadWriteOverride.h>
|
21 | 21 |
|
| 22 | +#include <app/server-cluster/testing/TestServerClusterContext.h> |
22 | 23 | #include <access/AccessControl.h>
|
23 | 24 | #include <access/SubjectDescriptor.h>
|
24 | 25 | #include <app-common/zap-generated/attribute-type.h>
|
@@ -2599,9 +2600,15 @@ static CHIP_ERROR ReadU32Attribute(DataModel::Provider & provider, const Concret
|
2599 | 2600 |
|
2600 | 2601 | TEST_F(TestCodegenModelViaMocks, ServerClusterInterfacesRegistration)
|
2601 | 2602 | {
|
| 2603 | + TestServerClusterContext testContext; |
| 2604 | + |
2602 | 2605 | UseMockNodeConfig config(gTestNodeConfig);
|
2603 | 2606 | CodegenDataModelProviderWithContext model;
|
2604 | 2607 |
|
| 2608 | + |
| 2609 | + model.SetPersistentStorageDelegate(&testContext.StorageDelegate()); |
| 2610 | + ASSERT_EQ(model.Startup(testContext.ImContext()), CHIP_NO_ERROR); |
| 2611 | + |
2605 | 2612 | const ConcreteClusterPath kTestClusterPath(kMockEndpoint1, MockClusterId(2));
|
2606 | 2613 |
|
2607 | 2614 | FakeDefaultServerCluster fakeClusterServer(kTestClusterPath);
|
@@ -2670,13 +2677,21 @@ TEST_F(TestCodegenModelViaMocks, ServerClusterInterfacesRegistration)
|
2670 | 2677 | std::optional<ActionReturnStatus> result = model.WriteAttribute(test.GetRequest(), decoder);
|
2671 | 2678 | ASSERT_TRUE(result.has_value() && result->GetUnderlyingError() == CHIP_ERROR_INCORRECT_STATE);
|
2672 | 2679 | }
|
| 2680 | + |
| 2681 | + model.Registry().Unregister(kTestClusterPath); |
| 2682 | + model.Shutdown(); |
2673 | 2683 | }
|
2674 | 2684 |
|
2675 | 2685 | TEST_F(TestCodegenModelViaMocks, ServerClusterInterfacesListClusters)
|
2676 | 2686 | {
|
| 2687 | + TestServerClusterContext testContext; |
| 2688 | + |
2677 | 2689 | UseMockNodeConfig config(gTestNodeConfig);
|
2678 | 2690 | CodegenDataModelProviderWithContext model;
|
2679 | 2691 |
|
| 2692 | + model.SetPersistentStorageDelegate(&testContext.StorageDelegate()); |
| 2693 | + ASSERT_EQ(model.Startup(testContext.ImContext()), CHIP_NO_ERROR); |
| 2694 | + |
2680 | 2695 | // will register a fake cluster server which overrides the cluster data version
|
2681 | 2696 | // once registered
|
2682 | 2697 | const ConcreteClusterPath kTestClusterPath(kMockEndpoint1, MockClusterId(2));
|
@@ -2743,4 +2758,7 @@ TEST_F(TestCodegenModelViaMocks, ServerClusterInterfacesListClusters)
|
2743 | 2758 | }
|
2744 | 2759 | }
|
2745 | 2760 | EXPECT_TRUE(updatedClusterFound);
|
| 2761 | + |
| 2762 | + model.Registry().Unregister(kTestClusterPath); |
| 2763 | + model.Shutdown(); |
2746 | 2764 | }
|
0 commit comments