-
Notifications
You must be signed in to change notification settings - Fork 188
Syncing - Internal repo changes. #198
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
Changes from all commits
28752bb
f9788bd
9a5a7ea
b05b728
3bbe54f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,7 +31,8 @@ class InstanceAgentConfigTest < InstanceAgentTestCase | |
:ongoing_deployment_tracking => 'ongoing-deployment', | ||
:proxy_uri => nil, | ||
:enable_deployments_log => true, | ||
:kill_agent_max_wait_time_seconds => 7200 | ||
:kill_agent_max_wait_time_seconds => 7200, | ||
:use_fips_mode => false | ||
}, InstanceAgent::Config.config) | ||
end | ||
|
||
|
@@ -41,9 +42,11 @@ class InstanceAgentConfigTest < InstanceAgentTestCase | |
end | ||
|
||
should 'execute all available validation methods' do | ||
InstanceMetadata.stubs(:region).returns('us-west-1') #without stubbing this, the test will fail in the build fleet because MetadataService is not available there | ||
validations = sequence('validation') | ||
err = [] | ||
InstanceAgent::Config.any_instance.expects(:validate_children).with(err).in_sequence(validations) | ||
InstanceAgent::Config.any_instance.expects(:validate_use_fips_mode).with(err).in_sequence(validations) | ||
InstanceAgent::Config.validate_config | ||
end | ||
|
||
|
@@ -53,6 +56,8 @@ class InstanceAgentConfigTest < InstanceAgentTestCase | |
InstanceAgent::Config.config[:instance_service_region] = 'eu-west-1' | ||
InstanceAgent::Config.config[:instance_service_endpoint] = 'api-endpoint.example.com' | ||
InstanceAgent::Config.config[:instance_service_port] = 123 | ||
|
||
InstanceMetadata.stubs(:region).returns('us-west-1') #without stubbing this, the test will fail in the build fleet because MetadataService is not available there | ||
end | ||
|
||
should 'validate the children setting' do | ||
|
@@ -65,5 +70,39 @@ class InstanceAgentConfigTest < InstanceAgentTestCase | |
assert InstanceAgent::Config.validate_config.empty?, InstanceAgent::Config.validate_config.inspect | ||
end | ||
end | ||
|
||
context 'validate use_fips_mode' do | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why only these 4 regions? why not all 6 from the list above? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. FIPS was deployed to be used only in gov regions or some regions that we were running some tests. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You have Why are only 4 of those regions being special cased here? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Talked with Peng |
||
|
||
error = 'use_fips_mode can be set to true only in regions located in the USA' | ||
|
||
should 'error in eu-west-1' do | ||
InstanceAgent::Config.config[:use_fips_mode] = true | ||
ENV['AWS_REGION'] = 'eu-west-1' | ||
assert InstanceAgent::Config.validate_config.include? error | ||
end | ||
|
||
should 'not error in eu-west-1 if not set' do | ||
InstanceAgent::Config.config[:use_fips_mode] = false | ||
ENV['AWS_REGION'] = 'eu-west-1' | ||
assert_false InstanceAgent::Config.validate_config.include? error | ||
end | ||
|
||
should 'not error in us-east-1' do | ||
InstanceAgent::Config.config[:use_fips_mode] = true | ||
ENV['AWS_REGION'] = 'us-east-1' | ||
assert_false InstanceAgent::Config.validate_config.include? error | ||
end | ||
|
||
should 'not error in us-gov-west-1' do | ||
InstanceAgent::Config.config[:use_fips_mode] = true | ||
ENV['AWS_REGION'] = 'us-gov-west-1' | ||
assert_false InstanceAgent::Config.validate_config.include? error | ||
end | ||
|
||
cleanup do | ||
ENV['AWS_REGION'] = nil | ||
end | ||
|
||
end | ||
end | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is all of this getting removed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code wasn't removed. It was only moved to the new function s3_options to become more clear.