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

Run test Puppet5.5 #1

Closed
wants to merge 46 commits into from
Closed

Run test Puppet5.5 #1

wants to merge 46 commits into from

Conversation

b4ldr
Copy link
Owner

@b4ldr b4ldr commented Apr 16, 2021

run test

b4ldr and others added 30 commits February 4, 2021 11:45
Add new type to validate emails.  The regex has been taken from the
[html5 spec][1]

[1]: https://html.spec.whatwg.org/multipage/input.html#valid-e-mail-address
Prior to this commit, the `spec/functions/shell_join_spec.rb` tests
were failing on Ruby 2.7 as the `Shellwords.shelljoin` method in
2.7 does not escape the `+` character.

Rather than have specific datasets for Ruby versions `< 2.7` and
`>= 2.7`, it seemed easiest to simply remove this character from
the tests.
In the context of Puppet 7 there are two subsequent calls to
File.read from the catalog generated from the tests of `loadjson_spec.rb`
and `load_module_metadata_spec.rb`

Prior to this commit, these calls were causing exceptions from
RSpec as the mock expectations for File.read were being thrown off.

This did not manifest on Puppet 5 or 6.

After this commit, any calls to File.read that do not conform to
the expected arguments we want to mock a response for, are passed
through to File.read.
…ix_up_r27_spec_failures

(IAC-1228) Fix multiple spec test issues in Ruby 2.7
Prior to this commit, on Ruby 2.7, the range() method would NOT
throw an ArgumentError exception if it was passed an invalid value as the
step size (3rd arg). Instead, it would return an array of size
1,000,000 with repeated integer values of the 2nd arg.

The function invokes Ruby's in built range method and `step` to
define a step size to increment / decrement by  and then passes the
output to `first`, limiting to the first 1,000,000 values.

On Ruby < 2.7, `step` would throw an `ArgumentError` if the step
size passed was `0`:

```
1..2).step(0).first(1_000_000).to_a
Traceback (most recent call last):
        5: from ~/.rvm/rubies/ruby-2.5.8/bin/irb:11:in `<main>'
        4: from (irb):7
        3: from (irb):7:in `first'
        2: from (irb):7:in `each'
        1: from (irb):7:in `step'
ArgumentError (step can't be 0)
```

However, on Ruby 2.7, the `step` method returns an Enumerator that
will then subsequently generate an Array of the size specified when
passed to `first`, made up of the 2nd arg value (last):

```
(1..2).step(0).first(10).to_a
 => [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
```

This is an issue, as the 3rd arg is passed to `to_i`, which then
becomes the step size. For any values that cannot be converted to
a positive / negative (or legit 0) Integer, a 0 is returned.

This commit will perform a check on the value of `step` and throw
an ArgumentError if it is not zero.
…ix_range_invalid_step_arg

(IAC-1414) Throw error in range() function when step size invalid
(bugfix) Setting stricter email validation
…_pdk_template_rubocop

Update to puppet-module-gems 1.0, pdk-templates and new rubocop
…/deprecate_rhel_5_family

pdksync - (MAINT) Remove RHEL 5 family support
…/deprecate_sles11

pdksync - (MAINT) Remove SLES 11 support
…/perform_pdk_update

pdksync - (MAINT) PDK update for GHA workflows + Litmus updates
…pet5

pdksync - Remove Puppet 5 from testing and bump minimal version to 6.0.0
@b4ldr b4ldr closed this Apr 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants