diff options
Diffstat (limited to '.github')
| -rw-r--r-- | .github/NPTest.cache | 54 | ||||
| -rwxr-xr-x | .github/prepare_debian.sh | 99 | ||||
| -rw-r--r-- | .github/workflows/test.yml | 77 |
3 files changed, 230 insertions, 0 deletions
diff --git a/.github/NPTest.cache b/.github/NPTest.cache new file mode 100644 index 00000000..232305a7 --- /dev/null +++ b/.github/NPTest.cache | |||
| @@ -0,0 +1,54 @@ | |||
| 1 | { | ||
| 2 | 'NP_ALLOW_SUDO' => 'yes', | ||
| 3 | 'NP_DNS_SERVER' => '8.8.8.8', | ||
| 4 | 'NP_GOOD_NTP_SERVICE' => '', | ||
| 5 | 'NP_HOST_DHCP_RESPONSIVE' => '', | ||
| 6 | 'NP_HOST_HPJD_PORT_INVALID' => '161', | ||
| 7 | 'NP_HOST_HPJD_PORT_VALID' => '', | ||
| 8 | 'NP_HOSTNAME_INVALID_CIDR' => '130.133.8.39/30', | ||
| 9 | 'NP_HOSTNAME_INVALID' => 'nosuchhost', | ||
| 10 | 'NP_HOSTNAME_VALID_CIDR' => '130.133.8.41/30', | ||
| 11 | 'NP_HOSTNAME_VALID_IP' => '130.133.8.40', | ||
| 12 | 'NP_HOSTNAME_VALID' => 'monitoring-plugins.org', | ||
| 13 | 'NP_HOSTNAME_VALID_REVERSE' => 'orwell.monitoring-plugins.org.', | ||
| 14 | 'NP_HOST_NONRESPONSIVE' => '192.168.1.2', | ||
| 15 | 'NP_HOST_RESPONSIVE' => 'localhost', | ||
| 16 | 'NP_HOST_SMB' => '', | ||
| 17 | 'NP_HOST_SNMP' => '', | ||
| 18 | 'NP_HOST_TCP_FTP' => '', | ||
| 19 | 'NP_HOST_TCP_HPJD' => '', | ||
| 20 | 'NP_HOST_TCP_HTTP2' => 'test.monitoring-plugins.org', | ||
| 21 | 'NP_HOST_TCP_HTTP' => 'localhost', | ||
| 22 | 'NP_HOST_TCP_IMAP' => 'imap.web.de', | ||
| 23 | 'NP_HOST_TCP_JABBER' => 'jabber.org', | ||
| 24 | 'NP_HOST_TCP_LDAP' => 'localhost', | ||
| 25 | 'NP_HOST_TCP_POP' => 'pop.web.de', | ||
| 26 | 'NP_HOST_TCP_PROXY' => 'localhost', | ||
| 27 | 'NP_HOST_TCP_SMTP' => 'localhost', | ||
| 28 | 'NP_HOST_TCP_SMTP_NOTLS' => '', | ||
| 29 | 'NP_HOST_TCP_SMTP_TLS' => '', | ||
| 30 | 'NP_HOST_TLS_CERT' => 'localhost', | ||
| 31 | 'NP_HOST_TLS_HTTP' => 'localhost', | ||
| 32 | 'NP_HOST_UDP_TIME' => 'none', | ||
| 33 | 'NP_INTERNET_ACCESS' => 'yes', | ||
| 34 | 'NP_LDAP_BASE_DN' => 'dc=nodomain', | ||
| 35 | 'NP_MOUNTPOINT2_VALID' => '/media/ramdisk1', | ||
| 36 | 'NP_MOUNTPOINT_VALID' => '/', | ||
| 37 | 'NP_MYSQL_LOGIN_DETAILS' => '-u root -d test', | ||
| 38 | 'NP_MYSQL_SERVER' => 'localhost', | ||
| 39 | 'NP_MYSQL_SOCKET' => '/var/run/mysqld/mysqld.sock', | ||
| 40 | 'NP_MYSQL_WITH_SLAVE' => '', | ||
| 41 | 'NP_MYSQL_WITH_SLAVE_LOGIN' => '', | ||
| 42 | 'NP_NO_NTP_SERVICE' => 'localhost', | ||
| 43 | 'NP_PORT_TCP_PROXY' => '3128', | ||
| 44 | 'NP_SMB_SHARE' => '', | ||
| 45 | 'NP_SMB_SHARE_DENY' => '', | ||
| 46 | 'NP_SMB_SHARE_SPC' => '', | ||
| 47 | 'NP_SMB_VALID_USER' => '', | ||
| 48 | 'NP_SMB_VALID_USER_PASS' => '', | ||
| 49 | 'NP_SNMP_COMMUNITY' => '', | ||
| 50 | 'NP_SNMP_USER' => '', | ||
| 51 | 'NP_SSH_CONFIGFILE' => '~/.ssh/config', | ||
| 52 | 'NP_SSH_HOST' => 'localhost', | ||
| 53 | 'NP_SSH_IDENTITY' => '~/.ssh/id_rsa' | ||
| 54 | } | ||
diff --git a/.github/prepare_debian.sh b/.github/prepare_debian.sh new file mode 100755 index 00000000..40053206 --- /dev/null +++ b/.github/prepare_debian.sh | |||
| @@ -0,0 +1,99 @@ | |||
| 1 | #!/bin/bash | ||
| 2 | |||
| 3 | set -x | ||
| 4 | set -e | ||
| 5 | |||
| 6 | export DEBIAN_FRONTEND=noninteractive | ||
| 7 | |||
| 8 | apt-get update | ||
| 9 | apt-get -y install software-properties-common | ||
| 10 | if [ $(lsb_release -is) = "Debian" ]; then | ||
| 11 | apt-add-repository non-free | ||
| 12 | apt-get update | ||
| 13 | fi | ||
| 14 | apt-get -y install perl autotools-dev libdbi-dev libldap2-dev libpq-dev libradcli-dev libnet-snmp-perl procps | ||
| 15 | apt-get -y install libdbi0-dev libdbd-sqlite3 libssl-dev dnsutils snmp-mibs-downloader libsnmp-perl snmpd | ||
| 16 | apt-get -y install fping snmp netcat smbclient vsftpd apache2 ssl-cert postfix libhttp-daemon-ssl-perl | ||
| 17 | apt-get -y install libdbd-sybase-perl libnet-dns-perl | ||
| 18 | apt-get -y install slapd ldap-utils | ||
| 19 | apt-get -y install gcc make autoconf automake gettext | ||
| 20 | apt-get -y install faketime | ||
| 21 | apt-get -y install libmonitoring-plugin-perl | ||
| 22 | apt-get -y install libcurl4-openssl-dev | ||
| 23 | apt-get -y install liburiparser-dev | ||
| 24 | apt-get -y install squid | ||
| 25 | apt-get -y install openssh-server | ||
| 26 | apt-get -y install mariadb-server mariadb-client libmariadb-dev | ||
| 27 | apt-get -y install cron iputils-ping | ||
| 28 | apt-get -y install iproute2 | ||
| 29 | |||
| 30 | # remove ipv6 interface from hosts | ||
| 31 | if [ $(ip addr show | grep "inet6 ::1" | wc -l) -eq "0" ]; then | ||
| 32 | sed '/^::1/d' /etc/hosts > /tmp/hosts | ||
| 33 | cp -f /tmp/hosts /etc/hosts | ||
| 34 | fi | ||
| 35 | |||
| 36 | ip addr show | ||
| 37 | |||
| 38 | cat /etc/hosts | ||
| 39 | |||
| 40 | |||
| 41 | # apache | ||
| 42 | a2enmod ssl | ||
| 43 | a2ensite default-ssl | ||
| 44 | make-ssl-cert generate-default-snakeoil --force-overwrite | ||
| 45 | service apache2 start | ||
| 46 | |||
| 47 | # squid | ||
| 48 | cp tools/squid.conf /etc/squid/squid.conf | ||
| 49 | service squid start | ||
| 50 | |||
| 51 | # mariadb | ||
| 52 | service mariadb start | ||
| 53 | mysql -e "create database IF NOT EXISTS test;" -uroot | ||
| 54 | |||
| 55 | # ldap | ||
| 56 | sed -e 's/cn=admin,dc=nodomain/'$(/usr/sbin/slapcat|grep ^dn:|awk '{print $2}')'/' -i .github/NPTest.cache | ||
| 57 | service slapd start | ||
| 58 | |||
| 59 | # sshd | ||
| 60 | ssh-keygen -t rsa -N "" -f ~/.ssh/id_rsa | ||
| 61 | cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys | ||
| 62 | service ssh start | ||
| 63 | sleep 1 | ||
| 64 | ssh-keyscan localhost >> ~/.ssh/known_hosts | ||
| 65 | touch ~/.ssh/config | ||
| 66 | |||
| 67 | # start one login session, required for check_users | ||
| 68 | ( ssh -n -tt root@localhost "top" < /dev/null >/dev/null 2>&1 & ) | ||
| 69 | sleep 1 | ||
| 70 | who | ||
| 71 | ssh root@localhost "top -b -n 1" | ||
| 72 | |||
| 73 | # snmpd | ||
| 74 | for DIR in /usr/share/snmp/mibs /usr/share/mibs; do | ||
| 75 | rm -f $DIR/ietf/SNMPv2-PDU \ | ||
| 76 | $DIR/ietf/IPSEC-SPD-MIB \ | ||
| 77 | $DIR/ietf/IPATM-IPMC-MIB \ | ||
| 78 | $DIR/iana/IANA-IPPM-METRICS-REGISTRY-MIB | ||
| 79 | done | ||
| 80 | mkdir -p /var/lib/snmp/mib_indexes | ||
| 81 | sed -e 's/^agentaddress.*/agentaddress 127.0.0.1/' -i /etc/snmp/snmpd.conf | ||
| 82 | service snmpd start | ||
| 83 | |||
| 84 | # start cron, will be used by check_nagios | ||
| 85 | cron | ||
| 86 | |||
| 87 | # start postfix | ||
| 88 | service postfix start | ||
| 89 | |||
| 90 | # start ftpd | ||
| 91 | service vsftpd start | ||
| 92 | |||
| 93 | # hostname | ||
| 94 | sed "/NP_HOST_TLS_CERT/s/.*/'NP_HOST_TLS_CERT' => '$(hostname)',/" -i /src/.github/NPTest.cache | ||
| 95 | |||
| 96 | # create some test files to lower inodes | ||
| 97 | for i in $(seq 10); do | ||
| 98 | touch /media/ramdisk2/test.$1 | ||
| 99 | done | ||
diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 00000000..4c3497d0 --- /dev/null +++ b/.github/workflows/test.yml | |||
| @@ -0,0 +1,77 @@ | |||
| 1 | name: Test | ||
| 2 | |||
| 3 | on: | ||
| 4 | push: | ||
| 5 | branches: | ||
| 6 | - '*' | ||
| 7 | pull_request: | ||
| 8 | |||
| 9 | jobs: | ||
| 10 | # macos: | ||
| 11 | # name: Running tests on ${{ matrix.os }} | ||
| 12 | # strategy: | ||
| 13 | # fail-fast: false | ||
| 14 | # matrix: | ||
| 15 | # os: | ||
| 16 | # - macos-10.15 | ||
| 17 | # runs-on: ${{ matrix.os }} | ||
| 18 | # steps: | ||
| 19 | # | ||
| 20 | # - name: Git clone repository | ||
| 21 | # uses: actions/checkout@v2 | ||
| 22 | # #- name: Setup tmate session, see https://github.com/marketplace/actions/debugging-with-tmate | ||
| 23 | # # uses: mxschmitt/action-tmate@v3 | ||
| 24 | # - name: Prepare machine | ||
| 25 | # run: | | ||
| 26 | # brew install automake | ||
| 27 | # - name: Run the tests | ||
| 28 | # run: | | ||
| 29 | # tools/setup \ | ||
| 30 | # && ./configure --enable-libtap \ | ||
| 31 | # && make \ | ||
| 32 | # && make test | ||
| 33 | |||
| 34 | linux: | ||
| 35 | runs-on: ubuntu-latest | ||
| 36 | name: Running tests on ${{ matrix.distro }} | ||
| 37 | strategy: | ||
| 38 | fail-fast: false | ||
| 39 | matrix: | ||
| 40 | distro: | ||
| 41 | #- 'debian:10' | ||
| 42 | - 'debian:testing' | ||
| 43 | #- 'ubuntu:20.10' | ||
| 44 | #- 'centos:7' | ||
| 45 | #- 'centos:8' | ||
| 46 | include: | ||
| 47 | #- distro: 'debian:10' | ||
| 48 | # prepare: .github/prepare_debian.sh | ||
| 49 | - distro: 'debian:testing' | ||
| 50 | prepare: .github/prepare_debian.sh | ||
| 51 | #- distro: 'ubuntu:20.10' | ||
| 52 | # prepare: .github/prepare_debian.sh | ||
| 53 | #- distro: 'centos:7' | ||
| 54 | # prepare: .github/prepare_centos.sh | ||
| 55 | #- distro: 'centos:8' | ||
| 56 | # prepare: .github/prepare_centos.sh | ||
| 57 | steps: | ||
| 58 | - name: Git clone repository | ||
| 59 | uses: actions/checkout@v2 | ||
| 60 | #- name: Setup tmate session, see https://github.com/marketplace/actions/debugging-with-tmate | ||
| 61 | # uses: mxschmitt/action-tmate@v3 | ||
| 62 | - name: Run the tests on ${{ matrix.distro }} | ||
| 63 | run: | | ||
| 64 | docker volume create --driver local --opt type=tmpfs --opt device=tmpfs --opt o=size=100m,uid=1000 tmp-vol | ||
| 65 | docker run \ | ||
| 66 | -e NPTEST_ACCEPTDEFAULT=1 \ | ||
| 67 | -e NPTEST_CACHE="/src/.github/NPTest.cache" \ | ||
| 68 | -w /src -v ${PWD}:/src \ | ||
| 69 | --tmpfs /media/ramdisk1 \ | ||
| 70 | --mount source=tmp-vol,destination=/src,target=/media/ramdisk2 \ | ||
| 71 | ${{ matrix.distro }} \ | ||
| 72 | /bin/sh -c '${{ matrix.prepare }} && \ | ||
| 73 | tools/setup && \ | ||
| 74 | ./configure --enable-libtap && \ | ||
| 75 | make && \ | ||
| 76 | make test' | ||
| 77 | docker volume rm tmp-vol | ||
