diff --git a/test/test_restconf_internal.sh b/test/test_restconf_internal.sh index 905c4162..41e449f5 100755 --- a/test/test_restconf_internal.sh +++ b/test/test_restconf_internal.sh @@ -167,7 +167,6 @@ cat< $startupdb EOF new "kill old restconf" -sleep $DEMSLEEP stop_restconf_pre new "test params: -f $cfg" @@ -276,9 +275,8 @@ if [ $pid0 -eq $pid3 ]; then err1 "A different pid" "same pid: $pid3" fi -new "kill restconf using kill" -sleep $DEMSLEEP -stop_restconf_pre +new "kill restconf" +sudo kill $pid3 new "Wait for restconf to stop" wait_restconf_stopped diff --git a/test/test_restconf_patch.sh b/test/test_restconf_patch.sh index 9f3531f7..02cf7c88 100755 --- a/test/test_restconf_patch.sh +++ b/test/test_restconf_patch.sh @@ -91,6 +91,9 @@ cat < $dir/example-system.yang leaf enable-jukebox-streaming { type boolean; } + leaf extraleaf { + type string; + } } } EOF @@ -250,6 +253,16 @@ expectpart "$(curl -u andy:bar $CURLOPTS -X PATCH -H "Content-Type: application new "GET check" # XXX: "data" should probably be namespaced? expectpart "$(curl -u andy:bar $CURLOPTS -X GET $RCPROTO://localhost/restconf/data?content=config -H 'Accept: application/yang-data+xml')" 0 "HTTP/$HVER 200" 'c' '' +new "Add empty leaf" +expectpart "$(curl -u andy:bar $CURLOPTS -X POST $RCPROTO://localhost/restconf/data -H 'Content-Type: application/yang-data+json' -d '{"example-system:system":{"extraleaf":""}}')" 0 "HTTP/$HVER 201" + +new "Add entry with PATCH" +expectpart "$(curl -u andy:bar $CURLOPTS -X PATCH $RCPROTO://localhost/restconf/data/example-system:system -H 'Content-Type: application/yang-data+json' -d '{"example-system:system":{"extraleaf":"something"}}')" 0 "HTTP/$HVER 204" + +new "GET check" +expectpart "$(curl -u andy:bar $CURLOPTS -X GET $RCPROTO://localhost/restconf/data/example-system:system -H 'Accept: application/yang-data+xml')" 0 "HTTP/$HVER 200" 'something' + + if [ $RC -ne 0 ]; then new "Kill restconf daemon" stop_restconf