* Made a separate Clixon datastore XML/JSON top-level symbol

* Replaces the hardcoded "config" keyword.
  * Implemented by a compile-time option called `DATASTORE_TOP_SYMBOL` option in clixon_custom.h
* Tests: added endtest to all tests. Removed all premature exits if BE=0
This commit is contained in:
Olof hagsand 2021-03-05 14:15:15 +01:00
parent 2ab90d847b
commit b7991d9b39
132 changed files with 939 additions and 628 deletions

View file

@ -129,7 +129,7 @@ EOF
rm -f $dbdir/candidate_db
# alt
cat <<EOF > $dbdir/running_db
<config>
<${DATASTORE_TOP}>
<y0 xmlns="urn:example:order">d</y0>
<y1 xmlns="urn:example:order">d</y1>
<y2 xmlns="urn:example:order"><k>d</k><a>bar</a></y2>
@ -148,7 +148,7 @@ cat <<EOF > $dbdir/running_db
<y3 xmlns="urn:example:order"><k>c</k><a>bar</a></y3>
<y2 xmlns="urn:example:order"><k>b</k><a>bar</a></y2>
<y3 xmlns="urn:example:order"><k>b</k><a>bar</a></y3>
</config>
</${DATASTORE_TOP}>
EOF
new "test params: -s running -f $cfg -- -s"
@ -391,20 +391,21 @@ expecteof "$clixon_netconf -qf $cfg" 0 "<rpc $DEFAULTNS><edit-config><target><ca
new "check ordered-by-user: e,a,71,b,42,c,d"
expecteof "$clixon_netconf -qf $cfg" 0 "<rpc $DEFAULTNS><get-config><source><candidate/></source></get-config></rpc>]]>]]>" "^<rpc-reply $DEFAULTNS><data><y2 xmlns=\"urn:example:order\"><k>e</k><a>bar</a></y2><y2 xmlns=\"urn:example:order\"><k>a</k><a>foo</a></y2><y2 xmlns=\"urn:example:order\"><k>71</k><a>fie</a></y2><y2 xmlns=\"urn:example:order\"><k>b</k><a>bar</a></y2><y2 xmlns=\"urn:example:order\"><k>42</k><a>fum</a></y2><y2 xmlns=\"urn:example:order\"><k>c</k><a>foo</a></y2><y2 xmlns=\"urn:example:order\"><k>d</k><a>fie</a></y2></data></rpc-reply>]]>]]>$"
if [ $BE -eq 0 ]; then
exit # BE
if [ $BE -ne 0 ]; then
new "Kill backend"
# Check if premature kill
pid=$(pgrep -u root -f clixon_backend)
if [ -z "$pid" ]; then
err "backend already dead"
fi
# kill backend
stop_backend -f $cfg
fi
new "Kill backend"
# Check if premature kill
pid=$(pgrep -u root -f clixon_backend)
if [ -z "$pid" ]; then
err "backend already dead"
fi
# kill backend
stop_backend -f $cfg
rm -rf $dir
# unset conditional parameters
unset format
new "endtest"
endtest