]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
gh actions: added ldap and geoip-mmdb tests
authorAlexis Romero <alexis.romero@open-xchange.com>
Thu, 16 Feb 2023 05:52:49 +0000 (06:52 +0100)
committerAlexis Romero <alexis.romero@open-xchange.com>
Tue, 21 Feb 2023 14:49:28 +0000 (15:49 +0100)
.github/workflows/build-and-test-all.yml
tasks.py

index 0152b61b768a1bead59bd35ab3da7ccea11de779..96c1918887d8feb29e52e21290454d349d118d42 100644 (file)
@@ -216,49 +216,89 @@ jobs:
     env:
       UBSAN_OPTIONS: "print_stacktrace=1:halt_on_error=1:suppressions=${{ github.workspace }}/build-scripts/UBSan.supp"
       ASAN_OPTIONS: detect_leaks=0
+      LDAPHOST: ldap://ldapserver/
     strategy:
       matrix:
         include:
           - backend: remote
             image: coscale/docker-sleep
+            env: {}
+            ports: []
           - backend: gmysql
             image: mysql:5
+            env:
+              MYSQL_ALLOW_EMPTY_PASSWORD: 1
+            ports:
+            - 3306:3306
           - backend: gmysql
             image: mariadb:10
+            env:
+              MYSQL_ALLOW_EMPTY_PASSWORD: 1
+            ports:
+            - 3306:3306
           - backend: gpgsql
             image: postgres:9
+            env:
+              POSTGRES_USER: runner
+              POSTGRES_HOST_AUTH_METHOD: trust
+            ports:
+            - 5432:5432
           - backend: gsqlite3  # this also runs regression-tests.nobackend and pdnsutil test-algorithms
             image: coscale/docker-sleep
+            env: {}
+            ports: []
           - backend: lmdb
             image: coscale/docker-sleep
+            env: {}
+            ports: []
           - backend: bind
             image: coscale/docker-sleep
+            env: {}
+            ports: []
           - backend: geoip
             image: coscale/docker-sleep
+            env: {}
+            ports: []
           - backend: lua2
             image: coscale/docker-sleep
+            env: {}
+            ports: []
           - backend: tinydns
             image: coscale/docker-sleep
+            env: {}
+            ports: []
           - backend: authpy
             image: coscale/docker-sleep
+            env: {}
+            ports: []
           - backend: godbc_sqlite3
             image: coscale/docker-sleep
+            env: {}
+            ports: []
           - backend: godbc_mssql
             image: mcr.microsoft.com/mssql/server:2017-GA-ubuntu
+            env:
+              ACCEPT_EULA: Y
+              SA_PASSWORD: 'SAsa12%%'
+            ports:
+              - 1433:1433
+          - backend: ldap
+            image: powerdns/ldap-regress:1.2.4-1
+            env:
+              LDAP_LOG_LEVEL: 0
+              CONTAINER_LOG_LEVEL: 4
+            ports:
+              - 389:389
+          - backend: geoip_mmdb
+            image: coscale/docker-sleep
+            env: {}
+            ports: []
       fail-fast: false
     services:
       database:
         image: ${{ matrix.image }}
-        env:
-          POSTGRES_USER: runner
-          POSTGRES_HOST_AUTH_METHOD: trust
-          MYSQL_ALLOW_EMPTY_PASSWORD: 1
-          ACCEPT_EULA: Y
-          SA_PASSWORD: 'SAsa12%%'
-        ports:
-          - 3306:3306
-          - 5432:5432
-          - 1433:1433
+        env: ${{ matrix.env }}
+        ports: ${{ matrix.ports }}
         # FIXME: this works around dist-upgrade stopping all docker containers. dist-upgrade is huge on these images anyway. Perhaps we do want to run our tasks in a Docker container too.
         options: >-
           --restart always
