Add copy command
Change-Id: I0a88f7fa9a096022dd95e8af8854f980ca34f043
diff --git a/tests/datastore_access.cpp b/tests/datastore_access.cpp
index a6cadc3..a1f9322 100644
--- a/tests/datastore_access.cpp
+++ b/tests/datastore_access.cpp
@@ -336,6 +336,20 @@
}
+ SECTION("copying data from startup refreshes the data")
+ {
+ {
+ REQUIRE(datastore.getItems("/example-schema:leafInt16") == DatastoreAccess::Tree{});
+ REQUIRE_CALL(mock, write("/example-schema:leafInt16", std::nullopt, "123"s));
+ datastore.setLeaf("/example-schema:leafInt16", int16_t{123});
+ datastore.commitChanges();
+ }
+ REQUIRE(datastore.getItems("/example-schema:leafInt16") == DatastoreAccess::Tree{{"/example-schema:leafInt16", int16_t{123}}});
+ REQUIRE_CALL(mock, write("/example-schema:leafInt16", "123"s, std::nullopt));
+ datastore.copyConfig(Datastore::Startup, Datastore::Running);
+ REQUIRE(datastore.getItems("/example-schema:leafInt16") == DatastoreAccess::Tree{});
+ }
+
waitForCompletionAndBitMore(seq1);
}