Rework datastore tests
Sysrepo now supports parallelized tests. Use the new environmental
variables to implement this in netconf-cli. All of the tests now get
their own clean environment:
- Fresh repository and separate shm prefix. These get cleaned before and
after tests. The only thing that gets left are some empty directories.
- Its own model to test on.
- Separate Netopeer2 daemon: only for netconf tests - that means no
`sleep 5` for sysrepo-only tests. So no useless waiting. Wow! The daemon
also runs with its argv[0] changed to something recognizable for
`pkill`. That means that if Netopeer2 crashes for some reason, pkill
will notify me.
Side note: These changes somehow changed some of the linking, so hopefully I got
those right.
Change-Id: Ib0e582ef03fc559b24203af8afb2a295a6318ca9
diff --git a/tests/datastore_access.cpp b/tests/datastore_access.cpp
index 68eac3a..cc97aa9 100644
--- a/tests/datastore_access.cpp
+++ b/tests/datastore_access.cpp
@@ -27,7 +27,6 @@
using OnKeyNotFound = std::runtime_error;
using OnExec = void;
#include "netconf_access.hpp"
-#include "netopeer_vars.hpp"
#elif defined(yang_BACKEND)
#include <fstream>
#include "yang_access.hpp"
@@ -122,7 +121,8 @@
#ifdef sysrepo_BACKEND
SysrepoAccess datastore(Datastore::Running);
#elif defined(netconf_BACKEND)
- NetconfAccess datastore(NETOPEER_SOCKET_PATH);
+ const auto NETOPEER_SOCKET = getenv("NETOPEER_SOCKET");
+ NetconfAccess datastore(NETOPEER_SOCKET);
#elif defined(yang_BACKEND)
TestYangAccess datastore;
datastore.addSchemaDir(schemaDir);
@@ -896,7 +896,8 @@
#ifdef sysrepo_BACKEND
auto datastore = std::make_shared<SysrepoAccess>(Datastore::Running);
#elif defined(netconf_BACKEND)
- auto datastore = std::make_shared<NetconfAccess>(NETOPEER_SOCKET_PATH);
+ const auto NETOPEER_SOCKET = getenv("NETOPEER_SOCKET");
+ auto datastore = std::make_shared<NetconfAccess>(NETOPEER_SOCKET);
#elif defined(yang_BACKEND)
auto datastore = std::make_shared<YangAccess>();
datastore->addSchemaDir(schemaDir);