index 85415aa33bc6e2d4194da8899988a28583ca4c1c..fcf70392359b54f6d7ec92dc88da85defc73c36a 100644 (file)
--- a/tasks.py
+++ b/tasks.py
@@ -204,7 +204,9 @@ auth_backend_test_deps = dict(
     tinydns=[],
     authpy=[],
     godbc_sqlite3=['libsqliteodbc'],
-    godbc_mssql=['freetds-bin','tdsodbc']
+    godbc_mssql=['freetds-bin','tdsodbc'],
+    ldap=[],
+    geoip_mmdb=[]
 )
 
 @task(help={'backend': 'Backend to install test deps for, e.g. gsqlite3; can be repeated'}, iterable=['backend'], optional=['backend'])
@@ -529,7 +531,6 @@ backend_regress_tests = dict(
     geoip = [
         'geoip',
         'geoip-nsec3-narrow'
-        # FIXME: also run this with the mmdb we ship
     ],
     lua2 = ['lua2', 'lua2-dnssec'],
     tinydns = ['tinydns'],
@@ -581,6 +582,12 @@ backend_regress_tests = dict(
         'godbc_mssql-nsec3-optout',
         'godbc_mssql-nsec3-narrow'
     ],
+    ldap = [
+        'ldap-tree',
+        'ldap-simple',
+        'ldap-strict'
+    ],
+    geoip_mmdb = ['geoip'],
 )
 
 godbc_mssql_credentials = {"username": "sa", "password": "SAsa12%%"}
@@ -624,6 +631,10 @@ def setup_godbc_sqlite3(c):
         f.write(godbc_config)
     c.sudo('sed -i "s/libsqlite3odbc.so/\/usr\/lib\/x86_64-linux-gnu\/odbc\/libsqlite3odbc.so/g" /etc/odbcinst.ini')
 
+def setup_ldap_client(c):
+    c.sudo('DEBIAN_FRONTEND=noninteractive apt-get install -qq -y ldap-utils')
+    c.sudo('sh -c \'echo "127.0.0.1 ldapserver" | tee -a /etc/hosts\'')
+
 @task
 def test_auth_backend(c, backend):
     pdns_auth_env_vars = 'PDNS=/opt/pdns-auth/sbin/pdns_server PDNS2=/opt/pdns-auth/sbin/pdns_server SDIG=/opt/pdns-auth/bin/sdig NOTIFY=/opt/pdns-auth/bin/pdns_notify NSEC3DIG=/opt/pdns-auth/bin/nsec3dig SAXFR=/opt/pdns-auth/bin/saxfr ZONE2SQL=/opt/pdns-auth/bin/zone2sql ZONE2LDAP=/opt/pdns-auth/bin/zone2ldap ZONE2JSON=/opt/pdns-auth/bin/zone2json PDNSUTIL=/opt/pdns-auth/bin/pdnsutil PDNSCONTROL=/opt/pdns-auth/bin/pdns_control PDNSSERVER=/opt/pdns-auth/sbin/pdns_server SDIG=/opt/pdns-auth/bin/sdig GMYSQLHOST=127.0.0.1 GMYSQL2HOST=127.0.0.1 MYSQL_HOST="127.0.0.1" PGHOST="127.0.0.1" PGPORT="5432"'
@@ -650,6 +661,15 @@ def test_auth_backend(c, backend):
                 c.run(f'{pdns_auth_env_vars} GODBC_MSSQL_PASSWORD={godbc_mssql_credentials["password"]} GODBC_MSSQL_USERNAME={godbc_mssql_credentials["username"]} GODBC_MSSQL_DSN=pdns-mssql-docker GODBC_MSSQL2_PASSWORD={godbc_mssql_credentials["password"]} GODBC_MSSQL2_USERNAME={godbc_mssql_credentials["username"]} GODBC_MSSQL2_DSN=pdns-mssql-docker ./start-test-stop 5300 {variant}')
         return
 
+    if backend == 'ldap':
+        setup_ldap_client(c)
+
+    if backend == 'geoip_mmdb':
+        with c.cd('regression-tests'):
+            for variant in backend_regress_tests[backend]:
+                c.run(f'{pdns_auth_env_vars} geoipdatabase=../modules/geoipbackend/regression-tests/GeoLiteCity.mmdb ./start-test-stop 5300 {variant}')
+        return
+
     with c.cd('regression-tests'):
         if backend == 'lua2':
             c.run('touch trustedkeys')  # avoid silly error during cleanup