diff --git a/bb/resources/native-image-tests/run-native-image-tests b/bb/resources/native-image-tests/run-native-image-tests index fd5bbc27..14f67a54 100755 --- a/bb/resources/native-image-tests/run-native-image-tests +++ b/bb/resources/native-image-tests/run-native-image-tests @@ -5,9 +5,23 @@ set -o pipefail TMPSTORE=/tmp/dh-test-store CONFIG=bb/resources/native-image-tests/testconfig.edn +ATTR_REF_CONFIG=bb/resources/native-image-tests/testconfig.attr-refs.edn trap "rm -rf $TMPSTORE" EXIT +./dthk delete-database $ATTR_REF_CONFIG +./dthk create-database $ATTR_REF_CONFIG + +./dthk database-exists $ATTR_REF_CONFIG + +# test that warnings etc. get logged to stderr +LOG_OUTPUT="$(./dthk query '[:find ?e . :where [?e :nonexistent _]]' db:$ATTR_REF_CONFIG 2>&1 >/dev/null | grep ':nonexistent has not been found')" +if [ -z "$LOG_OUTPUT" ] +then + echo "Exception: binary did not log to stderr" + exit 1 +fi + ./dthk delete-database $CONFIG ./dthk create-database $CONFIG @@ -30,7 +44,6 @@ fi ./dthk query '[:find (count ?e) . :where [?e :name _]]' since:0:$CONFIG ./dthk query '[:find (count ?e) . :where [?e :name _]]' asof:0:$CONFIG - # other calls ./dthk pull db:$CONFIG "[:db/id, :name]" "1" ./dthk pull-many db:$CONFIG "[:db/id, :name]" "[1]" diff --git a/bb/resources/native-image-tests/testconfig.attr-refs.edn b/bb/resources/native-image-tests/testconfig.attr-refs.edn new file mode 100644 index 00000000..58de3e85 --- /dev/null +++ b/bb/resources/native-image-tests/testconfig.attr-refs.edn @@ -0,0 +1,5 @@ +{:store {:backend :file + :path "/tmp/dh-test-store" } + :keep-history? true + :attribute-refs? true + :schema-flexibility :write} diff --git a/src/datahike/cli.clj b/src/datahike/cli.clj index 134b7199..3958a9ec 100644 --- a/src/datahike/cli.clj +++ b/src/datahike/cli.clj @@ -16,12 +16,14 @@ ;; This file is following https://github.com/clojure/tools.cli -(log/merge-config! - {:appenders {:println {:doc "Always prints to *err*" - :enabled? true - :fn (fn log-to-stderr [{:keys [output_]}] - (binding [*out* *err*] - (println (force output_))))}}}) +(when-not (= "true" (System/getenv "BABASHKA_POD")) + (log/merge-config! + {:appenders {:println {:enabled? false} ;; leave a "paper trail" + :stderr {:doc "Always prints to *err*" + :enabled? true + :fn (fn log-to-stderr [{:keys [output_]}] + (binding [*out* *err*] + (println (force output_))))}}})) (defn usage [options-summary] (->> [datahike-logo