configuration_service 1.1.2 → 1.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/{configuration_service.gemspec → .gemspec} +3 -2
- data/Gemfile.lock +1 -1
- data/features/authorization.feature +45 -0
- data/features/bootstrapping.feature +13 -0
- data/features/consuming.feature +42 -0
- data/features/publishing.feature +42 -0
- data/features/step_definitions/authorization_steps.rb +63 -0
- data/features/step_definitions/bootstrapping_steps.rb +15 -0
- data/features/step_definitions/consuming_steps.rb +63 -0
- data/features/step_definitions/publishing_steps.rb +60 -0
- data/features/support/env.rb +11 -0
- data/lib/configuration_service/factory/environment_context.rb +1 -1
- data/lib/configuration_service/version.rb +5 -0
- data/lib/configuration_service.rb +1 -0
- metadata +12 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: de4118ee11bfbd8f76259b05fbda31dbf481299c
|
4
|
+
data.tar.gz: 26fba382d4d73c3a0c21d1f075283b5d273812ed
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7d59aed18c4849e4a52d32903a39a1035e4fbde97d408a5740a05e094e67e7bacd811c048e226b15e1e4a981fed0cddee5d325146f31b534feecc9ca874464ba
|
7
|
+
data.tar.gz: af4b66d5b7617316b8f12fd5be263261b4caa891fb3f0c59dadfbd188a760dfc4b95b1ba007cd78de896123b3c4bd30feddc7c9034b307acf9e5ba92aad950ea
|
@@ -1,10 +1,11 @@
|
|
1
1
|
# coding: utf-8
|
2
2
|
lib = File.expand_path('../lib', __FILE__)
|
3
3
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require "configuration_service/version"
|
4
5
|
|
5
6
|
Gem::Specification.new do |spec|
|
6
7
|
spec.name = "configuration_service"
|
7
|
-
spec.version =
|
8
|
+
spec.version = ConfigurationService::VERSION
|
8
9
|
spec.authors = ["Sheldon Hearn"]
|
9
10
|
spec.email = ["sheldonh@starjuice.net"]
|
10
11
|
|
@@ -12,7 +13,7 @@ Gem::Specification.new do |spec|
|
|
12
13
|
spec.description = %q{Configuration service}
|
13
14
|
spec.homepage = "https://github.com/hetznerZA/configuration_service"
|
14
15
|
|
15
|
-
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec
|
16
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec)/}) }
|
16
17
|
spec.bindir = "exe"
|
17
18
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
18
19
|
spec.require_paths = ["lib"]
|
data/Gemfile.lock
CHANGED
@@ -0,0 +1,45 @@
|
|
1
|
+
Feature: Authorization
|
2
|
+
In order to ensure I am who I say I am
|
3
|
+
As a CS Client
|
4
|
+
I want to be authenticated
|
5
|
+
|
6
|
+
Scenario: Token request with no credentials
|
7
|
+
Given I have no credentials
|
8
|
+
When I request a token
|
9
|
+
Then I should not receive a token
|
10
|
+
|
11
|
+
Scenario: Token request with invalid credentials
|
12
|
+
Given I have invalid credentials
|
13
|
+
When I request a token
|
14
|
+
Then I should not receive a token
|
15
|
+
|
16
|
+
Scenario: Token request with valid credentials
|
17
|
+
Given I have valid credentials
|
18
|
+
When I request a token
|
19
|
+
Then I should receive a token
|
20
|
+
|
21
|
+
Scenario: Allowed request
|
22
|
+
Given I have a token that allows requesting configurations
|
23
|
+
When I request a configuration
|
24
|
+
Then I should be allowed to request configurations
|
25
|
+
|
26
|
+
Scenario: Denied request
|
27
|
+
Given I have a token that does not allow requesting configurations
|
28
|
+
When I request a configuration
|
29
|
+
Then I should be notified that my request is 'not authorized'
|
30
|
+
|
31
|
+
Scenario: Allowed publication
|
32
|
+
Given I have a token that allows publishing configurations
|
33
|
+
When I request publication of a configuration
|
34
|
+
Then I should be allowed to publish configurations
|
35
|
+
|
36
|
+
Scenario: Denied publication
|
37
|
+
Given I have a token that does not allow publishing configurations
|
38
|
+
When I request publication of a configuration
|
39
|
+
Then I should be notified that my request is 'not authorized'
|
40
|
+
|
41
|
+
Scenario: Token-less request
|
42
|
+
Given I do not have a token
|
43
|
+
When I request a configuration
|
44
|
+
Then I should be notified that my request is 'not authorized'
|
45
|
+
|
@@ -0,0 +1,13 @@
|
|
1
|
+
Feature: Bootstrapping
|
2
|
+
|
3
|
+
As a service component
|
4
|
+
In order to use the configuration service
|
5
|
+
I want to bootstrap the configuration service.
|
6
|
+
|
7
|
+
Scenario: Environmental bootstrapping
|
8
|
+
|
9
|
+
Given environmental service configuration
|
10
|
+
When I bootstrap the configuration service from the environment
|
11
|
+
Then I receive a functioning configuration service
|
12
|
+
And the environmental service configuration has been scrubbed
|
13
|
+
|
@@ -0,0 +1,42 @@
|
|
1
|
+
Feature: Consuming configuration data
|
2
|
+
In order to access configuration data
|
3
|
+
As a Consumer
|
4
|
+
I want to request access to configuration data
|
5
|
+
|
6
|
+
Scenario: Metadata-free hit
|
7
|
+
Given an identifier
|
8
|
+
And no meta data filter
|
9
|
+
And configuration data at the index is present
|
10
|
+
When I request configuration data
|
11
|
+
Then the configuration data should be returned for the identifier
|
12
|
+
|
13
|
+
Scenario: Metadata-free miss
|
14
|
+
Given an identifier
|
15
|
+
And no meta data filter
|
16
|
+
And configuration data at the index is not present
|
17
|
+
When I request configuration data
|
18
|
+
Then I should receive a 'not found' indication
|
19
|
+
|
20
|
+
Scenario: Identifier-free metadata filter single hit
|
21
|
+
Given a metadata filter
|
22
|
+
And only one entry of configuration data matching the meta data filter is present
|
23
|
+
When I request configuration data
|
24
|
+
Then the configuration data should be returned for the index and meta data filter as the only item
|
25
|
+
|
26
|
+
Scenario: Identifier-free metadata filter multiple hits
|
27
|
+
Given a metadata filter
|
28
|
+
And multiple entries of configuration data matching the meta data filter are present
|
29
|
+
When I request configuration data
|
30
|
+
Then all matching configuration data should be returned
|
31
|
+
|
32
|
+
Scenario: Identifier-free metadata filter miss
|
33
|
+
Given a metadata filter
|
34
|
+
And no entry matching the meta data filter is present
|
35
|
+
When I request configuration data
|
36
|
+
Then I should receive a 'no match' indication
|
37
|
+
|
38
|
+
Scenario: CS request failure
|
39
|
+
Given a CS request failure
|
40
|
+
When I request configuration data
|
41
|
+
Then I should receive a 'request failure' notification
|
42
|
+
|
@@ -0,0 +1,42 @@
|
|
1
|
+
Feature: Publishing configuration data
|
2
|
+
In order to make configuration data available for retrieval
|
3
|
+
As a publisher
|
4
|
+
I want to publish configuration data
|
5
|
+
|
6
|
+
Scenario: Revision added to metadata
|
7
|
+
Given an identifier
|
8
|
+
And some configuration data
|
9
|
+
When I request publication of the configuration data
|
10
|
+
Then I receive a unique revision for my publication
|
11
|
+
And the metadata is updated with the revision by the CS
|
12
|
+
|
13
|
+
Scenario: Metadata saved with data
|
14
|
+
Given an identifier
|
15
|
+
And some metadata
|
16
|
+
And some configuration data
|
17
|
+
When I request publication of the configuration data
|
18
|
+
Then the metadata is also remembered
|
19
|
+
|
20
|
+
Scenario: Timestamp added to metadata
|
21
|
+
Given an identifier
|
22
|
+
And some metadata
|
23
|
+
And some configuration data
|
24
|
+
When I request publication of the configuration data
|
25
|
+
Then the entry is timestamped
|
26
|
+
|
27
|
+
Scenario: New revision for publication to existing identifier
|
28
|
+
Given existing configuration data
|
29
|
+
When I request publication of configuration data using the existing identifier
|
30
|
+
Then I receive a new unique revision for the publication
|
31
|
+
|
32
|
+
Scenario: Invalid data
|
33
|
+
Given an identifier
|
34
|
+
And invalid configuration data
|
35
|
+
When I request publication of the configuration data
|
36
|
+
Then I receive an 'invalid data' notification
|
37
|
+
|
38
|
+
Scenario: CS publication failure
|
39
|
+
Given a CS publication failure
|
40
|
+
When I request publication of the configuration data
|
41
|
+
Then I should receive a 'publication failure' notification
|
42
|
+
|
@@ -0,0 +1,63 @@
|
|
1
|
+
Given(/^I have no credentials$/) do
|
2
|
+
pending "Use case supported by Vault command-line client"
|
3
|
+
end
|
4
|
+
|
5
|
+
When(/^I request a token$/) do
|
6
|
+
pending "Use case supported by Vault command-line client"
|
7
|
+
end
|
8
|
+
|
9
|
+
Then(/^I should not receive a token$/) do
|
10
|
+
pending "Use case supported by Vault command-line client"
|
11
|
+
end
|
12
|
+
|
13
|
+
Given(/^I have invalid credentials$/) do
|
14
|
+
pending "Use case supported by Vault command-line client"
|
15
|
+
end
|
16
|
+
|
17
|
+
Given(/^I have valid credentials$/) do
|
18
|
+
pending "Use case supported by Vault command-line client"
|
19
|
+
end
|
20
|
+
|
21
|
+
Then(/^I should receive a token$/) do
|
22
|
+
pending "Use case supported by Vault command-line client"
|
23
|
+
end
|
24
|
+
|
25
|
+
Given(/^I do not have a token$/) do
|
26
|
+
@test.deauthorize
|
27
|
+
end
|
28
|
+
|
29
|
+
Given(/^I have a token that allows requesting configurations$/) do
|
30
|
+
@test.authorize(:requesting_configurations)
|
31
|
+
end
|
32
|
+
|
33
|
+
When(/^I request a configuration$/) do
|
34
|
+
@test.request_configuration
|
35
|
+
end
|
36
|
+
|
37
|
+
Then(/^I should be allowed to request configurations$/) do
|
38
|
+
expect(@test.request_allowed?).to eq true
|
39
|
+
end
|
40
|
+
|
41
|
+
Given(/^I have a token that does not allow requesting configurations$/) do
|
42
|
+
@test.authorize(:nothing)
|
43
|
+
end
|
44
|
+
|
45
|
+
Then(/^I should be notified that my request is 'not authorized'$/) do
|
46
|
+
expect(@test.request_allowed?).to eq false
|
47
|
+
end
|
48
|
+
|
49
|
+
Given(/^I have a token that allows publishing configurations$/) do
|
50
|
+
@test.authorize(:publishing_configurations)
|
51
|
+
end
|
52
|
+
|
53
|
+
When(/^I request publication of a configuration$/) do
|
54
|
+
@test.publish_configuration
|
55
|
+
end
|
56
|
+
|
57
|
+
Then(/^I should be allowed to publish configurations$/) do
|
58
|
+
expect(@test.request_allowed?).to eq true
|
59
|
+
end
|
60
|
+
|
61
|
+
Given(/^I have a token that does not allow publishing configurations$/) do
|
62
|
+
@test.authorize(:requesting_configurations)
|
63
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
Given(/^environmental service configuration$/) do
|
2
|
+
@test.given_environmental_service_configuration
|
3
|
+
end
|
4
|
+
|
5
|
+
When(/^I bootstrap the configuration service from the environment$/) do
|
6
|
+
@test.bootstrap_configuration_service_environmentally
|
7
|
+
end
|
8
|
+
|
9
|
+
Then(/^I receive a functioning configuration service$/) do
|
10
|
+
expect(@test.bootstrapped_configuration_service_functional?).to eq true
|
11
|
+
end
|
12
|
+
|
13
|
+
Then(/^the environmental service configuration has been scrubbed$/) do
|
14
|
+
expect(@test.environmental_service_configuration_scrubbed?).to eq true
|
15
|
+
end
|
@@ -0,0 +1,63 @@
|
|
1
|
+
Given(/^a metadata filter$/) do
|
2
|
+
pending "Searching with metadata filters not yet supported"
|
3
|
+
end
|
4
|
+
|
5
|
+
Then(/^I should receive a 'no match' indication$/) do
|
6
|
+
expect(@test.request_not_matched?).to eq true
|
7
|
+
end
|
8
|
+
|
9
|
+
Then(/^the configuration data should be returned for the identifier$/) do
|
10
|
+
expect(@test.requested_configuration).to eq @test.existing_configuration
|
11
|
+
end
|
12
|
+
|
13
|
+
Given(/^no meta data filter$/) do
|
14
|
+
end
|
15
|
+
|
16
|
+
Given(/^configuration data at the index is present$/) do
|
17
|
+
@test.given_existing_configuration
|
18
|
+
end
|
19
|
+
|
20
|
+
When(/^I request configuration data$/) do
|
21
|
+
@test.authorize(:requesting_configurations)
|
22
|
+
@test.request_configuration
|
23
|
+
end
|
24
|
+
|
25
|
+
Then(/^the configuration data should be returned for the index and meta data filter$/) do
|
26
|
+
expect(@test.requested_configuration).to eq @test.existing_configuration
|
27
|
+
end
|
28
|
+
|
29
|
+
Given(/^configuration data at the index is not present$/) do
|
30
|
+
@test.given_missing_configuration
|
31
|
+
end
|
32
|
+
|
33
|
+
Then(/^I should receive a 'not found' indication$/) do
|
34
|
+
expect(@test.request_not_found?).to eq true
|
35
|
+
end
|
36
|
+
|
37
|
+
Given(/^only one entry of configuration data matching the meta data filter is present$/) do
|
38
|
+
pending "Identifier-free requests not supported"
|
39
|
+
end
|
40
|
+
|
41
|
+
Then(/^the configuration data should be returned for the index and meta data filter as the only item$/) do
|
42
|
+
pending "Identifier-free requests not supported"
|
43
|
+
end
|
44
|
+
|
45
|
+
Given(/^multiple entries of configuration data matching the meta data filter are present$/) do
|
46
|
+
pending "Identifier-free requests not supported"
|
47
|
+
end
|
48
|
+
|
49
|
+
Then(/^all matching configuration data should be returned$/) do
|
50
|
+
pending "Identifier-free requests not supported"
|
51
|
+
end
|
52
|
+
|
53
|
+
Given(/^no entry matching the meta data filter is present$/) do
|
54
|
+
pending "Identifier-free requests not supported"
|
55
|
+
end
|
56
|
+
|
57
|
+
Given(/^a CS request failure$/) do
|
58
|
+
@test.given_request_failure
|
59
|
+
end
|
60
|
+
|
61
|
+
Then(/^I should receive a 'request failure' notification$/) do
|
62
|
+
expect(@test.request_failed?).to eq true
|
63
|
+
end
|
@@ -0,0 +1,60 @@
|
|
1
|
+
Given(/^an identifier$/) do
|
2
|
+
end
|
3
|
+
|
4
|
+
Given(/^some configuration data$/) do
|
5
|
+
end
|
6
|
+
|
7
|
+
When(/^I request publication of the configuration data$/) do
|
8
|
+
@test.authorize(:publishing_configurations)
|
9
|
+
@test.publish_configuration
|
10
|
+
end
|
11
|
+
|
12
|
+
Then(/^I receive a unique revision for my publication$/) do
|
13
|
+
expect(@test.published_revision).to_not be_nil
|
14
|
+
end
|
15
|
+
|
16
|
+
Then(/^the metadata is updated with the revision by the CS$/) do
|
17
|
+
expect(@test.published_metadata).to include("revision" => @test.published_revision)
|
18
|
+
end
|
19
|
+
|
20
|
+
Given(/^some metadata$/) do
|
21
|
+
@test.given_metadata
|
22
|
+
end
|
23
|
+
|
24
|
+
Then(/^the metadata is also remembered$/) do
|
25
|
+
expect(@test.published_metadata).to include(@test.given_metadata)
|
26
|
+
end
|
27
|
+
|
28
|
+
Then(/^the entry is timestamped$/) do
|
29
|
+
expect(@test.published_metadata).to include("timestamp")
|
30
|
+
end
|
31
|
+
|
32
|
+
Given(/^existing configuration data$/) do
|
33
|
+
@test.given_existing_configuration
|
34
|
+
end
|
35
|
+
|
36
|
+
When(/^I request publication of configuration data using the existing identifier$/) do
|
37
|
+
@test.authorize(:publishing_configurations)
|
38
|
+
@test.publish_configuration
|
39
|
+
end
|
40
|
+
|
41
|
+
Then(/^I receive a new unique revision for the publication$/) do
|
42
|
+
expect(@test.published_revision).to_not eq @test.existing_revision
|
43
|
+
end
|
44
|
+
|
45
|
+
Given(/^invalid configuration data$/) do
|
46
|
+
@test.given_invalid_configuration
|
47
|
+
end
|
48
|
+
|
49
|
+
Then(/^I receive an 'invalid data' notification$/) do
|
50
|
+
expect(@test.request_failed?).to eq true
|
51
|
+
end
|
52
|
+
|
53
|
+
Given(/^a CS publication failure$/) do
|
54
|
+
@test.given_publication_failure
|
55
|
+
end
|
56
|
+
|
57
|
+
Then(/^I should receive a 'publication failure' notification$/) do
|
58
|
+
expect(@test.request_failed?).to eq true
|
59
|
+
end
|
60
|
+
|
@@ -0,0 +1,11 @@
|
|
1
|
+
$LOAD_PATH.unshift File.expand_path("../../../lib", __FILE__)
|
2
|
+
require 'configuration_service/test'
|
3
|
+
|
4
|
+
Before do
|
5
|
+
begin
|
6
|
+
@test = ConfigurationService::Test::OrchestratorEnvironmentFactory.build
|
7
|
+
rescue
|
8
|
+
Cucumber.wants_to_quit = true
|
9
|
+
raise
|
10
|
+
end
|
11
|
+
end
|
@@ -16,7 +16,7 @@ module ConfigurationService
|
|
16
16
|
# #
|
17
17
|
# # source 'https://rubygems.org'
|
18
18
|
# #
|
19
|
-
# # gem 'configuration_service-vault'
|
19
|
+
# # gem 'configuration_service-provider-vault'
|
20
20
|
# # gem 'acme_application'
|
21
21
|
#
|
22
22
|
# # Now main.rb (or config.ru or whatever) is decoupled from provider
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: configuration_service
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sheldon Hearn
|
@@ -87,6 +87,7 @@ executables: []
|
|
87
87
|
extensions: []
|
88
88
|
extra_rdoc_files: []
|
89
89
|
files:
|
90
|
+
- ".gemspec"
|
90
91
|
- ".gitignore"
|
91
92
|
- ".rspec"
|
92
93
|
- Gemfile
|
@@ -94,7 +95,15 @@ files:
|
|
94
95
|
- README.md
|
95
96
|
- README.rdoc
|
96
97
|
- Rakefile
|
97
|
-
-
|
98
|
+
- features/authorization.feature
|
99
|
+
- features/bootstrapping.feature
|
100
|
+
- features/consuming.feature
|
101
|
+
- features/publishing.feature
|
102
|
+
- features/step_definitions/authorization_steps.rb
|
103
|
+
- features/step_definitions/bootstrapping_steps.rb
|
104
|
+
- features/step_definitions/consuming_steps.rb
|
105
|
+
- features/step_definitions/publishing_steps.rb
|
106
|
+
- features/support/env.rb
|
98
107
|
- lib/configuration_service.rb
|
99
108
|
- lib/configuration_service/base.rb
|
100
109
|
- lib/configuration_service/configuration.rb
|
@@ -114,6 +123,7 @@ files:
|
|
114
123
|
- lib/configuration_service/test/orchestrator_environment_factory.rb
|
115
124
|
- lib/configuration_service/test/response.rb
|
116
125
|
- lib/configuration_service/test/stub_orchestration_provider.rb
|
126
|
+
- lib/configuration_service/version.rb
|
117
127
|
homepage: https://github.com/hetznerZA/configuration_service
|
118
128
|
licenses: []
|
119
129
|
metadata: {}
|