[Git][clojure-team/trapperkeeper-clojure][debian/main] 5 commits: d/watch: update to recommended github format
Jérôme Charaoui (@lavamind)
gitlab at salsa.debian.org
Thu Apr 3 18:39:29 BST 2025
Jérôme Charaoui pushed to branch debian/main at Debian Clojure Maintainers / trapperkeeper-clojure
Commits:
8f993f7f by Jérôme Charaoui at 2025-04-03T11:44:35-04:00
d/watch: update to recommended github format
- - - - -
59fb5b02 by Jérôme Charaoui at 2025-04-03T11:44:59-04:00
New upstream version 4.0.2
- - - - -
00098e8b by Jérôme Charaoui at 2025-04-03T11:45:00-04:00
Update upstream source from tag 'upstream/4.0.2'
Update to upstream version '4.0.2'
with Debian dir cbd19d075ab33accf65d716b08437cd2e0921deb
- - - - -
a6974247 by Jérôme Charaoui at 2025-04-03T11:45:19-04:00
d/control: bump Standards-Version, no changes needed
- - - - -
76a36818 by Jérôme Charaoui at 2025-04-03T11:48:25-04:00
Update changelog for 4.0.2-1 release
- - - - -
10 changed files:
- .github/workflows/clojure-linting.yaml
- .github/workflows/mend.yaml
- CHANGELOG.md
- debian/changelog
- debian/control
- debian/watch
- documentation/Test-Utils.md
- project.clj
- test/puppetlabs/trapperkeeper/logging_test.clj
- test/puppetlabs/trapperkeeper/testutils/logging.clj
Changes:
=====================================
.github/workflows/clojure-linting.yaml
=====================================
@@ -11,12 +11,12 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: setup java
- uses: actions/setup-java at v3
+ uses: actions/setup-java at v4
with:
distribution: temurin
java-version: 17
- name: checkout repo
- uses: actions/checkout at v2
+ uses: actions/checkout at v4
- name: install clj-kondo (this is quite fast)
run: |
curl -sLO https://raw.githubusercontent.com/clj-kondo/clj-kondo/master/script/install-clj-kondo
=====================================
.github/workflows/mend.yaml
=====================================
@@ -1,5 +1,8 @@
name: mend_scan
on:
+ schedule:
+ # run every day at 4:00am
+ - cron: 0 4 * * *
workflow_dispatch:
push:
branches:
@@ -13,18 +16,18 @@ jobs:
with:
service-key: ${{ secrets.TWINGATE_PUBLIC_REPO_KEY }}
- name: checkout repo content
- uses: actions/checkout at v2 # checkout the repository content to github runner.
+ uses: actions/checkout at v4 # checkout the repository content to github runner.
with:
fetch-depth: 1
# install java which is required for mend and clojure
- name: setup java
- uses: actions/setup-java at v3
+ uses: actions/setup-java at v4
with:
distribution: temurin
java-version: 17
# install clojure tools
- name: Install Clojure tools
- uses: DeLaGuardo/setup-clojure at 10.1
+ uses: DeLaGuardo/setup-clojure at 12.5
with:
# Install just one or all simultaneously
# The value must indicate a particular version of the tool, or use 'latest'
=====================================
CHANGELOG.md
=====================================
@@ -1,3 +1,9 @@
+## 4.0.2
+* update `logged?` to not emit an incorrect message when there are no matches, and clean up the output from multiple unexpected matches.
+
+## 4.0.1
+* adds a new arity to `logged?` that removes the restriction that only one log line must match the pattern, adds printing to the function and repo documentation to make users aware of this single line match restriction
+
## 4.0.0
This is a major release with breaking changes.
=====================================
debian/changelog
=====================================
@@ -1,3 +1,11 @@
+trapperkeeper-clojure (4.0.2-1) unstable; urgency=medium
+
+ * New upstream version 4.0.2
+ * d/control: bump Standards-Version, no changes needed
+ * d/watch: update to recommended github format
+
+ -- Jérôme Charaoui <jerome at riseup.net> Thu, 03 Apr 2025 11:48:18 -0400
+
trapperkeeper-clojure (4.0.0-1) unstable; urgency=medium
* New upstream version 4.0.0
=====================================
debian/control
=====================================
@@ -28,7 +28,7 @@ Build-Depends:
libtools-macro-clojure,
libtypesafe-config-clojure,
maven-repo-helper,
-Standards-Version: 4.6.2
+Standards-Version: 4.7.2
Vcs-Git: https://salsa.debian.org/clojure-team/trapperkeeper-clojure.git
Vcs-Browser: https://salsa.debian.org/clojure-team/trapperkeeper-clojure
Homepage: https://github.com/puppetlabs/trapperkeeper
=====================================
debian/watch
=====================================
@@ -1,4 +1,7 @@
version=4
-opts="mode=git" \
-https://github.com/puppetlabs/trapperkeeper.git \
-refs/tags/@ANY_VERSION@
+opts=\
+ filenamemangle=s%.*/@ANY_VERSION@%@PACKAGE at -$1.tar.gz%,\
+ downloadurlmangle=s%(api.github.com/repos/[^/]+/[^/]+)/git/refs/%$1/tarball/refs/%g,\
+ searchmode=plain \
+ https://api.github.com/repos/puppetlabs/trapperkeeper/git/matching-refs/tags/ \
+ https://api.github.com/repos/[^/]+/[^/]+/git/refs/tags/@ANY_VERSION@
=====================================
documentation/Test-Utils.md
=====================================
@@ -44,11 +44,15 @@ since the beginning of the form.
See the `logged?` docstring for a complete description, but as an
example, if the first argument is a regex pattern (typically generated
via Clojure's `#"pattern"`), then `logged?` will return true if the
-pattern matches the message of anything that has been logged since the
-beginning of the enclosing `with-test-logging` form. An optional
+pattern matches a single message of anything that has been logged since the
+beginning of the enclosing `with-test-logging` form. An optional
second parameter restricts the match to log events with the specified
level: `:trace`, `:debug`, `:info`, `:warn`, `:error` or `:fatal`.
+Note: by default `logged?` returns true only if there is exactly one
+log line match. An optional third parameter can be specified to disable
+this restriction.
+
### `event->map`
This function converts a LogEvent to a Clojure map of the kind
=====================================
project.clj
=====================================
@@ -1,4 +1,4 @@
-(defproject puppetlabs/trapperkeeper "4.0.0"
+(defproject puppetlabs/trapperkeeper "4.0.2"
:description "A framework for configuring, composing, and running Clojure services."
:license {:name "Apache License, Version 2.0"
=====================================
test/puppetlabs/trapperkeeper/logging_test.clj
=====================================
@@ -37,6 +37,23 @@
(is (true? @done?))
(is (logged? #"test thread" :info))))))
+(deftest with-test-logging-and-duplicate-log-lines
+ (testing "test-logging captures matches duplicate lines when specified"
+ (with-test-logging
+ (log/error "duplicate message")
+ (log/error "duplicate message")
+ (log/warn "duplicate message")
+ (log/warn "single message")
+ (testing "single line only match"
+ (is (not (logged? #"duplicate message"))) ;; original behavior of the fn, default behavior
+ (is (logged? #"duplicate message" :warn false)))
+ (testing "disabling single line match, enabling multiple line match"
+ (is (logged? #"duplicate message" :error true))
+ (is (logged? #"duplicate message" nil true))
+ (testing "still handles single matches"
+ (is (logged? #"single message" nil true))
+ (is (logged? #"single message" :warn true)))))))
+
(deftest test-logging-configuration
(testing "Calling `configure-logging!` with a logback.xml file"
(tk-logging/configure-logging! "./dev-resources/logging/logback-debug.xml")
=====================================
test/puppetlabs/trapperkeeper/testutils/logging.clj
=====================================
@@ -320,21 +320,31 @@
(swap! destination# conj event#))]
~@body)))))
+
(s/defn ^{:always-validate true} logged?
- ([msg-or-pred] (logged? msg-or-pred nil))
+ ([msg-or-pred] (logged? msg-or-pred nil nil))
+ ([msg-or-pred maybe-level] (logged? msg-or-pred maybe-level nil))
([msg-or-pred :- (s/conditional ifn? (s/pred ifn?)
string? s/Str
:else Pattern)
- maybe-level :- (s/maybe (s/pred #(levels %)))]
+ maybe-level :- (s/maybe (s/pred #(levels %)))
+ disable-single-line-match-restriction :- (s/maybe s/Bool)]
(let [match? (cond (ifn? msg-or-pred) msg-or-pred
(string? msg-or-pred) #(= msg-or-pred (:message %))
:else #(re-find msg-or-pred (:message %)))
- one-element? #(and (seq %) (empty? (rest %)))
+ one-element-if-specified? (fn [items]
+ (if (seq items)
+ (if (or disable-single-line-match-restriction (empty? (rest items)))
+ true
+ (do
+ (println "\n`logged?` warning: multiple log line matches found, but this arity expects only one match, returning false. Found matches: \n" (pr-str (map :message items)) "\n")
+ false))
+ false))
correct-level? #(or (nil? maybe-level) (= maybe-level (:level %)))]
(->> (map event->map @*test-log-events*)
(filter correct-level?)
(filter match?)
- (one-element?)))))
+ (one-element-if-specified?)))))
(defmethod clojure.test/assert-expr 'logged? [is-msg form]
;"Asserts that exactly one event in *test-log-events* has a message
@@ -344,10 +354,10 @@
;is specified, the message's keyword level (:info, :error, etc.) must
;also match. For example:
; (with-test-logging (log/info \"123\") (is (logged? #\"2\")))."
- (assert (#{2 3} (count form)))
- (let [[_ msg-or-pred level] form]
+ (assert (#{2 3 4} (count form)))
+ (let [[_ msg-or-pred level disable-single-line-restriction] form]
`(let [events# @@#'puppetlabs.trapperkeeper.testutils.logging/*test-log-events*]
- (if-not (logged? ~msg-or-pred ~level)
+ (if-not (logged? ~msg-or-pred ~level ~disable-single-line-restriction)
(clojure.test/do-report
{:type :fail
:message ~is-msg
View it on GitLab: https://salsa.debian.org/clojure-team/trapperkeeper-clojure/-/compare/cdd545fd331e6794b7eb09daf8a857db2052b607...76a368185b7f3314d29d24b67d8bd77372093c87
--
View it on GitLab: https://salsa.debian.org/clojure-team/trapperkeeper-clojure/-/compare/cdd545fd331e6794b7eb09daf8a857db2052b607...76a368185b7f3314d29d24b67d8bd77372093c87
You're receiving this email because of your account on salsa.debian.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/pkg-java-commits/attachments/20250403/ea0cb265/attachment.htm>
More information about the pkg-java-commits
mailing list