Created
April 21, 2023 20:37
-
-
Save sorrell/e45cb8e448af14237a20dcee9b8864ec to your computer and use it in GitHub Desktop.
AGE smoketest for Docker
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# docker build . -t test-age:1.3.0 | |
# docker run -d --rm --name testage -e POSTGRES_PASSWORD=pass test-age:1.3.0 | |
# docker exec -it testage bash | |
apt-get update && \ | |
apt-get install -y --no-install-recommends ca-certificates wget && \ | |
GOSU_VERSION=1.12 && \ | |
wget -O /usr/local/bin/gosu "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$(dpkg --print-architecture)" && \ | |
wget -O /usr/local/bin/gosu.asc "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$(dpkg --print-architecture).asc" && \ | |
export GNUPGHOME="$(mktemp -d)" && \ | |
gpg --batch --keyserver hkps://keys.openpgp.org --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4 && \ | |
gpg --batch --verify /usr/local/bin/gosu.asc /usr/local/bin/gosu && \ | |
gpgconf --kill all && \ | |
rm -rf "$GNUPGHOME" /usr/local/bin/gosu.asc && \ | |
chmod +x /usr/local/bin/gosu | |
gosu postgres initdb | |
gosu postgres bash -c "postgres -c shared_preload_libraries=age &" | |
# as postgres user | |
gosu postgres psql -c "create extension age; \ | |
load 'age'; \ | |
set search_path = ag_catalog, \"\$user\", public; \ | |
create table test(a int, b text); \ | |
insert into test values (1, 'abc'); \ | |
select * from test; \ | |
select create_graph('testgraph'); \ | |
select create_vlabel('testgraph', 'label'); \ | |
select * from cypher('testgraph', \$\$ CREATE(c:Customer {code: \"Cust1\"}) SET c.name = \"Bitnine\" RETURN c \$\$) as (a agtype); \ | |
select * from ag_catalog.ag_label;" | |
# root again | |
# create non-root user to run initdb in installcheck | |
useradd johndoe --create-home | |
chown -R johndoe:root /age | |
# as johndoe user | |
gosu johndoe bash -c "cd /age && make installcheck" | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment