Skip to content

Commit

Permalink
Add support for locale and encoding, fix sclorg#406
Browse files Browse the repository at this point in the history
  • Loading branch information
mscherer committed Sep 22, 2022
1 parent 8aafd89 commit 0465500
Showing 1 changed file with 49 additions and 0 deletions.
49 changes: 49 additions & 0 deletions test/run_test
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ run_s2i_enable_ssl_test
run_upgrade_test
run_migration_test
run_pgaudit_test
run_locales_test
"

test $# -eq 1 -a "${1-}" == --list && echo "$TEST_LIST" && exit 0
Expand Down Expand Up @@ -863,6 +864,54 @@ EOSQL"
grep -E 'AUDIT: SESSION,.*,.*,READ,SELECT,,,SELECT' "${data_dir}"/userdata/log/postgresql-*.log
}

function run_locales_test() {
local data_dir config_dir name=pg-test-locales-1
# create a dir for data
create_volume_dir
data_dir="${volume_dir}"

DOCKER_ARGS="-e POSTGRESQL_ADMIN_PASSWORD=Mellon
-e POSTGRESQL_LOCALE=en_GB
-e POSTGRESQL_ENCODING=ISO885915
-v ${data_dir}:/var/lib/pgsql/data:Z" create_container $name

wait_ready "$name"

# LATIN9 is a alias for ISO885915
docker exec -i $(get_cid "$name") bash -c "psql <<EOSQL
SHOW SERVER_ENCODING;
EOSQL" | grep LATIN9

docker exec -i $(get_cid "$name") bash -c "psql <<EOSQL
SHOW LC_COLLATE;
EOSQL" | grep -vi LC_COLLA | grep en_GB

docker stop "$(get_cid "$name")"

name=pg-test-locales-2
# create a dir for data
create_volume_dir
data_dir="${volume_dir}"

DOCKER_ARGS="-e POSTGRESQL_ADMIN_PASSWORD=Natoar23ae
-e POSTGRESQL_LOCALE=C
-e POSTGRESQL_ENCODING=UTF8
-v ${data_dir}:/var/lib/pgsql/data:Z" create_container $name

wait_ready "$name"

docker exec -i $(get_cid "$name") bash -c "psql <<EOSQL
SHOW SERVER_ENCODING;
EOSQL" | grep UTF8

docker exec -i $(get_cid "$name") bash -c "psql <<EOSQL
SHOW LC_COLLATE;
EOSQL" | grep -vi LC_COLLA | grep C

docker stop "$(get_cid "$name")"

}

# configuration defaults
POSTGRESQL_MAX_CONNECTIONS=100
POSTGRESQL_MAX_PREPARED_TRANSACTIONS=0
Expand Down

0 comments on commit 0465500

Please sign in to comment.