]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
GH actions: added auth odbc{sqlitle3, mssql} tests. Removed from CircleCI 12526/head
authorAlexis Romero <alexis.romero@open-xchange.com>
Thu, 9 Feb 2023 11:16:04 +0000 (12:16 +0100)
committerAlexis Romero <alexis.romero@open-xchange.com>
Tue, 14 Feb 2023 14:22:02 +0000 (15:22 +0100)
.circleci/config.yml
.github/workflows/build-and-test-all.yml
tasks.py

index 024a4d06c9658c6c67abfec69f5502dd9c0dbda7..335da4877d24289180a5833d80310e18c51827c7 100644 (file)
@@ -411,109 +411,6 @@ jobs:
           paths:
             - pdns-auth
 
-  test-auth-regress-odbc-sqlite3:
-    resource_class: small
-
-    docker:
-      - image: debian:buster
-        auth:
-          username: powerdnsreadonly
-          password: $DOCKERHUB_PASSWORD
-        environment:
-          UBSAN_OPTIONS: 'print_stacktrace=1:halt_on_error=1'
-          ASAN_OPTIONS: detect_leaks=0
-    steps:
-      - auth-regress-setup
-      - run:
-          name: Configure ODBC for sqlite
-          command: |
-            cat >> ~/.odbc.ini \<<- __EOF__
-            [pdns-sqlite3-1]
-            Driver = SQLite3
-            Database = ${PWD}/regression-tests/pdns.sqlite3
-            [pdns-sqlite3-2]
-            Driver = SQLite3
-            Database = ${PWD}/regression-tests/pdns.sqlite32
-            __EOF__
-      - run:
-          name: Install ODBC deps
-          command: |
-            apt-get install -qq -y \
-            unixodbc \
-            libsqliteodbc
-      - run:
-          name: Set up sqlite3 odbc testing
-          command: echo 'export GODBC_SQLITE3_DSN=pdns-sqlite3-1' > ./vars
-          workdir: ~/project/regression-tests
-      - auth-regress:
-          context: godbc_sqlite3-nsec3
-          doroot: false # Broken at the moment
-
-  test-auth-regress-odbc-mssql:
-    docker:
-      - image: debian:buster
-        auth:
-          username: powerdnsreadonly
-          password: $DOCKERHUB_PASSWORD
-        environment:
-          UBSAN_OPTIONS: 'print_stacktrace=1:halt_on_error=1'
-          ASAN_OPTIONS: detect_leaks=0
-      - image: mcr.microsoft.com/mssql/server:2017-GA-ubuntu
-        environment:
-          - ACCEPT_EULA: Y
-          - SA_PASSWORD: 'SAsa12%%'
-    steps:
-      - auth-regress-setup
-      - run:
-          name: Install ODBC deps
-          command: |
-            apt-get install -qq -y \
-            freetds-bin \
-            tdsodbc \
-            unixodbc
-      - run:
-          name: set up mssql odbc
-          command: |
-            cat >> ~/.odbc.ini \<<- __EOF__
-            [pdns-mssql-docker]
-            Driver=FreeTDS
-            Trace=No
-            Server=127.0.0.1
-            Port=1433
-            Database=pdns
-            TDS_Version=7.1
-            [pdns-mssql-docker-nodb]
-            Driver=FreeTDS
-            Trace=No
-            Server=127.0.0.1
-            Port=1433
-            TDS_Version=7.1
-            __EOF__
-      - run:
-          command: cat /usr/share/tdsodbc/odbcinst.ini <(echo Threading=1) >> /etc/odbcinst.ini
-      - run:
-          name: create database
-          command: echo 'create database pdns' | isql -v pdns-mssql-docker-nodb sa SAsa12%%
-      - run:
-          name: Set up mssql odbc testing
-          command: echo 'export GODBC_MSSQL_PASSWORD=SAsa12%% GODBC_MSSQL_USERNAME=sa GODBC_MSSQL_DSN=pdns-mssql-docker' > ./vars
-          workdir: ~/project/regression-tests
-      - auth-regress:
-          context: godbc_mssql-nodnssec
-          skip: 8bit-txt-unescaped
-      - auth-regress:
-          context: godbc_mssql
-          skip: 8bit-txt-unescaped
-      - auth-regress:
-          context: godbc_mssql-nsec3
-          skip: 8bit-txt-unescaped
-      - auth-regress:
-          context: godbc_mssql-nsec3-optout
-          skip: 8bit-txt-unescaped
-      - auth-regress:
-          context: godbc_mssql-nsec3-narrow
-          skip: 8bit-txt-unescaped
-
   test-auth-regress-bind:
     resource_class: small
 
