[PDK-636] Overzealous spec fixture cleaning Created: 2017/10/25  Updated: 2018/06/21  Resolved: 2018/06/12

Status: Closed
Project: Puppet Development Kit
Component/s: None
Affects Version/s: None
Fix Version/s: PDK 1.6.0

Type: Improvement Priority: Critical
Reporter: David Schmitt Assignee: Unassigned
Resolution: Fixed Votes: 2
Labels: resolved_issue_added
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
relates to PDK-977 Create a new PSH release before next ... Closed
relates to PDK-381 ensure that directory junctions in sp... Resolved
Acceptance Criteria:
  • directory junctions are cleaned after tests
  • on a module with fixtures, running pdk test unit a second time has much lower setup time.
  • pdk test clean removes all downloaded or cloned fixtures
Epic Link: PDK Maintenance
Team: Puppet Developer Experience
Release Notes: New Feature
Release Notes Summary: When unit tests are run, any fixtures (symlinks, external module dependencies, etc) defined in the `fixtures.yml` will be downloaded and/or stored in the `spec/fixtures` directory and used for unit tests. Prior this fix, PDK would clean up test fixtures by default after every run of `pdk test unit`. This clean up caused longer test runs because a lot of times, re-downloading fixtures is unnecessary. Calling spec clean has been made optional via the -c or --clean-fixtures flag to `pdk test unit`.

pdk test unit -c
pdk test unit --clean-fixtures
QA Risk Assessment: Needs Assessment


cleaning all fixtures after rake spec (https://github.com/puppetlabs/puppetlabs_spec_helper/commit/3338d0315713f7e7ae2600372ac119f5f9ea0034) causes extra download times, and delays when running spec tests repeatedly.

To solve the original problem in PDK-381, only the directory junctions on windows need cleaning.

See e.g. https://stackoverflow.com/a/46859947/4918

One possibility to solve is to split spec_clean into spec_clean_fast, and spec_clean_all, have spec_clean call both, but use only the _fast variant after tests. With _fast only removing symlinks.

Expose the spec_clean_all command as pdk test clean to remove cloned and downloaded fixtures, too.

Comment by David Schmitt [ 2017/10/25 ]

cc Alex Harvey

Comment by Alex Harvey [ 2017/10/25 ]

Thanks David Schmitt.

Comment by Peter Bittner [ 2017/11/23 ]

Is anyone working on this issue? This is a critical one, it's causing minutes of wasted developer cycles for every single `pdk test unit` run, most noticeable on control repositories (which by nature have lots of dependencies).

Comment by Fredrik [ 2018/05/07 ]

This is a major annoyance with PDK

Comment by David Schmitt [ 2018/05/08 ]

Initial implementation in https://github.com/puppetlabs/puppetlabs_spec_helper/pull/241

Comment by Tim Sharpe [ 2018/05/29 ]

Need to wait on the PR to PSH to get merged and a new release done before I can finish off the acceptance tests for the PDK change.

Comment by Hunter (Hunner) Haugen [ 2018/05/31 ]

PSH 2.8.0 released. Commented on https://github.com/puppetlabs/pdk/pull/515

Generated at Thu Feb 27 16:13:13 PST 2020 using JIRA 7.7.1#77002-sha1:e75ca93d5574d9409c0630b81c894d9065296414.