-
Notifications
You must be signed in to change notification settings - Fork 290
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
Create a reference implementation for provider spec tests #759
Labels
Comments
jeffmccune
added a commit
to jeffmccune/sensu-puppet
that referenced
this issue
Jul 19, 2017
Without this patch there are no rspec examples of how providers should behave. This is a problem because there should be a reference to build from when changing the providers. This patch addresses the problem by adding rspec coverage for the sensu_check_config json provider. Resolves sensu#759
jeffmccune
added a commit
to jeffmccune/sensu-puppet
that referenced
this issue
Jul 19, 2017
Without this patch there are no rspec examples of how providers should behave. This is a problem because there should be a reference to build from when changing the providers. This patch addresses the problem by adding rspec coverage for the sensu_check_config json provider. Resolves sensu#759
jeffmccune
added a commit
to jeffmccune/sensu-puppet
that referenced
this issue
Jul 20, 2017
Without this patch there are no rspec examples of how providers should behave. This is a problem because there should be a reference to build from when changing the providers. This patch addresses the problem by adding rspec coverage for the sensu_check_config json provider. Resolves sensu#759
jeffmccune
added a commit
to jeffmccune/sensu-puppet
that referenced
this issue
Jul 20, 2017
Without this patch there are no rspec examples of how providers should behave. This is a problem because there should be a reference to build from when changing the providers. This patch addresses the problem by adding rspec coverage for the sensu_check_config json provider. Resolves sensu#759
jeffmccune
added a commit
to jeffmccune/sensu-puppet
that referenced
this issue
Jul 21, 2017
Without this patch there are no rspec examples of how providers should behave. This is a problem because there should be a reference to build from when changing the providers. This patch addresses the problem by adding rspec coverage for the sensu_check_config json provider. Resolves sensu#759
jeffmccune
added a commit
to jeffmccune/sensu-puppet
that referenced
this issue
Jul 21, 2017
jeffmccune
added a commit
to jeffmccune/sensu-puppet
that referenced
this issue
Jul 21, 2017
Without this patch there are no spec tests for the sensu_check JSON provider. This is problem because a reference is needed to specify the expected behavior of all providers. This patch implements a pattern of stubbing out the filesystem. All reads and writes in the provider itself are routed through the `read_file` and `write_json_object` methods. The RSpec tests then use rspec-mocks to stub out the reads and set expectations on the output. This reference may be applied to any provider using the `flush` method. The setter methods in the provider for each property are expected to update state in an instance variable, conventionally named @property_flush but named @conf in the sensu_check provider. The flush method is responsible for writing out @property_flush (@conf), which we intercept and set expectations on the data provided. Resolves sensu#759
jeffmccune
added a commit
to jeffmccune/sensu-puppet
that referenced
this issue
Jul 21, 2017
Without this patch there are no spec tests for the sensu_check JSON provider. This is problem because a reference is needed to specify the expected behavior of all providers. This patch implements a pattern of stubbing out the filesystem. All reads and writes in the provider itself are routed through the `read_file` and `write_json_object` methods. The RSpec tests then use rspec-mocks to stub out the reads and set expectations on the output. This reference may be applied to any provider using the `flush` method. The setter methods in the provider for each property are expected to update state in an instance variable, conventionally named @property_flush but named @conf in the sensu_check provider. The flush method is responsible for writing out @property_flush (@conf), which we intercept and set expectations on the data provided. Resolves sensu#759
jeffmccune
added a commit
to jeffmccune/sensu-puppet
that referenced
this issue
Jul 21, 2017
Without this patch there are no spec tests for the sensu_check JSON provider. This is problem because a reference is needed to specify the expected behavior of all providers. This patch implements a pattern of stubbing out the filesystem. All reads and writes in the provider itself are routed through the `read_file` and `write_json_object` methods. The RSpec tests then use rspec-mocks to stub out the reads and set expectations on the output. This reference may be applied to any provider using the `flush` method. The setter methods in the provider for each property are expected to update state in an instance variable, conventionally named @property_flush but named @conf in the sensu_check provider. The flush method is responsible for writing out @property_flush (@conf), which we intercept and set expectations on the data provided. Resolves sensu#759
jeffmccune
added a commit
to jeffmccune/sensu-puppet
that referenced
this issue
Jul 21, 2017
Without this patch there are no spec tests for the sensu_check JSON provider. This is problem because a reference is needed to specify the expected behavior of all providers. This patch implements a pattern of stubbing out the filesystem. All reads and writes in the provider itself are routed through the `read_file` and `write_json_object` methods. The RSpec tests then use rspec-mocks to stub out the reads and set expectations on the output. This reference may be applied to any provider using the `flush` method. The setter methods in the provider for each property are expected to update state in an instance variable, conventionally named @property_flush but named @conf in the sensu_check provider. The flush method is responsible for writing out @property_flush (@conf), which we intercept and set expectations on the data provided. Resolves sensu#759
jeffmccune
added a commit
to jeffmccune/sensu-puppet
that referenced
this issue
Jul 21, 2017
Without this patch there are no spec tests for the sensu_check JSON provider. This is problem because a reference is needed to specify the expected behavior of all providers. This patch implements a pattern of stubbing out the filesystem. All reads and writes in the provider itself are routed through the `read_file` and `write_json_object` methods. The RSpec tests then use rspec-mocks to stub out the reads and set expectations on the output. This reference may be applied to any provider using the `flush` method. The setter methods in the provider for each property are expected to update state in an instance variable, conventionally named @property_flush but named @conf in the sensu_check provider. The flush method is responsible for writing out @property_flush (@conf), which we intercept and set expectations on the data provided. Resolves sensu#759
jeffmccune
added a commit
to jeffmccune/sensu-puppet
that referenced
this issue
Jul 21, 2017
Without this patch there are no spec tests for the sensu_check JSON provider. This is problem because a reference is needed to specify the expected behavior of all providers. This patch implements a pattern of stubbing out the filesystem. All reads and writes in the provider itself are routed through the `read_file` and `write_json_object` methods. The RSpec tests then use rspec-mocks to stub out the reads and set expectations on the output. This reference may be applied to any provider using the `flush` method. The setter methods in the provider for each property are expected to update state in an instance variable, conventionally named @property_flush but named @conf in the sensu_check provider. The flush method is responsible for writing out @property_flush (@conf), which we intercept and set expectations on the data provided. Resolves sensu#759
jeffmccune
added a commit
to jeffmccune/sensu-puppet
that referenced
this issue
Jul 25, 2017
Without this patch there are no spec tests for the sensu_check JSON provider. This is problem because a reference is needed to specify the expected behavior of all providers. This patch implements a pattern of stubbing out the filesystem. All reads and writes in the provider itself are routed through the `read_file` and `write_json_object` methods. The RSpec tests then use rspec-mocks to stub out the reads and set expectations on the output. This reference may be applied to any provider using the `flush` method. The setter methods in the provider for each property are expected to update state in an instance variable, conventionally named @property_flush but named @conf in the sensu_check provider. The flush method is responsible for writing out @property_flush (@conf), which we intercept and set expectations on the data provided. N.B. There is a bug with Rspec where the expected and actual values of multi-line strings will not have a nice diff output if the two strings disagree on the presence of the trailing newline. See rspec/rspec-support#70 for more information. Because of this issue in combination with the use of IO#puts in the write_output class method, care should be taken with the examples to make sure the expected and actual values agree on the trailing newline. In this patch, the fixture data for the expected output is chomp()'ed to match the string passed to write_output(). Resolves sensu#759
ghoneycutt
added a commit
that referenced
this issue
Jul 25, 2017
(#759) Add reference spec tests for sensu_check JSON provider
|
Thank you! This will really help us expand the provider testing. Released in v2.28.0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The sensu module does a great job of exercising the behavior of Puppet classes, defined types, and the native types in the module. The providers lack test coverage, however.
The goal of this issue is to create a reference implementation of spec tests covering the behavior of the
sensu_checkprovider and thecustomproperty specifically. These spec tests will serve as a foundation to build spec tests for other providers.The custom property has been chosen because it accepts an arbitrary map which is merged with the other properties. This behavior is related to how all types in this module could become compatible with arbitrary attributes added in the future.
The text was updated successfully, but these errors were encountered: