fix entrypoint

This commit is contained in:
elianddb
2025-10-12 00:28:16 -07:00
parent c38d3827c1
commit 891ef9592f
8 changed files with 57 additions and 75 deletions

View File

@@ -108,8 +108,17 @@ FROM php:8.3-bookworm AS runtime
RUN apt-get update && apt-get install -y \
default-libmysqlclient-dev \
libmysqlcppconn-dev \
r-base \
libdbd-mysql-perl \
default-mysql-client \
postgresql \
postgresql-contrib \
postgresql-15-mysql-fdw \
r-base-core \
perl-base \
lsof \
bats \
&& rm -rf /var/lib/apt/lists/*
# compiled, must come after above
RUN R -e "install.packages(c('RMariaDB', 'RMySQL', 'DBI'), repos='https://cloud.r-project.org/')"
COPY --from=dolt_build /build/bin/ /usr/local/bin/
@@ -125,6 +134,7 @@ COPY --from=node_clients_build /build/bin/ /build/bin/node/
COPY --from=php_clients_build /build/bin/ /build/bin/php/
COPY --from=ruby_clients_build /build/bin/ /build/bin/ruby/
COPY dolt/integration-tests/mysql-client-tests/r/ /build/bin/r/
COPY dolt/integration-tests/mysql-client-tests/perl/ /build/bin/perl/
COPY --from=java_clients_build /build/jre/ /opt/jre/
COPY --from=node_clients_build /usr/local/bin/node /usr/local/bin/node
@@ -136,3 +146,10 @@ COPY --from=ruby_clients_build /usr/local/bundle/ /usr/local/bundle/
ENV PATH="/opt/jre/bin:/usr/local/bundle/bin:${PATH}"
ENV GEM_HOME="/usr/local/bundle"
ENV BUNDLE_APP_CONFIG="/usr/local/bundle"
COPY dolt/integration-tests/mysql-client-tests/mysql-client-tests.bats /build/bin/
COPY dolt/integration-tests/mysql-client-tests/helpers.bash /build/bin/
COPY dolt/integration-tests/mysql-client-tests/mysql-client-tests-entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]

View File

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

View File

@@ -7,4 +7,4 @@ 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
bats /build/bin/mysql-client-tests.bats

View File

@@ -1,5 +1,5 @@
#!/usr/bin/env bats
load $BATS_TEST_DIRNAME/helpers.bash
load /build/bin/helpers.bash
# MySQL client tests are set up to test Dolt as a MySQL server and
# standard MySQL Clients in a wide array of languages. I used BATS because
@@ -26,103 +26,72 @@ teardown() {
}
@test "go go-sql-drive/mysql test" {
(cd $BATS_TEST_DIRNAME/go; go build .)
$BATS_TEST_DIRNAME/go/go $USER $PORT $REPO_NAME
/build/bin/go/go-mysql-client-test $USER $PORT $REPO_NAME
}
@test "go go-mysql test" {
(cd $BATS_TEST_DIRNAME/go-mysql; go build .)
$BATS_TEST_DIRNAME/go-mysql/go $USER $PORT $REPO_NAME
/build/bin/go/go-sql-driver-test $USER $PORT $REPO_NAME
}
@test "python mysql.connector client" {
python3.9 $BATS_TEST_DIRNAME/python/mysql.connector-test.py $USER $PORT $REPO_NAME
/build/bin/python/py-mysql-connector-test $USER $PORT $REPO_NAME
}
@test "python pymysql client" {
python3.9 $BATS_TEST_DIRNAME/python/pymysql-test.py $USER $PORT $REPO_NAME
/build/bin/python/pymysql-test $USER $PORT $REPO_NAME
}
@test "python sqlachemy client" {
python3.9 $BATS_TEST_DIRNAME/python/sqlalchemy-test.py $USER $PORT $REPO_NAME
/build/bin/python/py-sqlalchemy-test $USER $PORT $REPO_NAME
}
@test "mysql-connector-java client" {
javac $BATS_TEST_DIRNAME/java/MySQLConnectorTest.java
java -cp $BATS_TEST_DIRNAME/java:$BATS_TEST_DIRNAME/java/mysql-connector-java-8.0.21.jar MySQLConnectorTest $USER $PORT $REPO_NAME
java -jar /build/bin/java/mysql-connector-test.jar $USER $PORT $REPO_NAME
}
@test "mysql-connector-java client collations" {
javac $BATS_TEST_DIRNAME/java/MySQLConnectorTest_Collation.java
java -cp $BATS_TEST_DIRNAME/java:$BATS_TEST_DIRNAME/java/mysql-connector-java-8.0.21.jar MySQLConnectorTest_Collation $USER $PORT $REPO_NAME
java -jar /build/bin/java/mysql-connector-test-collation.jar $USER $PORT $REPO_NAME
}
@test "node mysql client" {
node $BATS_TEST_DIRNAME/node/index.js $USER $PORT $REPO_NAME
node $BATS_TEST_DIRNAME/node/knex.js $USER $PORT $REPO_NAME
node /build/bin/node/index.js $USER $PORT $REPO_NAME
node /build/bin/node/knex.js $USER $PORT $REPO_NAME
}
@test "node mysql client, hosted workbench stability" {
node $BATS_TEST_DIRNAME/node/workbench.js $USER $PORT $REPO_NAME $BATS_TEST_DIRNAME/node/testdata
node /build/bin/node/workbench.js $USER $PORT $REPO_NAME /build/bin/node/testdata
}
@test "c mysql connector" {
(cd $BATS_TEST_DIRNAME/c; make clean; make)
$BATS_TEST_DIRNAME/c/mysql-connector-c-test $USER $PORT $REPO_NAME
/build/bin/c/c-mysql-client-test $USER $PORT $REPO_NAME
}
@test "cpp mysql connector" {
if [ -d $BATS_TEST_DIRNAME/cpp/_build ]
then
rm -rf $BATS_TEST_DIRNAME/cpp/_build/*
else
mkdir $BATS_TEST_DIRNAME/cpp/_build
fi
cd $BATS_TEST_DIRNAME/cpp/_build
if [[ `uname` = "Darwin" ]]; then
PATH=/usr/local/Cellar/mysql-client/8.0.21/bin/:"$PATH" cmake .. -DWITH_SSL=/usr/local/Cellar/openssl@1.1/1.1.1g/ -DWITH_JDBC=yes;
else
cmake ..
fi
cmake ..
make -j 10
$BATS_TEST_DIRNAME/cpp/_build/test_mysql_connector_cxx $USER $PORT $REPO_NAME
cd -
/build/bin/cpp/cpp-mysql-connector-test $USER $PORT $REPO_NAME
}
@test "dotnet mysql connector" {
cd $BATS_TEST_DIRNAME/dotnet/MySqlConnector
# dotnet run uses output channel 3 which conflicts with bats so we pipe it to null
dotnet run -- $USER $PORT $REPO_NAME 3>&-
/build/bin/dotnet/dotnet-mysql-connector-test $USER $PORT $REPO_NAME
}
@test "dotnet mysql client" {
cd $BATS_TEST_DIRNAME/dotnet/MySqlClient
# dotnet run uses output channel 3 which conflicts with bats so we pipe it to null
dotnet run -- $USER $PORT $REPO_NAME 3>&-
/build/bin/dotnet/dotnet-mysql-client-test $USER $PORT $REPO_NAME
}
@test "perl DBD:mysql client" {
perl $BATS_TEST_DIRNAME/perl/dbd-mysql-test.pl $USER $PORT $REPO_NAME
perl /build/bin/perl/dbd-mysql-test.pl $USER $PORT $REPO_NAME
}
@test "ruby ruby/mysql test" {
ruby $BATS_TEST_DIRNAME/ruby/ruby-mysql-test.rb $USER $PORT $REPO_NAME
ruby /build/bin/ruby/ruby-mysql-test.rb $USER $PORT $REPO_NAME
}
@test "ruby mysql2 test" {
ruby $BATS_TEST_DIRNAME/ruby/mysql2-test.rb $USER $PORT $REPO_NAME
ruby /build/bin/ruby/mysql2-test.rb $USER $PORT $REPO_NAME
}
@test "elixir myxql test" {
cd $BATS_TEST_DIRNAME/elixir/
# install some mix dependencies
mix local.hex --force
mix local.rebar --force
mix deps.get
# run the test
mix run -e "IO.puts(SmokeTest.run())" $USER $PORT $REPO_NAME
/build/bin/elixir/elixir-mysql-client-test $USER $PORT $REPO_NAME
}
@test "mysqldump works" {
@@ -163,27 +132,22 @@ EOF" -m "postgres"
}
@test "R RMySQL client" {
Rscript $BATS_TEST_DIRNAME/r/rmysql-test.r $USER $PORT $REPO_NAME
Rscript /build/bin/r/rmysql-test.r $USER $PORT $REPO_NAME
}
@test "R RMariaDB client" {
skip "Error loading RMariaDB library"
# ex: https://github.com/dolthub/dolt/actions/runs/4428743682/jobs/7770282852
Rscript $BATS_TEST_DIRNAME/r/rmariadb-test.r $USER $PORT $REPO_NAME
Rscript /build/bin/r/rmariadb-test.r $USER $PORT $REPO_NAME
}
@test "rust mysql client" {
cd $BATS_TEST_DIRNAME/rust
./target/debug/mysql_connector_test $USER $PORT $REPO_NAME
/build/bin/rust/rust-mysql-client-test $USER $PORT $REPO_NAME
}
@test "php mysqli mysql client" {
cd $BATS_TEST_DIRNAME/php
php mysqli_connector_test.php $USER $PORT $REPO_NAME
php /build/bin/php/mysqli_connector_test.php $USER $PORT $REPO_NAME
}
@test "php pdo mysql client" {
cd $BATS_TEST_DIRNAME/php
php pdo_connector_test.php $USER $PORT $REPO_NAME
php /build/bin/php/pdo_connector_test.php $USER $PORT $REPO_NAME
}

View File

@@ -54,7 +54,7 @@ def main():
print(exp_results)
print("Received:")
print(results)
exit(1)
sys.exit(1)
except mysql.connector.errors.InterfaceError:
# This is a write query
@@ -64,7 +64,7 @@ def main():
connection.close()
exit(0)
sys.exit(0)
main()

View File

@@ -54,14 +54,14 @@ def main():
print(exp_results)
print("Received:")
print(results)
exit(1)
sys.exit(1)
# You can't call fetchall on an insert
# so we'll just ignore the exception
except sqlalchemy.exc.ResourceClosedError:
pass
con.close()
exit(0)
sys.exit(0)
main()

View File

@@ -44,11 +44,11 @@ def main():
print(exp_results)
print("Received:")
print(results)
exit(1)
sys.exit(1)
connection.close()
exit(0)
sys.exit(0)
main()

View File

@@ -17,7 +17,7 @@ queries = list("create table test (pk int, value int, primary key(pk))",
"select * from test")
responses = list(NULL,
data.frame(Field = c("pk", "value"), Type = c("int", "int"), Null = c("NO", "YES"), Key = c("PRI", ""), Default = c(NA, NA), Extra = c("", ""), stringsAsFactors = FALSE),
data.frame(Field = c("pk", "value"), Type = c("int", "int"), Null = c("NO", "YES"), Key = c("PRI", ""), Default = c(NA_character_, NA_character_), Extra = c("", ""), stringsAsFactors = FALSE),
NULL,
data.frame(pk = c(0), value = c(0), stringsAsFactors = FALSE))
@@ -30,7 +30,7 @@ for(i in 1:length(queries)) {
print(q)
print(want)
print(got)
quit(1)
quit(save="no", status=1)
}
} else {
dbExecute(conn, q)
@@ -45,7 +45,7 @@ dbClearResult(rs)
if (rowsAff != 1) {
print("failed to execute prepared statement")
quit(1)
quit(save="no", status=1)
}
got <- dbGetQuery(conn, "select * from test where pk = 1")
@@ -53,7 +53,7 @@ want = data.frame(pk = c(1), value = c(1))
if (!isTRUE(all.equal(want, got))) {
print("unexpected prepared statement result")
print(got)
quit(1)
quit(save="no", status=1)
}
dolt_queries = list("call DOLT_ADD('-A')",
@@ -74,7 +74,7 @@ want <- data.frame(c = c(3))
ret <- all.equal(count, want)
if (!ret) {
print("Number of commits is incorrect")
quit(1)
quit(save="no", status=1)
}
# Add a failing query and ensure that the connection does not quit.
@@ -84,6 +84,6 @@ one <- dbGetQuery(conn, "select 1 as pk")
ret <- one == data.frame(pk=1)
if (!ret) {
print("Number of commits is incorrect")
quit(1)
quit(save="no", status=1)
}