aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKristian Lyngstol <kristian@bohemians.org>2016-04-13 21:17:28 +0200
committerKristian Lyngstol <kristian@bohemians.org>2016-04-13 21:17:28 +0200
commita09b4d33818f1b3fd3836a99cbb742fa84caecb4 (patch)
tree336fbdff24655ff4079d1971b347935aa3714766
parente8a20f730651d07deff33dc559acfdca32cce271 (diff)
Working test! It's amazing!
Never been so happy to see a single switch in the nms. Missing: Varnish and collectors and better deplist. Also: this is mainly _test_ stuff, not meant for development OR production.
-rw-r--r--README.rst25
-rw-r--r--build/test/db-test.Dockerfile1
-rw-r--r--build/test/playbook-test.yml16
-rw-r--r--extras/misc/apache2.conf4
-rwxr-xr-xinclude/config.pm (renamed from include/config.pm.dist)0
5 files changed, 43 insertions, 3 deletions
diff --git a/README.rst b/README.rst
index c626fa9..7d2f817 100644
--- a/README.rst
+++ b/README.rst
@@ -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