https://pantsbuild.org/ logo
#general
Title
# general
e

early-needle-54791

02/11/2020, 9:58 PM
I’m writing a jvm task test for a task that uses an invalidated block. Unfortunately the invalidated block tries to fingerprint the task, which involves fingerprinting all the subsystems that it needs, which don’t exist in the test context. Is there a well known way to work around this, or should I just mock out the fingerprinting?
w

witty-crayon-22786

02/11/2020, 9:59 PM
can use
init_subsystem
, but it can be challenging to use
Subsystems
are global singletons in v1, so initializing them is a sideeffect.
e

early-needle-54791

02/11/2020, 10:01 PM
I see. So init the subsystems on the task under test before executing?
w

witty-crayon-22786

02/11/2020, 10:04 PM
yea.
e

early-needle-54791

02/11/2020, 10:05 PM
Is there a way to get all the subsystem deps of a task from the task?
lol okayyy.
subsystem_dependencies
w

witty-crayon-22786

02/11/2020, 10:09 PM
(the answers to these questions are veeery different in v2!)
but yea, exactly.
e

early-needle-54791

02/11/2020, 10:23 PM
I think this is the kind of difficulty you mean…apparently one of the things that is passed as a subsystem_dependency is not a subclass of subsystem. Should I just filter it out?
w

witty-crayon-22786

02/11/2020, 10:25 PM
um, it will probably be a "scoped subsystem instance". but yes. you might consider whacking moles rather that constructing the entire dependency set
e

early-needle-54791

02/11/2020, 10:25 PM
yeah…makes sense
w

witty-crayon-22786

02/11/2020, 10:25 PM
sorry.
e

early-needle-54791

02/11/2020, 10:26 PM
np. thanks for the help
Which subsystem creates the nailgun-server? Having a hard time tracking it down.
hm looks like I can just mock it out.