From fffcb0af6428f02876139753e577b844f1d43a8c Mon Sep 17 00:00:00 2001 From: Peter Vetere Date: Wed, 16 Oct 2024 10:53:32 -0400 Subject: [PATCH] chore: add java --- .github/workflows/build.yml | 2 +- Dockerfile | 7 +++++++ scripts/init.sh | 2 ++ test/test.sh | 17 +++++++++++++++++ 4 files changed, 27 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 0084522..cb08dd1 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -20,7 +20,7 @@ jobs: steps: - name: Checkout source - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Set up Docker Buildx uses: docker/setup-buildx-action@v2 diff --git a/Dockerfile b/Dockerfile index 4d2d3a6..e72b348 100644 --- a/Dockerfile +++ b/Dockerfile @@ -18,6 +18,13 @@ RUN yum makecache --refresh && \ yum update -y expat libxml2 libgcrypt && \ yum clean all +RUN cd /tmp && \ + wget https://download.java.net/openjdk/jdk21/ri/openjdk-21+35_linux-x64_bin.tar.gz && \ + tar xzvf openjdk-21+35_linux-x64_bin.tar.gz && \ + mv jdk-21 /usr/local/ && \ + rm -f openjdk-21+35_linux-x64_bin.tar.gz && \ + cd .. + ENV JQ_VERSION='1.6' RUN wget --no-check-certificate https://raw.githubusercontent.com/jqlang/jq/master/sig/jq-release-old.key -O /tmp/jq-release.key && \ wget --no-check-certificate https://raw.githubusercontent.com/jqlang/jq/master/sig/v${JQ_VERSION}/jq-linux64.asc -O /tmp/jq-linux64.asc && \ diff --git a/scripts/init.sh b/scripts/init.sh index 145eed8..87c3b45 100755 --- a/scripts/init.sh +++ b/scripts/init.sh @@ -44,6 +44,8 @@ sdb-admin -y add-leaf --host 127.0.0.1 --port 3307 --password ${INIT_PW} sdb-admin -y update-config --all --set-global --key enable_external_functions --value on sdb-admin -y update-config --all --set-global --key http_api --value on +sdb-admin -y update-config --all --set-global --key fts2_java_path --value /usr/local/jdk-21/bin/java +sdb-admin -y update-config --all --set-global --key fts2_java_home --value /usr/local/jdk-21 isEngineVersionGE() { diff --git a/test/test.sh b/test/test.sh index 7e39f09..40145ee 100755 --- a/test/test.sh +++ b/test/test.sh @@ -304,6 +304,23 @@ test_external_functions() { } TESTS+=("test_external_functions") +test_fts() { + docker_run + + query_master "create database fts" + local auth=$(echo -n "root:test" | base64) + query_master "create table fts.fts(t text, fulltext using version 2 (t))" + query_master "insert into fts.fts values ('hello'), ('world')" + query_master "optimize table fts.fts full" + + OUTPUT=$(query_master "select bm25(f, 't:hello') as h from fts.fts f") + if [ "${OUTPUT}" != '{ "columns": [ "h" ], "rows": [ { "h": "0.3150668740272522" }, { "h": "0" } ] }' ] ; then + echo fts test failed: ${OUTPUT} + exit 1 + fi +} +TESTS+=("test_fts") + test_auto_restart() { local exit_code