-
Notifications
You must be signed in to change notification settings - Fork 580
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1048 from hooten/modules9915
(MODULES-9915) Add type aliases for cloud object store uris
- Loading branch information
Showing
7 changed files
with
150 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
require 'spec_helper' | ||
|
||
if Puppet::Util::Package.versioncmp(Puppet.version, '4.5.0') >= 0 | ||
describe 'Stdlib::ObjectStore::GSUri' do | ||
describe 'accepts case-sensitive google cloud gs uris' do | ||
[ | ||
'gs://mybucket/myfile.csv', | ||
'gs://bucket/path/to/file.tar.gz', | ||
].each do |value| | ||
describe value.inspect do | ||
it { is_expected.to allow_value(value) } | ||
end | ||
end | ||
end | ||
|
||
describe 'rejects other values' do | ||
[ | ||
'', | ||
'GS://mybucket/myfile.csv', | ||
5, | ||
'gs//mybucket/myfile.csv', | ||
'gs:/mybucket/myfile.csv', | ||
'gs:mybucket/myfile.csv', | ||
'gs-mybucket/myfile.csv', | ||
].each do |value| | ||
describe value.inspect do | ||
it { is_expected.not_to allow_value(value) } | ||
end | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
require 'spec_helper' | ||
|
||
if Puppet::Util::Package.versioncmp(Puppet.version, '4.5.0') >= 0 | ||
describe 'Stdlib::ObjectStore::S3Uri' do | ||
describe 'accepts case-sensitive amazon web services s3 uris' do | ||
[ | ||
's3://bucket-name/path', | ||
's3://bucket/path/to/file.txt', | ||
].each do |value| | ||
describe value.inspect do | ||
it { is_expected.to allow_value(value) } | ||
end | ||
end | ||
end | ||
|
||
describe 'rejects other values' do | ||
[ | ||
'', | ||
'S3://bucket-name/path', | ||
3, | ||
's3:/bucket-name/path', | ||
's3//bucket-name/path', | ||
's3:bucket-name/path', | ||
's3-bucket-name/path', | ||
].each do |value| | ||
describe value.inspect do | ||
it { is_expected.not_to allow_value(value) } | ||
end | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
require 'spec_helper' | ||
|
||
if Puppet::Util::Package.versioncmp(Puppet.version, '4.5.0') >= 0 | ||
describe 'Stdlib::ObjectStore' do | ||
describe 'accepts case-sensitive google cloud gs or amazon web services s3 uris' do | ||
[ | ||
's3://bucket-name/path', | ||
's3://bucket/path/to/file.txt', | ||
'gs://mybucket/myfile.csv', | ||
'gs://bucket/path/to/file.tar.gz', | ||
].each do |value| | ||
describe value.inspect do | ||
it { is_expected.to allow_value(value) } | ||
end | ||
end | ||
end | ||
|
||
describe 'rejects other values' do | ||
[ | ||
'', | ||
'S3://bucket/path', | ||
'GS://bucket/path', | ||
5, | ||
3, | ||
'gs//bucket/path/to/file', | ||
's3//bucket/path/to/file', | ||
].each do |value| | ||
describe value.inspect do | ||
it { is_expected.not_to allow_value(value) } | ||
end | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
type Stdlib::ObjectStore = Variant[ | ||
Stdlib::ObjectStore::GSUri, | ||
Stdlib::ObjectStore::S3Uri, | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
type Stdlib::ObjectStore::GSUri = Pattern[/^gs:\/\//] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
type Stdlib::ObjectStore::S3Uri = Pattern[/^s3:\/\//] |