Skip to content

Commit

Permalink
test plugin NEW tests for datastore plugins
Browse files Browse the repository at this point in the history
  • Loading branch information
Humblesaw committed Apr 11, 2024
1 parent a16a913 commit c1987bd
Show file tree
Hide file tree
Showing 3 changed files with 1,562 additions and 2 deletions.
6 changes: 4 additions & 2 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ if(ENABLE_TESTS)
# lists of all the tests
set(tests test_modules test_context_change test_validation test_edit test_candidate test_oper_pull test_oper_push
test_lock test_apply_changes test_copy_config test_rpc_action test_notif test_get test_process
test_multi_connection test_nacm test_rotation test_sub_notif)
test_multi_connection test_nacm test_rotation test_sub_notif test_plugin)

foreach(test_name IN LISTS tests)
add_executable(${test_name} ${test_sources} ${test_name}.c)
Expand All @@ -62,10 +62,12 @@ if(ENABLE_TESTS)
# set common attributes of all tests
foreach(test_name IN LISTS tests)
target_link_libraries(${test_name} ${CMOCKA_LIBRARIES} sysrepo)
if(${test_name} STREQUAL "test_plugin")
target_link_libraries(${test_name} srobj)
endif()
add_test(NAME ${test_name} COMMAND $<TARGET_FILE:${test_name}>)
set_property(TEST ${test_name} APPEND PROPERTY ENVIRONMENT
"MALLOC_CHECK_=3"
"CMOCKA_TEST_ABORT=1"
"SYSREPO_REPOSITORY_PATH=${PROJECT_BINARY_DIR}/test_repositories/${test_name}"
"SYSREPO_SHM_PREFIX=_tests_sr_${test_name}"
)
Expand Down
129 changes: 129 additions & 0 deletions tests/files/plugin.yang
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
module plugin {
yang-version 1.1;
namespace s;
prefix s;

container simple-cont {

container simple-cont1 {
presence "This is an example of a presence container.";
}

container simple-cont2 {
container ac1 {
list acl1 {
key acs1;
leaf acs1 {
type string;
}
leaf acs2 {
type string;
}
leaf acs3 {
type string;
}
container inner {
leaf inner-leaf {
type string;
}
}
anydata data;
}

list acl2 {
key acs1;
ordered-by user;
leaf acs1 {
type string;
}
}

list acl3 {
key "acs1 acs2 acs3";
ordered-by user;
leaf acs1 {
type string;
}
leaf acs2 {
type string;
}
leaf acs3 {
type string;
}
container inner {
leaf inner-leaf {
type string;
}
}
}

list acl4 {
config false;
leaf acs1 {
type string;
}
leaf acs2 {
type string;
}
description
"Keyless list.";
}

list acl5 {
key "acs1 acs2 acs3";
leaf acs1 {
type string;
}
leaf acs2 {
type string;
}
leaf acs3 {
type string;
}
}

leaf-list dup-keys {
config false;
type string;
description
"Leaf-list with duplicate keys.";
}
}
}

container simple-cont3 {
leaf-list user-list {
type string;
ordered-by user;
description
"User ordered list.";
}
anyxml data;
}

container simple-cont4 {
choice rand-type {
default random;
case random {
leaf random {
type uint32;
}
}
}
}

container simple-cont5 {
leaf-list user-list {
type string;
ordered-by user;
description
"User ordered list 2.";
}
leaf-list system-list {
type string;
description
"System ordered list.";
}
}
}
}
Loading

0 comments on commit c1987bd

Please sign in to comment.