From 6573e6934e9b249924fa323212cb6d9235cbce7b 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 +++++++ test/test.sh | 20 ++++++++++++++++++++ 3 files changed, 28 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/test/test.sh b/test/test.sh index 7e39f09..d5bf42b 100755 --- a/test/test.sh +++ b/test/test.sh @@ -304,6 +304,26 @@ test_external_functions() { } TESTS+=("test_external_functions") +test_fts() { + docker_run + + query_master "set global fts2_java_path='/usr/local/jdk-21/bin/java'" + query_master "set global fts2_java_home='/usr/local/jdk-21'" + 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" + + COUNT=$(query_master "select bm25(f, 't:hello') from fts.fts f" | jq -r '.rows[0].c') + if [[ "${COUNT}" != "1" ]]; then + echo "FTS search did not produce 1 row" + echo ${COUNT} + exit 1 + fi +} +TESTS+=("test_fts") + test_auto_restart() { local exit_code