Modify tests so they all work with evhtp and backend config, eg that CLICON_RESTCONF_CONFIG is default true.
Note that some tests are forced to CLICON_RESTCONF_CONFIG is false due to test complexities.
This commit is contained in:
parent
daaf3f17df
commit
9016dde319
41 changed files with 218 additions and 134 deletions
|
|
@ -601,7 +601,7 @@ main(int argc,
|
|||
extraxml_file = optarg;
|
||||
break;
|
||||
case 'U': /* config user (for socket and drop privileges) */
|
||||
if (clicon_option_add(h, "CLICON_USER", optarg) < 0)
|
||||
if (clicon_username_set(h, optarg) < 0)
|
||||
goto done;
|
||||
if (clicon_option_add(h, "CLICON_BACKEND_PRIVILEGES", "drop_permanent") < 0)
|
||||
goto done;
|
||||
|
|
|
|||
|
|
@ -551,8 +551,6 @@ main(int argc,
|
|||
goto done;
|
||||
break;
|
||||
case 'U': /* Clixon 'pseudo' user */
|
||||
if (!strlen(optarg))
|
||||
usage(h, argv[0]);
|
||||
if (clicon_username_set(h, optarg) < 0)
|
||||
goto done;
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -56,6 +56,7 @@
|
|||
#include <time.h>
|
||||
#include <limits.h>
|
||||
#include <signal.h>
|
||||
#include <pwd.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/wait.h>
|
||||
#include <assert.h>
|
||||
|
|
@ -1102,6 +1103,7 @@ restconf_config_backend(clicon_handle h,
|
|||
cxobj *xconfig = NULL;
|
||||
cxobj *xerr = NULL;
|
||||
uint32_t id = 0; /* Session id, to poll backend up */
|
||||
struct passwd *pw;
|
||||
|
||||
/* Set default namespace according to CLICON_NAMESPACE_NETCONF_DEFAULT */
|
||||
xml_nsctx_namespace_netconf_default(h);
|
||||
|
|
@ -1205,7 +1207,11 @@ restconf_config_backend(clicon_handle h,
|
|||
}
|
||||
if ((nsc = xml_nsctx_init(NULL, "https://clicon.org/restconf")) == NULL)
|
||||
goto done;
|
||||
if (clicon_rpc_get_config(h, NULL, "running", "/restconf", nsc, &xconfig) < 0)
|
||||
if ((pw = getpwuid(getuid())) == NULL){
|
||||
clicon_err(OE_UNIX, errno, "getpwuid");
|
||||
goto done;
|
||||
}
|
||||
if (clicon_rpc_get_config(h, pw->pw_name, "running", "/restconf", nsc, &xconfig) < 0)
|
||||
goto done;
|
||||
if ((xerr = xpath_first(xconfig, NULL, "/rpc-error")) != NULL){
|
||||
clixon_netconf_error(xerr, "Get backend restconf config", NULL);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue