From cb86612da9f172700515aeeba65876444ab8e015 Mon Sep 17 00:00:00 2001
From: Steven Murray <Steven.Murray@cern.ch>
Date: Thu, 19 Sep 2019 22:20:01 +0200
Subject: [PATCH] Added CI job dbunittests_mysql to .gitlab-ci.yml

---
 .gitlab-ci.yml | 34 ++++++++++++++++++++++++++++++++++
 1 file changed, 34 insertions(+)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 6ad0a82045..68799c4907 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -163,6 +163,40 @@ dbunittests_postgresql:
   tags:
     - docker
 
+dbunittests_mysql:
+  except:
+    - tags
+  stage: test
+  variables:
+    CTAREPODIR: /tmp/repo
+  image: gitlab-registry.cern.ch/linuxsupport/cc7-base
+  script:
+    - cp -f continuousintegration/docker/ctafrontend/cc7/etc/yum.repos.d/* /etc/yum.repos.d/
+    - yum -y install yum-plugin-priorities createrepo
+    - cp -f continuousintegration/docker/ctafrontend/cc7/etc/yum/pluginconf.d/versionlock.list /etc/yum/pluginconf.d/
+    - mkdir -p ${CTAREPODIR}; cp -r build_rpm/RPM ${CTAREPODIR}
+    - createrepo ${CTAREPODIR}; echo -e "[cta-artifacts]\nname=CTA artifacts\nbaseurl=file://${CTAREPODIR}\ngpgcheck=0\nenabled=1\npriority=2" > /etc/yum.repos.d/cta-artifacts.repo
+    - yum -y --nogpgcheck install cta-systemtests cta-debuginfo sqlite-debuginfo --enablerepo=debug
+    - yum -y install cta-catalogueutils
+    - yum -y install lsof mariadb-server
+    - echo '[mariadb]' > /etc/my.cnf.d/cta_server_listen.cnf
+    - echo 'bind-address=localhost' >> /etc/my.cnf.d/cta_server_listen.cnf
+    - mysql_install_db --user=mysql
+    - /usr/bin/mysqld_safe > /dev/null 2>&1 < /dev/null &
+    - sleep 5
+    - echo 'create database cta;' | mysql
+    - echo 'create user cta;' | mysql
+    - echo 'grant all privileges on *.* to cta@localhost' | mysql
+    - CTA_CATALOGUE_CONF=/etc/cta/cta-catalogue.conf
+    - echo CTA_CATALOGUE_CONF=${CTA_CATALOGUE_CONF}
+    - echo 'mysql://cta@localhost:3306/cta' > ${CTA_CATALOGUE_CONF}
+    - /usr/bin/cta-catalogue-schema-create ${CTA_CATALOGUE_CONF}
+    - /usr/bin/cta-rdbmsUnitTests ${CTA_CATALOGUE_CONF}
+    - kill `ps -ef | egrep '^mysql.*/usr/libexec/mysqld' | awk '{print $2;}'`
+
+  tags:
+    - docker
+
 ctageneric_docker:
   except:
     - tags
-- 
GitLab