@@ -612,12 +509,6 @@ workflows:
       - build-auth:
           requires:
             - checkout
-      - test-auth-regress-odbc-sqlite3:
-          requires:
-            - build-auth
-      - test-auth-regress-odbc-mssql:
-          requires:
-            - build-auth
       - test-auth-regress-geoip:
           requires:
             - build-auth
index f4991a2473fe42b76fa4aab13e2ef74e609bdcac..3ac6c0071978c585ece9783763d076feef463939 100644 (file)
@@ -235,6 +235,10 @@ jobs:
             image: coscale/docker-sleep
           - backend: authpy
             image: coscale/docker-sleep
+          - backend: godbc_sqlite3
+            image: coscale/docker-sleep
+          - backend: godbc_mssql
+            image: mcr.microsoft.com/mssql/server:2017-GA-ubuntu
       fail-fast: false
     services:
       database:
@@ -243,9 +247,12 @@ jobs:
           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
         # 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 554318ec736546ab6acf97da7dd3bd902d6a5801..ac76b78fa87d765f504052f1d3b61e905e48814e 100644 (file)
--- a/tasks.py
+++ b/tasks.py
@@ -202,7 +202,9 @@ auth_backend_test_deps = dict(
     geoip=[],
     lua2=[],
     tinydns=[],
-    authpy=[]
+    authpy=[],
+    godbc_sqlite3=['libsqliteodbc'],
+    godbc_mssql=['freetds-bin','tdsodbc']
 )
 
 @task(help={'backend': 'Backend to install test deps for, e.g. gsqlite3; can be repeated'}, iterable=['backend'], optional=['backend'])
@@ -517,67 +519,146 @@ def test_api(c, product, backend=''):
 
 backend_regress_tests = dict(
     bind = [
-      'bind-both',
-      'bind-dnssec-both',
-      'bind-dnssec-nsec3-both',
-      'bind-dnssec-nsec3-optout-both',
-      'bind-dnssec-nsec3-narrow',
-    # FIXME  'bind-dnssec-pkcs11'
+        'bind-both',
+        'bind-dnssec-both',
+        'bind-dnssec-nsec3-both',
+        'bind-dnssec-nsec3-optout-both',
+        'bind-dnssec-nsec3-narrow',
+        # FIXME  'bind-dnssec-pkcs11'
     ],
     geoip = [
-      'geoip',
-      'geoip-nsec3-narrow'
-      # FIXME: also run this with the mmdb we ship
-    ],
-    lua2 = [
-      'lua2',
-      'lua2-dnssec'
-    ],
-    tinydns = [
-      'tinydns'
+        'geoip',
+        'geoip-nsec3-narrow'
+        # FIXME: also run this with the mmdb we ship
     ],
+    lua2 = ['lua2', 'lua2-dnssec'],
+    tinydns = ['tinydns'],
     remote = [
-      'remotebackend-pipe',
-      'remotebackend-unix',
-      'remotebackend-http',
-      'remotebackend-zeromq',
-      'remotebackend-pipe-dnssec',
-      'remotebackend-unix-dnssec',
-      'remotebackend-http-dnssec',
-      'remotebackend-zeromq-dnssec'
+        'remotebackend-pipe',
+        'remotebackend-unix',
+        'remotebackend-http',
+        'remotebackend-zeromq',
+        'remotebackend-pipe-dnssec',
+        'remotebackend-unix-dnssec',
+        'remotebackend-http-dnssec',
+        'remotebackend-zeromq-dnssec'
     ],
     lmdb = [
-      'lmdb-nodnssec-both',
-      'lmdb-both',
-      'lmdb-nsec3-both',
-      'lmdb-nsec3-optout-both',
-      'lmdb-nsec3-narrow'
+        'lmdb-nodnssec-both',
+        'lmdb-both',
+        'lmdb-nsec3-both',
+        'lmdb-nsec3-optout-both',
+        'lmdb-nsec3-narrow'
+    ],
+    gmysql = [
+        'gmysql',
+        'gmysql-nodnssec-both',
+        'gmysql-nsec3-both',
+        'gmysql-nsec3-optout-both',
+        'gmysql-nsec3-narrow',
+        'gmysql_sp-both'
+    ],
+    gpgsql = [
+        'gpgsql',
+        'gpgsql-nodnssec-both',
+        'gpgsql-nsec3-both',
+        'gpgsql-nsec3-optout-both',
+        'gpgsql-nsec3-narrow',
+        'gpgsql_sp-both'
+    ],
+    gsqlite3 = [
+        'gsqlite3',
+        'gsqlite3-nodnssec-both',
+        'gsqlite3-nsec3-both',
+        'gsqlite3-nsec3-optout-both',
+        'gsqlite3-nsec3-narrow'
+    ],
+    godbc_sqlite3 = ['godbc_sqlite3-nodnssec'],
+    godbc_mssql = [
+        'godbc_mssql',
+        'godbc_mssql-nodnssec',
+        'godbc_mssql-nsec3',
+        'godbc_mssql-nsec3-optout',
+        'godbc_mssql-nsec3-narrow'
     ],
-    gmysql   = ['gmysql',     'gmysql-nodnssec-both',   'gmysql-nsec3-both',   'gmysql-nsec3-optout-both',   'gmysql-nsec3-narrow',   'gmysql_sp-both'],
-    gpgsql   = ['gpgsql',     'gpgsql-nodnssec-both',   'gpgsql-nsec3-both',   'gpgsql-nsec3-optout-both',   'gpgsql-nsec3-narrow',   'gpgsql_sp-both'],
-    gsqlite3 = ['gsqlite3', 'gsqlite3-nodnssec-both', 'gsqlite3-nsec3-both', 'gsqlite3-nsec3-optout-both', 'gsqlite3-nsec3-narrow'],
 )
 
