Skip to content
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

Question: Using dbx_service_task to generate data for dbx_services_test #15

Closed
mojkos opened this issue Nov 24, 2020 · 2 comments
Closed

Comments

@mojkos
Copy link

mojkos commented Nov 24, 2020

  1. Problem description:
    • We have integration test which requires an input data
    • Input data is result of python binary execution wrapped with dbx_service_task, it executes some actions and produce hash in a file as result for those actions
    • We want that file be accessible in test's context.
    • Currently, dbx_service_task does NOT declare any output so there's nothing to declare as 'data' dependency for test.
  2. Questions:
    • Do you have similar use cases, and how did you handle them?
    • If not, what do you think is the way to pass files created by the service task into context of dbx_service_test target?
@dzbarsky
Copy link
Contributor

dzbarsky commented Nov 29, 2020

Hi @mojkos,

There's 2 easy ways to accomplish what you want:

  1. If the data your python binary needs is deterministic and available in the repository, you could use a genrule instead of a dbx_service_task to produce the hash file. Genrules create output for other rules to consume in their data attributes (the output would be located in runfiles). This would result in the binary running once and having the result be cached, rather than with every test invocation.
  2. You can use the services attribute of a test rule to depend on your existing dbx_service_task rule. This would result in your task running as a prerequisite every time your test runs.

Hope that helps!

@mojkos
Copy link
Author

mojkos commented Dec 9, 2020

Thanks @dzbarsky.

That's something I was expecting, just wanted to hear some other thoughts on that.

@mojkos mojkos closed this as completed Dec 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants