
docker build . -f-<<'EOF'
from opensuse/leap:15.4

RUN zypper ar -f https://mirror.mariadb.org/yum/11.0.1/sles/15.4/x86_64 mariadb
RUN rpm --import https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
RUN zypper --gpg-auto-import-keys ref

RUN zypper -vvvn in MariaDB-server MariaDB-client eatmydata

WORKDIR /test
ENV USER root

RUN mkdir -p /test/data
RUN mariadb-install-db --no-defaults --data=/test/data --log-error=/test/.install
RUN ( /usr/sbin/mariadbd --datadir=/test/data --user=$USER --skip-networking --socket=/test/.sock --log-error=/test/.cerr --pid-file=/test/.pid & sleep 2 ) && \
    mariadb -S /test/.sock -e 'create database t; create table t.t(a int PRIMARY KEY);' && \
    mariadb -S /test/.sock -e $'delimiter ;;\n\
create function t.f() returns bool\n\
begin \n\
delete from t;\n\
insert into t select case when sleep(5) < 1 then 1 else 2 end;\n\
return 1;\n\
end;;' && \
    mariadb -S /test/.sock -e 'insert into t.t select 1 union select 2 union select 3 union select 4 union select 5' && \
    ( mariadb -S /test/.sock -e 'select t.f()' & sleep 1 ) && \
    ( mariadb -S /test/.sock -e 'insert into t.t select 1' & sleep 0.2; mariadb -S /test/.sock -e 'select * from t.t; show variables like "autocommit"; show engine innodb status\G');


EOF