+godbc_mssql_credentials = {"username": "sa", "password": "SAsa12%%"}
+
+godbc_config = '''
+[pdns-mssql-docker]
+Driver=FreeTDS
+Trace=No
+Server=127.0.0.1
+Port=1433
+Database=pdns
+TDS_Version=7.1
+
+[pdns-mssql-docker-nodb]
+Driver=FreeTDS
+Trace=No
+Server=127.0.0.1
+Port=1433
+TDS_Version=7.1
+
+[pdns-sqlite3-1]
+Driver = SQLite3
+Database = pdns.sqlite3
+
+[pdns-sqlite3-2]
+Driver = SQLite3
+Database = pdns.sqlite32
+'''
+
+def setup_godbc_mssql(c):
+    with open(os.path.expanduser("~/.odbc.ini"), "a") as f:
+        f.write(godbc_config)
+    c.sudo('sh -c \'echo "Threading=1" | cat /usr/share/tdsodbc/odbcinst.ini - | tee -a /etc/odbcinst.ini\'')
+    c.sudo('sed -i "s/libtdsodbc.so/\/usr\/lib\/x86_64-linux-gnu\/odbc\/libtdsodbc.so/g" /etc/odbcinst.ini')
+    c.run(f'echo "create database pdns" | isql -v pdns-mssql-docker-nodb {godbc_mssql_credentials["username"]} {godbc_mssql_credentials["password"]}')
+    # FIXME: Skip 8bit-txt-unescaped test
+    c.run('touch ${PWD}/regression-tests/tests/8bit-txt-unescaped/skip')
+
+def setup_godbc_sqlite3(c):
+    with open(os.path.expanduser("~/.odbc.ini"), "a") as f:
+        f.write(godbc_config)
+    c.sudo('sed -i "s/libsqlite3odbc.so/\/usr\/lib\/x86_64-linux-gnu\/odbc\/libsqlite3odbc.so/g" /etc/odbcinst.ini')
+
 @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"'
+
     if backend == 'remote':
         ci_auth_install_remotebackend_test_deps(c)
 
     if backend == 'authpy':
         with c.cd('regression-tests.auth-py'):
-            c.run(f'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" WITHKERBEROS=YES ./runtests')
+            c.run(f'{pdns_auth_env_vars} WITHKERBEROS=YES ./runtests')
+        return
+
+    if backend == 'godbc_sqlite3':
+        setup_godbc_sqlite3(c)
+        with c.cd('regression-tests'):
+            for variant in backend_regress_tests[backend]:
+                c.run(f'{pdns_auth_env_vars} GODBC_SQLITE3_DSN=pdns-sqlite3-1 ./start-test-stop 5300 {variant}')
+        return
+
+    if backend == 'godbc_mssql':
+        setup_godbc_mssql(c)
+        with c.cd('regression-tests'):
+            for variant in backend_regress_tests[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
 
     with c.cd('regression-tests'):
         if backend == 'lua2':
             c.run('touch trustedkeys')  # avoid silly error during cleanup
         for variant in backend_regress_tests[backend]:
-            # FIXME this long line is terrible
-            c.run(f'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" ./start-test-stop 5300 {variant}')
+            c.run(f'{pdns_auth_env_vars} ./start-test-stop 5300 {variant}')
 
     if backend == 'gsqlite3':
         with c.cd('regression-tests.nobackend'):
-            c.run(f'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" ./runtests')
+            c.run(f'{pdns_auth_env_vars} ./runtests')
         c.run('/opt/pdns-auth/bin/pdnsutil test-algorithms')
         return