-
Notifications
You must be signed in to change notification settings - Fork 0
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
[GH-1181] Ingest Workflow Outputs into TDR #321
Conversation
7b3c475
to
a62643a
Compare
a62643a
to
4caf1bf
Compare
@@ -110,6 +92,49 @@ | |||
(create-local-database name) | |||
(setup-local-database name))) | |||
|
|||
(defmacro with-fixtures |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure if this should be a macro or a function.
If I made it a function, it would itself be a fixture (by symmetry) and passed to other with-fixtures
calls which might be kinda nice. On the other hand, we'd have to use more partial
applications.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Guess you can do this as a macro?
(fixtures/with-fixtures
[(fixtures/with-fixtures
[(fixtures/with-fixtures
[(fixtures/with-fixtures [])])])]
identity)
=> [[[[]]]]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for upload-content.
Not sure how with-fixtures differs from use-fixtures,
but confident using it will bring understanding.
The difference comes from what I've called a (defn my-test-fixture [f]
(create-resource)
(f)
(destroy-resource)) And it's applied to the testing environment via (use-fixtures my-test-fixture) The thunk (defn with-my-fixture [data use]
(let [resource (acquire data)]
(try
(use resource)
(finally
(release resource))))) It's used like so (deftest my-test
(with-my-fixture state
(fn [resource] ... )))
(deftest my-test
(with-my-fixture0 state0
(fn [resource0]
(with-my-fixture1 state1
(fn [resource1]
(with-my-fixture2 state2
(fn [resource2] ... ))))))) becomes: (deftest my-test
(with-fixtures [(with-my-fixture0 state0)
(with-my-fixture1 state1)
...
(with-my-fixtureN stateN))
(fn [[resource0 resource1 ... resourceN]] ...))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
with-fixtures
is really interesting, I can see macro
makes sense here.
Purpose
https://broadinstitute.atlassian.net/browse/GH-1181
This change is a demonstrator for generic workflow output ingest into TDR. The main idea is:
rename-gather
)The main file to look at is api/test/wfl/integration/datarepo_test.clj.
In the test, I've made use of thunks to delay work that can be performed later (e.g. polling). I've tried to add comments to clarify the intent. Let me know if you have questions.