test/plugin/base_test.rb in fluent-plugin-google-cloud-0.7.13 vs test/plugin/base_test.rb in fluent-plugin-google-cloud-0.7.14
- old
+ new
@@ -1221,74 +1221,10 @@
assert_equal K8S_NANOS, entry['timestamp']['nanos'], entry
assert_equal 'WARNING', entry['severity'], entry
end
end
- def test_cloudfunctions_log
- setup_gce_metadata_stubs
- setup_cloudfunctions_metadata_stubs
- [1, 2, 3, 5, 11, 50].each do |n|
- setup_logging_stubs do
- d = create_driver(APPLICATION_DEFAULT_CONFIG, CLOUDFUNCTIONS_TAG)
- # The test driver doesn't clear its buffer of entries after running, so
- # do it manually here.
- d.instance_variable_get('@entries').clear
- @logs_sent = []
- n.times { |i| d.emit(cloudfunctions_log_entry(i)) }
- d.run
- end
- verify_log_entries(n, CLOUDFUNCTIONS_PARAMS) do |entry, i|
- verify_default_log_entry_text(entry['textPayload'], i, entry)
- assert_equal 'DEBUG', entry['severity'],
- "Test with #{n} logs failed. \n#{entry}"
- end
- end
- end
-
- def test_cloudfunctions_logs_text_not_matched
- setup_gce_metadata_stubs
- setup_cloudfunctions_metadata_stubs
- [1, 2, 3, 5, 11, 50].each do |n|
- @logs_sent = []
- setup_logging_stubs do
- d = create_driver(APPLICATION_DEFAULT_CONFIG, CLOUDFUNCTIONS_TAG)
- # The test driver doesn't clear its buffer of entries after running, so
- # do it manually here.
- d.instance_variable_get('@entries').clear
- n.times { |i| d.emit(cloudfunctions_log_entry_text_not_matched(i)) }
- d.run
- end
- verify_log_entries(
- n, CLOUDFUNCTIONS_TEXT_NOT_MATCHED_PARAMS) do |entry|
- assert_equal 'INFO', entry['severity'],
- "Test with #{n} logs failed. \n#{entry}"
- end
- end
- end
-
- def test_multiple_cloudfunctions_logs_tag_not_matched
- setup_gce_metadata_stubs
- setup_cloudfunctions_metadata_stubs
- [1, 2, 3, 5, 11, 50].each do |n|
- @logs_sent = []
- setup_logging_stubs do
- d = create_driver(APPLICATION_DEFAULT_CONFIG, CONTAINER_TAG)
- # The test driver doesn't clear its buffer of entries after running, so
- # do it manually here.
- d.instance_variable_get('@entries').clear
- n.times { |i| d.emit(cloudfunctions_log_entry(i)) }
- d.run
- end
- verify_log_entries(n, CONTAINER_FROM_TAG_PARAMS, 'textPayload') \
- do |entry, i|
- assert_equal '[D][2015-09-25T12:34:56.789Z][123-0] test log entry ' \
- "#{i}", entry['textPayload'],
- "Test with #{n} logs failed. \n#{entry}"
- end
- end
- end
-
def test_dataproc_log
setup_gce_metadata_stubs
setup_dataproc_metadata_stubs
setup_logging_stubs do
d = create_driver
@@ -2171,22 +2107,10 @@
' server.')
end
end
end
- def setup_cloudfunctions_metadata_stubs
- stub_metadata_request(
- 'instance/attributes/',
- "attribute1\ncluster-location\ncluster-name\ngcf_region\nlast_attribute")
- stub_metadata_request('instance/attributes/cluster-location',
- K8S_LOCATION2)
- stub_metadata_request('instance/attributes/cluster-name',
- K8S_CLUSTER_NAME)
- stub_metadata_request('instance/attributes/gcf_region',
- CLOUDFUNCTIONS_REGION)
- end
-
def setup_dataproc_metadata_stubs
stub_metadata_request(
'instance/attributes/',
"attribute1\ndataproc-cluster-uuid\ndataproc-cluster-name")
stub_metadata_request('instance/attributes/dataproc-cluster-name',
@@ -2334,23 +2258,9 @@
stream: K8S_STREAM,
time: K8S_TIMESTAMP,
LOCAL_RESOURCE_ID_KEY =>
"#{K8S_NODE_LOCAL_RESOURCE_ID_PREFIX}" \
".#{K8S_NODE_NAME}"
- }
- end
-
- def cloudfunctions_log_entry(i)
- {
- stream: 'stdout',
- log: '[D][2015-09-25T12:34:56.789Z][123-0] ' + log_entry(i)
- }
- end
-
- def cloudfunctions_log_entry_text_not_matched(i)
- {
- stream: 'stdout',
- log: log_entry(i)
}
end
def dataflow_log_entry(i)
{