Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions test.jsonl
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{"test_boolean":true,"test_long":123,"test_double":1.23,"test_string":"あいうえお","test_timestamp":"1999-12-31 23:59:59.000000 +0000","test_json":{"キー":"値"},"test_json_text":{"キー":"値"},"test_json_string":{"キー":"値"},"test_json_nstring":{"キー":"値"}}
{"test_boolean":false,"test_long":456,"test_double":4.56,"test_string":"かきくけこ","test_timestamp":"2000-01-01 00:00:00.000000 +0000","test_json":[{"キー1":"値1"},{"キー2":"値2"}],"test_json_text":[{"キー1":"値1"},{"キー2":"値2"}],"test_json_string":[{"キー1":"値1"},{"キー2":"値2"}],"test_json_nstring":[{"キー1":"値1"},{"キー2":"値2"}]}
{"test_boolean":null,"test_long":null,"test_double":null,"test_string":null,"test_timestamp":null,"test_json":null,"test_json_text":null,"test_json_string":null,"test_json_nstring":null}
{"test_boolean":null,"test_long":null,"test_double":null,"test_string":null,"test_timestamp":null,"test_json":12345,"test_json_text":12345,"test_json_string":12345,"test_json_nstring":12345}
{"test_boolean":null,"test_long":null,"test_double":null,"test_string":null,"test_timestamp":null,"test_json":123.45,"test_json_text":123.45,"test_json_string":123.45,"test_json_nstring":123.45}
{"test_boolean":null,"test_long":null,"test_double":null,"test_string":null,"test_timestamp":null,"test_json":"hoge","test_json_text":"hoge","test_json_string":"hoge","test_json_nstring":"hoge"}
111 changes: 111 additions & 0 deletions test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
#!/bin/sh
cd `dirname ${0}`
VERSION=0.10.5
BEFORE=refs/tags/v${VERSION}
AFTER=remotes/trocco/fix/nstring_to_json_to_origin
git checkout .
git checkout master
git branch -D __BEFORE__ > /dev/null 2>&1
git branch -D __AFTER__ > /dev/null 2>&1
git checkout -b __BEFORE__ ${BEFORE}
git checkout -b __AFTER__ ${AFTER}
MAVEN2=https://repo1.maven.org/maven2
TYPES='
mysql
postgresql
redshift
sqlserver
'
for TYPE in ${TYPES}; do
OUT=test/${TYPE}.out
IN=test/${TYPE}.in
. test/${TYPE}.env
if [ "${SSH}" = "true" ]; then
SSH_HOST=
SSH_PORT=22
SSH_USER=
SSH_KEY=test/ssh_key
ssh -N -i ${SSH_KEY} -L ${PORT}:${HOST}:${PORT} ssh://${SSH_USER}@${SSH_HOST}:${SSH_PORT} &
SSH_PID=$!
HOST=localhost
fi
for BRANCH in __BEFORE__ __AFTER__; do
git checkout ${BRANCH}
if [ -f test/${TYPE}.patch ]; then git apply test/${TYPE}.patch; fi
rm -rf embulk-output-${TYPE}/build
./gradlew :embulk-output-${TYPE}:gem
embulk gem uninstall embulk-output-${TYPE}
embulk gem install embulk-output-${TYPE}/build/gems/embulk-output-${TYPE}-${VERSION}-java.gem
if [ -n "${DRIVER}" ]; then DRIVER_PATHS="null test/${DRIVER}"; else DRIVER_PATHS=null; fi
for DRIVER_PATH in ${DRIVER_PATHS}; do
if [ "${DRIVER_PATH}" != "null" ]; then LOG=test/${TYPE}.${BRANCH}.${DRIVER_VERSION}.log; else LOG=test/${TYPE}.${BRANCH}.log; fi
> ${LOG}
cat << EOD > .config.yml
in:
type: file
path_prefix: test.jsonl
parser:
type: jsonl
columns:
- {name: test_boolean, type: boolean}
- {name: test_long, type: long}
- {name: test_double, type: double}
- {name: test_string, type: string}
- {name: test_timestamp, type: timestamp}
- {name: test_json, type: json}
- {name: test_json_text, type: json}
- {name: test_json_string, type: json}
- {name: test_json_nstring, type: json}
out:
type: ${TYPE}
mode: replace
host: ${HOST}
user: ${USER}
password: '${PASSWORD}'
database: ${DATABASE}
schema: ${SCHEMA}
table: ${TABLE}
column_options:
test_timestamp: {type: ${TIMESTAMP_TYPE}}
test_json_text: {type: TEXT}
test_json_string: {type: '${JSON_STRING_TYPE}', value_type: string}
test_json_nstring: {type: '${JSON_NSTRING_TYPE}', value_type: nstring}
driver_path: ${DRIVER_PATH}
`cat ${OUT}`
EOD
cat .config.yml | tee -a ${LOG}
embulk run .config.yml | tee -a ${LOG}
cat << EOD > .config.yml
in:
type: ${TYPE}
host: ${HOST}
user: ${USER}
password: '${PASSWORD}'
database: ${DATABASE}
column_options:
test_timestamp: {type: string, timestamp_format: '%Y-%m-%d %H:%M:%S.%6N %z'}
test_json: {type: json}
test_json_text: {type: json}
test_json_string: {type: json}
test_json_nstring: {type: json}
`cat ${IN}`
out:
type: command
command: 'cat -'
formatter:
type: jsonl
EOD
cat .config.yml | tee -a ${LOG}
embulk run .config.yml | tee -a ${LOG}
done
if [ -f test/${TYPE}.patch ]; then git apply --reverse test/${TYPE}.patch; fi
rm -f .config.yml
done
if [ -n "${SSH_PID}" ]; then kill -9 ${SSH_PID}; fi
SSH_PID=
rm -f ${IN}
rm -f ${OUT}
done
git checkout master
git branch -D __AFTER__
git branch -D __BEFORE__
Loading