File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -413,6 +413,90 @@ Unacceptable input example:
413413/usr2/username/bin:/usr/local/bin:/usr/bin:.
414414` ` `
415415
416+ # ### `Stdlib::Port`
417+
418+ Matches a valid TCP/UDP Port number
419+
420+ Acceptable input examples:
421+
422+ ` ` ` shell
423+ 80
424+
425+ 443
426+
427+ 1337
428+
429+ 65000
430+ ` ` `
431+
432+ Unacceptable input example:
433+
434+ ` ` ` shell
435+ -1
436+
437+ 65536
438+
439+ ' 443'
440+
441+ ' https'
442+ ` ` ` `
443+
444+ # ### `Stdlib::Privilegedport`
445+
446+ Matches a valid TCP/UDP Pivlaged port i.e. < 1024
447+
448+ Acceptable input examples:
449+
450+ ` ` ` shell
451+ 80
452+
453+ 443
454+
455+ 1023
456+ ```
457+
458+ Unacceptable input example:
459+
460+ ``` shell
461+ -1
462+
463+ 1337
464+
465+ ' 443'
466+
467+ ' https'
468+ ```
469+
470+ #### ` Stdlib::Unprivilegedport `
471+
472+ Matches a valid TCP/UDP Pivlaged port i.e. >= 1024
473+
474+ Acceptable input examples:
475+
476+ ``` shell
477+ 1024
478+
479+ 1337
480+
481+ 65000
482+ ```
483+
484+ Unacceptable input example:
485+
486+ ``` shell
487+ -1
488+
489+ 80
490+
491+ 443
492+
493+ 1023
494+
495+ ' 443'
496+
497+ ' https'
498+ ```
499+
416500### Facts
417501
418502#### ` package_provider `
Original file line number Diff line number Diff line change 1+ require 'spec_helper'
2+
3+ if Puppet ::Util ::Package . versioncmp ( Puppet . version , '4.5.0' ) >= 0
4+ describe 'Stdlib::Port' do
5+ describe 'valid ports' do
6+ [
7+ 80 ,
8+ 443 ,
9+ 1337 ,
10+ 65_000 ,
11+ ] . each do |value |
12+ describe value . inspect do
13+ it { is_expected . to allow_value ( value ) }
14+ end
15+ end
16+ end
17+
18+ describe 'invalid path handling' do
19+ context 'garbage inputs' do
20+ [
21+ nil ,
22+ [ nil ] ,
23+ [ nil , nil ] ,
24+ { 'foo' => 'bar' } ,
25+ { } ,
26+ '' ,
27+ 'https' ,
28+ '443' ,
29+ -1 ,
30+ 65_536 ,
31+ ] . each do |value |
32+ describe value . inspect do
33+ it { is_expected . not_to allow_value ( value ) }
34+ end
35+ end
36+ end
37+ end
38+ end
39+ end
Original file line number Diff line number Diff line change 1+ require 'spec_helper'
2+
3+ if Puppet ::Util ::Package . versioncmp ( Puppet . version , '4.5.0' ) >= 0
4+ describe 'Stdlib::Privilegedport' do
5+ describe 'valid ports' do
6+ [
7+ 80 ,
8+ 443 ,
9+ 1023 ,
10+ ] . each do |value |
11+ describe value . inspect do
12+ it { is_expected . to allow_value ( value ) }
13+ end
14+ end
15+ end
16+
17+ describe 'invalid path handling' do
18+ context 'garbage inputs' do
19+ [
20+ nil ,
21+ [ nil ] ,
22+ [ nil , nil ] ,
23+ { 'foo' => 'bar' } ,
24+ { } ,
25+ '' ,
26+ 'https' ,
27+ '443' ,
28+ -1 ,
29+ 1337 ,
30+ 1024 ,
31+ ] . each do |value |
32+ describe value . inspect do
33+ it { is_expected . not_to allow_value ( value ) }
34+ end
35+ end
36+ end
37+ end
38+ end
39+ end
Original file line number Diff line number Diff line change 1+ require 'spec_helper'
2+
3+ if Puppet ::Util ::Package . versioncmp ( Puppet . version , '4.5.0' ) >= 0
4+ describe 'Stdlib::Unprivilegedport' do
5+ describe 'valid unprivilegedport' do
6+ [
7+ 1024 ,
8+ 1337 ,
9+ 65_000 ,
10+ ] . each do |value |
11+ describe value . inspect do
12+ it { is_expected . to allow_value ( value ) }
13+ end
14+ end
15+ end
16+
17+ describe 'invalid path handling' do
18+ context 'garbage inputs' do
19+ [
20+ nil ,
21+ [ nil ] ,
22+ [ nil , nil ] ,
23+ { 'foo' => 'bar' } ,
24+ { } ,
25+ '' ,
26+ 'https' ,
27+ '443' ,
28+ -1 ,
29+ 80 ,
30+ 443 ,
31+ 1023 ,
32+ ] . each do |value |
33+ describe value . inspect do
34+ it { is_expected . not_to allow_value ( value ) }
35+ end
36+ end
37+ end
38+ end
39+ end
40+ end
Original file line number Diff line number Diff line change 1+ type Stdlib::Port = Integer[0 , 65535 ]
Original file line number Diff line number Diff line change 1+ type Stdlib::Privilegedport = Integer[1 , 1023 ]
Original file line number Diff line number Diff line change 1+ type Stdlib::Unprivilegedport = Integer[1024 , 65535 ]
You can’t perform that action at this time.
0 commit comments