diff options
-rw-r--r-- | README.rst | 25 | ||||
-rw-r--r-- | build/test/db-test.Dockerfile | 1 | ||||
-rw-r--r-- | build/test/playbook-test.yml | 16 | ||||
-rw-r--r-- | extras/misc/apache2.conf | 4 | ||||
-rwxr-xr-x | include/config.pm (renamed from include/config.pm.dist) | 0 |
5 files changed, 43 insertions, 3 deletions
@@ -50,6 +50,31 @@ This is NOT complete and thoroughly lacking. 6. Start the clients in ``clients/``. 7. Read the first line in this chapter. +Testing +------- + +There is basic test infrastructure set up in ``build/test``. It uses Docker and +ansible against the host in ``build/test/inventory`` which happens to be +localhost by default. + +To use it, first set up ssh to localhost (or change host in inventory) and +install docker, then run:: + + $ cd build/ + $ ansible-playbook -i test/inventory test/playbook-test.yml + +This will build the relevant docker images and start them. It assumes a +check out on the target machine (e.g.: localhost) on ``~/src/tgnms``. It +does not use sudo or make any attempt to configure the local host beyond +docker building. + +PS: This is currently NOT complete, but will eventually run actual test +cases and possibly provide a development environment. It is very likely to +"move" to the top level, mainly to avoid having to check out the git repo, +which creates cache issues with docker. + +It currently DOES work to actual set up a working NMS, save collectors. + Architecture ------------ diff --git a/build/test/db-test.Dockerfile b/build/test/db-test.Dockerfile index cd6161e..a182040 100644 --- a/build/test/db-test.Dockerfile +++ b/build/test/db-test.Dockerfile @@ -5,5 +5,6 @@ RUN cat /pg_hba.tail >> /etc/postgresql/9.4/main/pg_hba.conf RUN service postgresql start && su postgres -c "psql --command=\"CREATE ROLE nms PASSWORD 'risbrod' NOSUPERUSER NOCREATEDB NOCREATEROLE INHERIT LOGIN;\"" && su postgres -c "createdb -O nms nms" && service postgresql stop ADD schema.sql /schema.sql RUN service postgresql start && su postgres -c "cat /schema.sql | psql nms" && service postgresql stop +RUN echo "listen_addresses = '*'" >> /etc/postgresql/9.4/main/postgresql.conf CMD pg_ctlcluster --foreground 9.4 main start EXPOSE 5432 diff --git a/build/test/playbook-test.yml b/build/test/playbook-test.yml index 2794b21..4a04328 100644 --- a/build/test/playbook-test.yml +++ b/build/test/playbook-test.yml @@ -4,6 +4,7 @@ tasks: - name: make db-test docker_image: + nocache: true state: build name: nms-db-test docker_api_version: 1.18 @@ -11,6 +12,7 @@ path: "src/tgnms/build/" - name: make front-test docker_image: + nocache: true state: build name: nms-front-test docker_api_version: 1.18 @@ -23,6 +25,18 @@ docker_api_version: 1.18 dockerfile: test/collector-test.Dockerfile path: "src/tgnms/build/" + - name: stop db + docker: + name: nms-db + state: stopped + image: nms-db-test + docker_api_version: 1.18 + - name: stop front + docker: + name: nms-front + state: stopped + image: nms-front-test + docker_api_version: 1.18 - name: start db docker: name: nms-db @@ -36,7 +50,7 @@ name: nms-front image: nms-front-test docker_api_version: 1.18 - state: reloaded + state: started net: bridge links: - "nms-db:db" diff --git a/extras/misc/apache2.conf b/extras/misc/apache2.conf index a2b1e83..e5311a0 100644 --- a/extras/misc/apache2.conf +++ b/extras/misc/apache2.conf @@ -12,7 +12,7 @@ Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch <RequireAny> AuthUserFile /opt/nms/etc/htpasswd-write - AuthName "Demo/test of nms write" + AuthName "Demo/test of nms" AuthType Basic Require valid-user </RequireAny> @@ -22,7 +22,7 @@ Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch <RequireAny> AuthUserFile /opt/nms/etc/htpasswd-read - AuthName "Demo/test of nms read" + AuthName "Demo/test of nms" AuthType Basic Require valid-user </RequireAny> diff --git a/include/config.pm.dist b/include/config.pm index 9987d05..9987d05 100755 --- a/include/config.pm.dist +++ b/include/config.pm |