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

(PDK-636) Make fixture cleaning optional #515

Merged
merged 4 commits into from
Jun 12, 2018
Merged

Conversation

rodjek
Copy link
Contributor

@rodjek rodjek commented May 29, 2018

To make the iterative workflow faster, this (along with puppetlabs/puppetlabs_spec_helper#242) changes the behaviour of pdk test unit so that it doesn't automatically remove the downloaded fixtures after the test run. For CI purposes (or if you really want to slow things down) --clean-fixtures can be passed to pdk test unit to restore the old behaviour.

semirhage :0: pdk/foo (git:master → origin U:2 ?:1!)$ rm -rf spec/fixtures/modules/
semirhage :0: pdk/foo (git:master → origin U:2 ?:1!)$ time ../bin/pdk test unit
pdk (INFO): Using Ruby 2.4.4
pdk (INFO): Using Puppet 5.5.1
[✔] Preparing to run the unit tests.
[✔] Running unit tests.
  Evaluated 4 tests in 0.149583489 seconds: 0 failures, 0 pending.

real	0m32.575s
user	0m8.906s
sys	0m1.328s
semirhage :0: pdk/foo (git:master → origin U:2 ?:1!)$ time ../bin/pdk test unit
pdk (INFO): Using Ruby 2.4.4
pdk (INFO): Using Puppet 5.5.1
[✔] Preparing to run the unit tests.
[✔] Running unit tests.
  Evaluated 4 tests in 0.147905862 seconds: 0 failures, 0 pending.

real	0m9.732s
user	0m6.779s
sys	0m0.782s

@coveralls
Copy link

coveralls commented May 29, 2018

Coverage Status

Coverage decreased (-0.06%) to 92.796% when pulling ba33a29 on rodjek:pdk-636 into 455f488 on puppetlabs:master.

@scotje
Copy link
Contributor

scotje commented May 30, 2018

Looks like there are some spec tests that are expecting the message about fixture cleanup.

@@ -89,7 +89,7 @@ def self.invoke(report, options = {})

result[:exit_code]
ensure
tear_down
tear_down if options[:'clean-fixtures']
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Users forgetting tear-down and then running pdk build would end up bundling their fixtures. Until pdk release prep can clean the fixtures, I would suggest having pdk build run a spec_clean or tear_down or whatever to avoid bundling fixtures.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@hunner good call!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rodjek has this been ticketed so we don't forget to update pdk build? I'm wondering if we should add the fixtures directory to the .pdkignore vs calling something that will change a tagged repo/directory before building.

@scotje
Copy link
Contributor

scotje commented Jun 11, 2018

CI will be blocked on meta-gems release I think?

@rodjek
Copy link
Contributor Author

rodjek commented Jun 11, 2018

Yep

@bmjen bmjen closed this Jun 12, 2018
@bmjen bmjen reopened this Jun 12, 2018
@bmjen bmjen merged commit c9fb0ff into puppetlabs:master Jun 12, 2018
@rodjek rodjek deleted the pdk-636 branch June 13, 2018 07:27
@bmjen bmjen added the feature label Jun 13, 2018
@brettjacobson
Copy link

Please get this Released soon! I have 19 unit tests for my module, which take 10 seconds to execute. But the entire execution takes about 4 minutes, because of prep time downloading the 6 dependent modules. I really want to write more unit tests, but this process is not giving me "fast feedback".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants