neillturner / kitchen-verifier-serverspec

A Test Kitchen Serverspec Verifer without having to transit the Busser layer
Other
39 stars 19 forks source link

remote_exec with non-default patterns #35

Open avishnyakov opened 5 years ago

avishnyakov commented 5 years ago

Hey guys, can't figure out how to use remote_exec with patterns option. It feels that it can only work with default_pattern. Only in this case the sandbox gets created and files are transferred to the remote box.

Here are more detail, let me know if this is valid point and if we might want to fix this

Here is transferring to the box with default_pattern, it means that we will have a sandbox-ed https://github.com/neillturner/kitchen-verifier-serverspec/blob/master/lib/kitchen/verifier/serverspec.rb#L58-L71

Setting remote_exec=true, then default_pattern=false and using patterns won't do: no files will be transferred to the box.

If seems to be true, because method rspec_commands also heavily relies on default_pattern values producing a set of patterns via patterns and looking into default_path.

default_path is set to /tmp/kitchen/, it won't have any test suites. Feels that the only way to get files transferred to the box is setting default_pattern=true, they will end up in the sandbox-ed folder (nothing in /tmp/kitchen/) but "patterns" still look under /tmp/kitchen/

config[:patterns].map { |s| "#{env_vars} #{sudo_env('')} $RSPEC_CMD #{color} -f #{config[:format]} --default-path  #{config[:default_path]} #{config[:extra_flags]} -P #{s}" }.join(';')

https://github.com/neillturner/kitchen-verifier-serverspec/blob/master/lib/kitchen/verifier/serverspec.rb#L281-L297

Default pattern will make this call looking under

#{config[:root_path]}/suites/serverspec/*_spec.rb

https://github.com/neillturner/kitchen-verifier-serverspec/blob/master/lib/kitchen/verifier/serverspec.rb#L284

and then patterns will be looking into default_path! They find nothing

#{env_vars} #{sudo_env('')} $RSPEC_CMD #{color} -f #{config[:format]} --default-path  #{config[:default_path]} #{config[:extra_flags]} -P #{s}" 

https://github.com/neillturner/kitchen-verifier-serverspec/blob/master/lib/kitchen/verifier/serverspec.rb#L293