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

(maint) mergeup from 1.6.x: desc/docs cleanup #178

Closed
wants to merge 8 commits into from

Conversation

DavidS
Copy link
Contributor

@DavidS DavidS commented May 30, 2019

This merges up the changes from #177 and moves the bits around into the new classes of BaseTypeDefinition and friends.

It also contains backported fixes that were already merged to master earlier and additional test fixes.

bolt's `get_resources` uses the `libexec/query_resources.rb` to retrieve
resources as json from the target nodes. Especially https://github.com/puppetlabs/bolt/blob/7dec6e49d66c7f9ae06088d46ee3330de0ed2fed/libexec/query_resources.rb#L71
causes `ResourceShims` to fail as they did not implement `to_json`.

This integration test models what `libexec/query_resources.rb` is doing.
The added `to_json(*)` method now passes this test, and - shown in manual
testing - works for bolt.
@DavidS
Copy link
Contributor Author

DavidS commented Jun 12, 2019

need to rebuild after #184 and #177 get merged

willmeek and others added 4 commits June 12, 2019 16:24
(maint) backport minor fixes from master to 1.6.x
This implements the changes specified in puppetlabs/puppet-specifications#141

> The text and examples have been inconsistent with how `desc` vs `docs`
> has been handled. This change fixes the text and examples to all show
> and require `desc`, but accept `docs` in places where we showed it
> previously.
…k-1.6.x

(maint) implement `desc`/`docs` fallback
@DavidS DavidS changed the title (maint) desc/docs mergeup from 1.6.x (maint) mergeup from 1.6.x Jun 12, 2019
@DavidS DavidS added bug maintenance Maintenance (PDK sync and other maintaining commits) labels Jun 12, 2019
@DavidS DavidS changed the title (maint) mergeup from 1.6.x (maint) mergeup from 1.6.x: desc/docs, to_json, build improvements Jun 12, 2019
@DavidS DavidS changed the title (maint) mergeup from 1.6.x: desc/docs, to_json, build improvements (maint) mergeup from 1.6.x: desc/docs cleanup Jun 12, 2019
Without this the `provider` mock would leak between tests.
Before the fix:
```
david@davids:~/git/puppet-resource_api$ SPEC_OPTS="--exclude-pattern spec/\{fixtures/\*\*/\*.rb,fixtures/modules/\*/\*\*/\*.rb\}" bundle exec rspec ./spec/puppet/resource_api/transport_spec.rb[1:4:2:1] ./spec/puppet/resource_api_spec.rb[1:16:2:1] --seed 40589 -fd
Run options: include {:ids=>{"./spec/puppet/resource_api/transport_spec.rb"=>["1:4:2:1"], "./spec/puppet/resource_api_spec.rb"=>["1:16:2:1"]}}

Randomized with seed 40589

Puppet::ResourceApi::Transport
  #inject_device(name, transport)
    when puppet does not have set_device
      wraps the transport and sets it as current in NetworkDevice

Puppet::ResourceApi
  #load_provider
    when loading a provider that doesn't create the correct class
      should raise Puppet::DevError with message matching /provider class Puppet::Provider::NoClass::NoClass not found/ (FAILED - 1)

Failures:

  1) Puppet::ResourceApi#load_provider when loading a provider that doesn't create the correct class should raise Puppet::DevError with message matching /provider class Puppet::Provider::NoClass::NoClass not found/
     Failure/Error: it { expect { described_class.load_provider('no_class') }.to raise_error Puppet::DevError, %r{provider class Puppet::Provider::NoClass::NoClass not found} }

       expected Puppet::DevError with message matching /provider class Puppet::Provider::NoClass::NoClass not found/, got #<Puppet::DevError: Found neither the device-specific provider class Puppet::Provider::NoClass::Mocks... the generic provider class Puppet::Provider::NoClass::NoClass in puppet/provider/no_class/no_class> with backtrace:
         # ./lib/puppet/resource_api.rb:437:in `rescue in load_provider'
         # ./lib/puppet/resource_api.rb:416:in `load_provider'
         # ./spec/puppet/resource_api_spec.rb:1202:in `block (5 levels) in <top (required)>'
         # ./spec/puppet/resource_api_spec.rb:1202:in `block (4 levels) in <top (required)>'
     # ./spec/puppet/resource_api_spec.rb:1202:in `block (4 levels) in <top (required)>'

Finished in 0.05427 seconds (files took 0.94482 seconds to load)
2 examples, 1 failure

Failed examples:

rspec ./spec/puppet/resource_api_spec.rb:1202 # Puppet::ResourceApi#load_provider when loading a provider that doesn't create the correct class should raise Puppet::DevError with message matching /provider class Puppet::Provider::NoClass::NoClass not found/

Randomized with seed 40589

david@davids:~/git/puppet-resource_api$
```

After the fix:
```
david@davids:~/git/puppet-resource_api$ SPEC_OPTS="--exclude-pattern spec/\{fixtures/\*\*/\*.rb,fixtures/modules/\*/\*\*/\*.rb\}" bundle exec rspec ./spec/puppet/resource_api/transport_spec.rb[1:4:2:1] ./spec/puppet/resource_api_spec.rb[1:16:2:1] --seed 40589 -fd
Run options: include {:ids=>{"./spec/puppet/resource_api/transport_spec.rb"=>["1:4:2:1"], "./spec/puppet/resource_api_spec.rb"=>["1:16:2:1"]}}

Randomized with seed 40589

Puppet::ResourceApi::Transport
  #inject_device(name, transport)
    when puppet does not have set_device
      wraps the transport and sets it as current in NetworkDevice

Puppet::ResourceApi
  #load_provider
    when loading a provider that doesn't create the correct class
      should raise Puppet::DevError with message matching /provider class Puppet::Provider::NoClass::NoClass not found/

Finished in 0.03734 seconds (files took 0.95637 seconds to load)
2 examples, 0 failures

Randomized with seed 40589

david@davids:~/git/puppet-resource_api$

```
@DavidS
Copy link
Contributor Author

DavidS commented Jun 13, 2019

This is now passing local testing. I'll tear it apart for easier merging tonight or tomorrow. There is still too much testing cr*p going on for me to be 100% confident in the changes.

@DavidS
Copy link
Contributor Author

DavidS commented Jun 13, 2019

Updated #175 and created #185 with issues uncovered here. Part of the confusion is that master --not 1.6.x already has the random test change since an accident back in #142 . If this is continuing to be a blocker for the merge back I'll revert the .rspec seed change and schedule some cleanup work for later.

@DavidS
Copy link
Contributor Author

DavidS commented Jun 14, 2019

Superseded by #186

@DavidS DavidS closed this Jun 14, 2019
@DavidS DavidS deleted the maint-desc-docs-fallback branch June 14, 2019 08:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug maintenance Maintenance (PDK sync and other maintaining commits)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant