Commit Graph

17 Commits

Author SHA1 Message Date
Takashi Kajinami 1317af56d4 Remove usage of deleted manifest_dir
Recent update in rspec-puppet removed some of the config interfaces for
old puppet versions[1]. This drops usage of these interfaces to resolve
the following error in unit tests.

```
An error occurred while loading ./spec/unit/provider/manila_spec.rb.
Failure/Error: c.manifest_dir = File.join(fixture_path, 'manifests')

NoMethodError:
  undefined method `manifest_dir='...
```

This also removes explicit setting of mock module. The definition is
no longer required since we bumped puppetlabs_spec_helper to v 5.0.0.

[1] 316d95923c

Change-Id: I3077eed14d4e4e2e29cb947ec4ec1fa06abd6229
2023-10-11 11:59:09 +09:00
Takashi Kajinami 7b9c00a1d2 Replace mocha by rspec-mocks
puppetlabs_spec_helper recommends rspec-mocks instead of mocha[1] and
it uses rspec-mocks by default instead of mocha since v 5.0.0[2]

This is the prep work to adapt to that migration.

[1] https://github.com/puppetlabs/puppetlabs_spec_helper/#mock_with
[2] 493f0cbc1c

Closes-Bug: #2004135
Change-Id: I3c6ee8bb85efcb2169a0248ce11e750991799d63
2023-01-30 13:32:08 +09:00
Takashi Kajinami 49c562d390 Load libraries in a single place
This change refactors how the dependent libraries are loaded during
unit tests, and load the libraries in the base spec_helper to avoid
duplicate and redundant implementations.

Change-Id: I92ba82bfba4ab4e47e0f704ea71433cd98fc03d2
2021-12-27 10:37:07 +09:00
Takashi Kajinami a556783d37 Set fixture paths for unit tests
This change defines manifest_dir and module_path expicitly in unit
tests so that modules installed under fixtures directory is properly
loaded.

Closes-Bug: #1930403
Change-Id: I83fd4739397ce8c4b4ec3f806b5a91fb10867caf
2021-06-02 14:07:17 +09:00
Alex Schultz 3468d0fa21 Move rspec-puppet-facts to spec helper
This change updates the module to use the rspec-puppet-facts as defined
in the puppet-openstack_spec_helper.

Change-Id: Ia38009a890b0e11fa90f7747e82fd10bd7fe1954
2016-09-30 13:18:28 -06:00
Emilien Macchi 28bcf83e14 drop mock dependency
mock is not used anywhere in the module, let's drop it.
This patch will help to hit this bug:
https://launchpad.net/bugs/1492636

Change-Id: I427b83d65ac850329e227310a2e3888d5c8c5cd1
2016-01-22 09:39:26 -05:00
Denis Egorenko 258b1905da Use openstack spec helper for spec defaults
* Add puppet-openstack_spec_helper to Gemfile
* Use puppet-openstack_spec_helper/defaults in spec_helper
* Delete spec/defaults.rb, useless now

Change-Id: Ic30d5f0a4e9e4674b378bb74c140dc7b5d81f7b4
2016-01-14 21:04:15 +03:00
Alex Schultz c9f7cbc8b5 Update to pull in rspec-puppet-facts
Change-Id: Ic591dff6d2927a027f29970e6b18020dc589ce7f
2016-01-06 21:28:07 -07:00
Mykyta Karpin acd95e6a3a Add support of os_service_default fact in glance spec
This change adds possibility to use the os_service_default
   fact for configuration options that default to '<SERVICE DEFAULT>'.
   this change is done by analogy with cinder
   commit 667e6c0850672dbbf99381eb92468f95e5591913

Change-Id: Ie5c8909bcc1c9a6a7a9ab1b59eec4637751ffd74
2015-11-20 12:53:35 +00:00
Cody Herriges 6ea3194989 Initial msync run for all Puppet OpenStack modules
This patch is the initial modulesync run, it impacts:

* gitignore: just a sync between projects
* gemfile:
  - update and allow to setup facter version and gem source
  - split beaker gems with a dedicated group
  - switch to rspec-puppet 2.2.0
* rakefile:
  - use the new syntax for lint configuration
  - add a acceptance target
* acceptance:
  - sync nodesets
* spec: added rspec coverage report

Change-Id: I05e2e4c13bd264c65fad8bade1886e23a50184d9
2015-09-04 21:16:12 +00:00
Colleen Murphy 39b58df7a8 Use OpenstackClient for glance_image auth
This patch changes the glance_image provider to use
puppet-openstacklib's authentication methods, which use
python-openstackclient as an interface, instead of the glance command
line client. The benefits of this is:

- Code reduction. This patch reduces the amount of code in the
  glance parent provider and glance_image provider by reusing code from
  Puppet::Provider::Openstack instead of implementing authentication,
  retries, and response parsing in the provider.
- Presumed reduction in sudden API changes that require quick fixes in
  this module, such as f377c0229c.
- Ability to set project-based access control for images

Additional reasoning for this change is in the blueprint.

Important note: this change does not work on Ubuntu under Juno due to a
major bug in the version of python-openstackclient shipped in UCA [1].
This change targets the Kilo releases.

Note about performance: the self.instances and instances methods make
API requests for each image found in the list of instances. This is not
a change from how this was implemented before. The --long formatted
list, either from the glance client or openstackclient, does not
provide all information needed to query an instance and populate
setters. Future patches could possibly improve on this.

Other details of this change:

- Removes auth_glance method, replaced by the request and
  glance_request methods
- Removes auth_glance_stdin method which was not being used
- Removes parse_table which is now unnecessary because openstackclient
  formats its responses as CSV and Puppet::Provider::Openstack#request
  returns the results a hash
- Removes remove_warnings methods which are handled by
  Puppet::Provider::Openstack#request
- Removes list_glance_images and get_glance_image_attr which are
  sufficiently replaced by using the 'list' and 'show' commands with
  Puppet::Provider::Openstack's request method.
- Removed self.prefetch since we can't populate auth parameters during
  a prefetch. Instead we prepopulate the list via the instances method.
- Added a flush method to do updates more efficiently
- Changed is_public property to accept true/false in addition to yes/no
  and to munge to a symbol instead of a capitalized string, for
  consistency with keystone_tenant's enabled property
- Move the reset method into the spec tests since it is only necessary
  for testing
- Added tests for glance_image, which did not exist before
- Removed connection retry test since this is taken care of in
  openstacklib

[1] https://bugs.launchpad.net/python-openstackclient/+bug/1269821

blueprint use-openstackclient-in-module-resources

Change-Id: Iceab5e1c6138e7aba0f883ed4acb8f7ecbcd2830
2015-06-29 17:35:23 -07:00
Sebastien Badia dbe297b056 spec: updates for rspec-puppet 2.x and rspec 3.x
This patch aim to update our specs test in order to work with the rspec-puppet release
2.0.0, in the mean time, we update rspec syntax in order to be prepared
for rspec 3.x move.

In details:

  * Use shared_examples "a Puppet::Error" for puppet::error tests
  * Convert 'should' keyword to 'is_expected.to' (prepare rspec 3.x)
  * Fix spec tests for rspec-puppet 2.0.0
  * Upgrade and pin rspec-puppet from 1.0.1 to 2.0.0
  * Clean Gemfile (remove over-specificication of runtime deps of puppetlabs_spec_helper)

Change-Id: Ibd0333dc3c0959e846edfbad51fb48e8dfb8fbe9
Card: https://trello.com/c/eHXc1Ryd/4-investigate-the-necessary-change-to-be-rspec-puppet-2-0-0-compliant
2015-02-25 05:37:44 +01:00
Emilien Macchi eb7c33bb1f Add Cinder backend to image store
Cinder is an potiential backend in Glance.
This patchs aims to:
- create glance::backend::cinder
- improve spec_helper using shared_examples

Change-Id: I15e5de8281ff2e60465fedda97d9c9ccf808386c
Signed-off-by: Emilien Macchi <emilien.macchi@enovance.com>
2013-12-03 13:29:51 +01:00
Branan Purvine-Riley ecc5a2d605 Switch to using the puppetlabs_spec_helper gem for common files instead of duplicating code 2012-05-31 15:33:11 -07:00
Branan Purvine-Riley 0b0bf5adcd Add files for CI support
These changes make it easier for both humans and computers to run the spec tests

* Add `rake spec_full` and friends, which automatically checkout dependency modules
  prior to running spec tests
* Prepend fixtures modulepath instead of overriding
* Add a Travis-CI configuration file to enable easy CI
2012-05-29 09:50:13 -07:00
Dan Bode 0a400dcc6a Add rspec tests
This commit resolves failing tests from
glance::api and glance::registry related to recent
refactors.

It also adds tests for all of the new api fragment
classes/defines.
2012-03-31 16:09:29 -07:00
Dan Bode 4fa5d3f046 (#11692) Add unit tests
This commit adds full test coverage for all manifests
in the glance repo.
2012-01-03 11:27:43 -08:00