Commit fee053c5 authored by Michal Nowikowski's avatar Michal Nowikowski

changes after review: updated comments and did other small improvements

parent a45e2f68
1537. [func] godfryd
Improved handling unix sockets in unit tests. Now by default
they are created in temporary folder under /tmp folder. This
fixes the issue with creating sockets with too long path
in the case when source folder is deeply nested.
(Gitlab #357,!258, git a45e2f68d7d1848adb0cf755954a3d76c9dff338)
1536. [build] tomek 1536. [build] tomek
Many changes in keactrl, kea-admin, cql_config and sysrepo_config Many changes in keactrl, kea-admin, cql_config and sysrepo_config
scripts. ISC is now using shellcheck to verify portability of scripts. ISC is now using shellcheck to verify portability of
......
...@@ -40,10 +40,9 @@ The following environment variable can affect the unit tests: ...@@ -40,10 +40,9 @@ The following environment variable can affect the unit tests:
- KEA_SOCKET_TEST_DIR - if set, it specifies the directory where Unix - KEA_SOCKET_TEST_DIR - if set, it specifies the directory where Unix
sockets are created. There is an operating system limitation on how sockets are created. There is an operating system limitation on how
long a Unix socket path can be, typically slightly over 100 long a Unix socket path can be, typically slightly over 100
characters. If you happen to build and run unit-tests in deeply nested characters. By default unit-tests create sockets in temporary folder
directories, this may become a problem. KEA_SOCKET_TEST_DIR can be under /tmp folder. KEA_SOCKET_TEST_DIR can be specified to instruct
specified to instruct unit-test to use a different directory. It must unit-tests to use a different directory. It must not end with slash.
not end with slash.
@section unitTestsDatabaseConfig Databases Configuration for Unit Tests @section unitTestsDatabaseConfig Databases Configuration for Unit Tests
...@@ -265,5 +264,5 @@ local all postgres trust ...@@ -265,5 +264,5 @@ local all postgres trust
[cqlsh 5.0.1 | Cassandra 3.11.1 | CQL spec 3.4.4 | Native protocol v4] [cqlsh 5.0.1 | Cassandra 3.11.1 | CQL spec 3.4.4 | Native protocol v4]
Use HELP for help. Use HELP for help.
cqlsh> @endverbatim\n cqlsh> @endverbatim\n
*/ */
...@@ -11,8 +11,9 @@ ...@@ -11,8 +11,9 @@
#include <iostream> #include <iostream>
#include <string> #include <string>
#include <stdlib.h> #include <cstdlib>
#include <stdio.h> #include <cstdio>
#include <unistd.h>
#include <ftw.h> #include <ftw.h>
namespace isc { namespace isc {
...@@ -25,14 +26,12 @@ namespace test { ...@@ -25,14 +26,12 @@ namespace test {
/// in unit test setup phase, and then it is deleted with its content /// in unit test setup phase, and then it is deleted with its content
/// in destructor ie. in unit test tear down phase. /// in destructor ie. in unit test tear down phase.
class Sandbox { class Sandbox {
private:
/// Path to temporary folder /// Path to temporary folder
std::string path_; std::string path_;
/// @brief Method for deleting files and folders, used in nftw traversal function. /// @brief Method for deleting files and folders, used in nftw traversal function.
static int rmFile(const char *fpath, const struct stat *sb, int typeflag, struct FTW *ftwbuf) { static int rmFile(const char *fpath, const struct stat *, int , struct FTW *) {
(void)sb;
(void)typeflag;
(void)ftwbuf;
return(remove(fpath)); return(remove(fpath));
} }
...@@ -51,9 +50,11 @@ public: ...@@ -51,9 +50,11 @@ public:
} }
} }
// @brief Join sandbox path with indicated file subpath. /// @brief Join sandbox path with indicated file subpath.
///
/// @param file A path to file that should be joined to base path of sandbox.
std::string join(std::string file) { std::string join(std::string file) {
return path_ + "/" + file; return(path_ + "/" + file);
} }
}; };
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment