Merge pull request #850 from liquidata-inc/db/containerize-mysql-test-env

Db/containerize mysql test env
This commit is contained in:
Tim Sehn
2020-08-28 13:34:46 -07:00
committed by GitHub
5 changed files with 71 additions and 17 deletions

View File

@@ -0,0 +1,5 @@
name: 'Dolt MySQL client integration tests'
description: 'Smoke tests for mysql client integrations'
runs:
using: 'docker'
image: '../../../MySQLDockerfile'

View File

@@ -0,0 +1,13 @@
name: Test MySQL Client integrations
on: [pull_request]
jobs:
mysql_client_integrations_job:
runs-on: ubuntu-latest
name: Run tests
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Test mysql client integrations
uses: ./.github/actions/mysql-client-tests

View File

@@ -1,5 +1,15 @@
FROM golang:1.15.0-buster as builder
WORKDIR /root/building/go
COPY ./go/ .
# install dolt from source
ENV GOFLAGS="-mod=readonly"
RUN go build -o dolt ./cmd/dolt
FROM ubuntu:18.04
COPY . /mysql-client-tests
COPY --from=builder /root/building/go/dolt /usr/local/bin/dolt
COPY ./mysql-client-tests /mysql-client-tests
COPY ./mysql-client-tests-entrypoint.sh /mysql-client-tests/entrypoint.sh
# install python
ENV DEBIAN_FRONTEND=noninteractive
@@ -20,8 +30,7 @@ RUN apt-get -y install curl
RUN pip3 install mysql-connector-python
RUN pip3 install PyMySQL
# install java
# Install OpenJDK-8
# install OpenJDK-8
RUN apt-get update && \
apt-get install -y openjdk-8-jdk && \
apt-get install -y ant && \
@@ -48,23 +57,12 @@ RUN cat /etc/apt/sources.list.d/nodesource.list
RUN apt -y install nodejs
# install bats
RUN apt-get update
RUN apt-get install bats
# install dolt TODO build from source
RUN curl -L https://github.com/liquidata-inc/dolt/releases/latest/download/install.sh | bash
RUN dolt version
# setup dolt config
RUN dolt config --global --add metrics.disabled true
RUN dolt config --global --add metrics.host localhost
RUN dolt config --global --add user.name mysql-test-runner
RUN dolt config --global --add user.email mysql-test-runner@liquidata.co
RUN apt-get -y update
RUN apt-get -y install bats
# install node deps
WORKDIR /mysql-client-tests/node
RUN npm install
# run tests
WORKDIR /mysql-client-tests
ENTRYPOINT ["/mysql-client-tests/entrypoint.sh"]

View File

@@ -0,0 +1,10 @@
#!/bin/sh
echo "Updating dolt config for tests:"
dolt config --global --add metrics.disabled true
dolt config --global --add metrics.host localhost
dolt config --global --add user.name mysql-test-runner
dolt config --global --add user.email mysql-test-runner@liquidata.co
echo "Running mysql-client-tests:"
bats /mysql-client-tests/mysql-client-tests.bats

View File

@@ -0,0 +1,28 @@
## MySQL Client Tests
We created smoke tests for Dolt's MySQL client integrations and we run these tests through Github Actions
on pull requests.
These tests can be run locally using Docker. From the root directory of this repo, run:
```bash
$ docker build -t mysql-client-tests -f MySQLDockerfile .
$ docker run mysql-client-tests:latest
```
The `docker build` step will take a few minutes to complete as it needs to install all of the
dependencies in the image.
Running the built container will produce output like:
```bash
$ docker run mysql-client-tests:latest
updating dolt config for tests:
Config successfully updated.
Config successfully updated.
Config successfully updated.
Config successfully updated.
Running mysql-client-tests:
1..4
ok 1 python mysql.connector client
ok 2 python pymysql client
ok 3 mysql-connector-java client
ok 4 node mysql client
```