-
Notifications
You must be signed in to change notification settings - Fork 84
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Extend load-config to also work on resources #286
Conversation
Thanks, I can imagine this will be useful. Do we have to have a separate function though? What if |
Great point, I'll make that change. Do you mind force pushes to PRs? |
25fefe5
to
f21454b
Compare
3c8484c
to
aa697e4
Compare
Codecov Report
@@ Coverage Diff @@
## main #286 +/- ##
==========================================
+ Coverage 75.37% 75.59% +0.22%
==========================================
Files 51 51
Lines 2684 2700 +16
Branches 248 248
==========================================
+ Hits 2023 2041 +18
+ Misses 504 502 -2
Partials 157 157
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
Force pushes to feature branches are totally OK! We typically ask people to rebase onto main in order to solve merge conflicts. |
@alysbrooks @plexus any idea when this could get merged? (if ever) |
Hey, thanks for the reminder, I had missed that there was new code here. This looks pretty good! I have one question and one nitpick, both about this section: URL ;; resource
(read-config [resource opts]
(when resource
(->> #(merge {;; Ensure we lock #include down to resources
:resolver aero/resource-resolver}
%)
(update opts :aero/read-config-opts)
(read-config-source resource))))) If I understand your comments correctly Aero by default will look for either files or resources, and here you're saying that if the My nitpick is having an anonymous function as the first element in a thread-last macro. Normally I would expect a collection there or something that returns a collection. Semantically a thread-first on Maybe this would be more clear? (let [opts (update opts :aero/read-config-opts
#(merge {:resolver aero/resource-resolver} %))]
(read-config-source resource opts)) In any case this is not a blocker, I'm fine with merging this as is, but I'm a bit wary of using |
I don't feel strongly either way about it. Let me rewrite the way you suggested so it's more in line with what's normally expected within the project.
I was somewhat surprised to find that in the currently released version I find this surprising as out of the box Kaocha advertises it's working off files relative to the directory it's invoked from. In case some dependency includes a resource at "my-overrides.edn" I might be puzzled why my config in the file system is not being loaded. I didn't want to change this behaviour though as others might already be depending on it. My aim with locking the other path (where we start with a resource) down more was to be less surprising. Due to how Aero's In the case of the polylith/kaocha integration I'm working on right now, the source of truth is a classpath and I want to make no assumptions as to what is the effective working directory therefore I want to only work with resources. Using I'm happy to change this to allow for that though, what do you think? Edit: I just realized as I was refactoring that as of this PR both these default behaviours can be overridden by supplying the correct config in |
Yeah that's entirely reasonable. I don't think there's been a lot of conscious reasoning about the current behavior. The main use cases we've had in mind originally were to have a Since as you point out an API user can specify explicitly the behavior they want locking it down to be less surprising is I think fine, but a bit of documentation about this would be great, perhaps starting with a docstring on |
I'll write something up! |
aa697e4
to
b61d163
Compare
@plexus I refactored that threading macro and added docstring |
Thank you so much @imrekoszo for willing to go through a few iterations to make this better! I really appreciate the elaborate docstring. BTW on Java 8 we're getting an error on CI, in (not (str/includes?
"[(F)]\n\nFAIL in foo20591.bar-test/xxx-test (bar_test.clj:1)\nExpected:\n :xxx\nActual:\n -:xxx +:yyy\n1 tests, 1 assertions, 1 failures.\n\n[watch] Re-running failed tests #{:foo20591.bar-test/xxx-test}\n[(F)]\n\nFAIL in foo20591.bar-test/xxx-test (bar_test.clj:1)\nExpected:\n :xxx\nActual:\n -:xxx +:yyy\n1 tests, 1 assertions, 1 failures.\n\n"
"[(F)]\n\nFAIL in foo20591.bar-test/xxx-test (bar_test.clj:1)\nExpected:\n :xxx\nActual:\n -:xxx +:yyy\n1 tests, 1 assertions, 1 failures.\n\n[watch] Reloading #{foo20591.bar-test}\n[watch] Re-running failed tests #{:foo20591.bar-test/xxx-test}\n[(F)]\n\nFAIL in foo20591.bar-test/xxx-test (bar_test.clj:1)\nExpected:\n :xxx\nActual:\n -:xxx +:zzz")) Seems it expects to get a Clearly not related to this PR so I'm going to merge this, but something to keep an eye on. Would be more than nice to not have a flaky CI. This might be related to the change in watchers we did recently? (hawk vs observer) |
Released in [lambdaisland/kaocha "1.66.1034"]
{lambdaisland/kaocha {:mvn/version "1.66.1034"}} |
@plexus thank you for the merge! |
This could be convenient when kaocha needs to be invoked from code where the contents of the classpath are more reliable than dealing with file system paths.