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 d5860ac
Show file tree
Hide file tree
Showing 3 changed files with 30 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
22 changes: 22 additions & 0 deletions test/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,28 @@ test_external_functions() {
}
TESTS+=("test_external_functions")

test_fts() {
docker_run

docker exec ${CURRENT_CONTAINER_ID} find / | grep java

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 test"
local auth=$(echo -n "root:test" | base64)
query_master "create table test.fts(t text, fulltext using version 2 (t))"
query_master "insert into test.fts values ('hello'), ('world')"
query_master "optimize table test.fts full"

COUNT=$(query_master "select bm25(f, 't:hello') from test.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

Expand Down

0 comments on commit d5860ac

Please sign in to comment.