Skip to content

Commit

Permalink
chore: add java
Browse files Browse the repository at this point in the history
  • Loading branch information
pvetere committed Oct 16, 2024
1 parent 6ce0136 commit 527d17a
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 7 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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 && \
Expand Down
2 changes: 2 additions & 0 deletions scripts/init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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()
{
Expand Down
18 changes: 18 additions & 0 deletions test/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,24 @@ 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"

COUNT=$(query_master "select bm25(f, 't:hello') as h from fts.fts f" | jq -r '.rows[0].h')
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

Expand Down

0 comments on commit 527d17a

Please sign in to comment.