소스 검색

Added Travis CI file, integration test (#135)

* Added travis CI file

* Testing travis in C mode but running a python test.

* hopefully this build doesn't stay perpetually queued.

* Checking whether I can add distributions without doing a matrix.

* running another shell script

* Added an integration test script. Will need some tweaking to get it working properly, but it should run in the travis build without affecting the status. Current expected output is 'NRPE: Unable to read output.'

* Forgot to add execute to test-wrapper.

* sudo on test wrapper

* Making sure nrpe.cfg looks right on travis build.

* changed directory of new plugin to one that user 'nagios' has access to.

* Checking directory of script before certain operations

* Making sure we give correct cd instructions.

* checking directory structure for travis/ubuntu/whatever

* Trying again.

* Added execute permissions to plugin

* Test is now passing. Test wrapper now requires travis-test-1 to pass.

* Somehow we can't find the test script now

* Build should actually pass this time.
Sebastian Wolf 8 년 전
부모
커밋
d5909ac1b9
3개의 변경된 파일47개의 추가작업 그리고 0개의 파일을 삭제
  1. 10 0
      .travis.yml
  2. 3 0
      test-wrapper
  3. 34 0
      travis-test-1

+ 10 - 0
.travis.yml

@@ -0,0 +1,10 @@
+
+
+language: c
+sudo: enabled
+dist:
+ - trusty
+compiler:
+ - clang
+ - gcc
+script: ./configure && make all && sudo ./test-wrapper

+ 3 - 0
test-wrapper

@@ -0,0 +1,3 @@
+#!/bin/bash
+# Replace this once test is working properly.
+./travis-test-1

+ 34 - 0
travis-test-1

@@ -0,0 +1,34 @@
+#!/bin/bash
+
+# Integration test for nrpe/check_nrpe
+# Should be run only on machines which do NOT have Nagios installed 
+# and which do not have an enabled firewall.
+cd sample-config
+echo >> nrpe.cfg # Hopefully this is a newline! I think nrpe.cfg ends in a newling anyways.
+echo 'command[check_test]=/tmp/check_yes.sh' >> nrpe.cfg
+
+# Make sure the directory exists such that nrpe can create the nrpe.pid file in the default location
+mkdir /usr/ || true
+mkdir /usr/local || true
+mkdir /usr/local/nagios || true
+mkdir /usr/local/nagios/var || true
+
+# Make sure nagios user exists
+useradd nagios
+
+# Make a plugin
+touch /tmp/check_yes.sh
+echo 'echo OK' >> /tmp/check_yes.sh
+
+# Give nagios control of plugins
+chown nagios /tmp/check_yes.sh
+chmod +x /tmp/check_yes.sh
+
+# Start running the NRPE daemon to accept commands
+cd ../src
+./nrpe -c ../sample-config/nrpe.cfg -d
+
+# Try to check_nrpe with our check_test command/check_yes.sh plugin
+./check_nrpe -H 127.0.0.1 -c check_test
+
+exit 0