test/plugin/base_test.rb in fluent-plugin-google-cloud-0.6.16 vs test/plugin/base_test.rb in fluent-plugin-google-cloud-0.6.17
- old
+ new
@@ -225,11 +225,12 @@
end
def test_project_id_from_credentials
%w(gce ec2).each do |platform|
send("setup_#{platform}_metadata_stubs")
- [IAM_CREDENTIALS, LEGACY_CREDENTIALS].each do |creds|
+ [IAM_CREDENTIALS, NEW_STYLE_CREDENTIALS, LEGACY_CREDENTIALS].each \
+ do |creds|
ENV['GOOGLE_APPLICATION_CREDENTIALS'] = creds[:path]
d = create_driver
d.run
assert_equal creds[:project_id], d.instance.project_id
end
@@ -654,12 +655,12 @@
end
def test_configure_split_logs_by_tag
setup_gce_metadata_stubs
{
- APPLICATION_DEFAULT_CONFIG => true,
- DISABLE_SPLIT_LOGS_BY_TAG_CONFIG => false
+ APPLICATION_DEFAULT_CONFIG => false,
+ ENABLE_SPLIT_LOGS_BY_TAG_CONFIG => true
}.each do |(config, split_logs_by_tag)|
d = create_driver(config)
assert_equal split_logs_by_tag,
d.instance.instance_variable_get(:@split_logs_by_tag)
end
@@ -670,17 +671,17 @@
log_entry_count = 5
dynamic_log_names = (0..log_entry_count - 1).map do |index|
"projects/test-project-id/logs/tag#{index}"
end
[
+ [APPLICATION_DEFAULT_CONFIG, 1, [''], dynamic_log_names],
# [] returns nil for any index.
- [APPLICATION_DEFAULT_CONFIG, log_entry_count, dynamic_log_names, []],
- [DISABLE_SPLIT_LOGS_BY_TAG_CONFIG, 1, [''], dynamic_log_names]
+ [ENABLE_SPLIT_LOGS_BY_TAG_CONFIG, log_entry_count, dynamic_log_names, []]
].each do |(config, request_count, request_log_names, entry_log_names)|
setup_prometheus
setup_logging_stubs do
@logs_sent = []
- d = create_driver(config + PROMETHEUS_ENABLE_CONFIG, 'test', true)
+ d = create_driver(config + ENABLE_PROMETHEUS_CONFIG, 'test', true)
log_entry_count.times do |i|
d.emit("tag#{i}", 'message' => log_entry(i))
end
d.run
end