test/plugin/constants.rb in fluent-plugin-google-cloud-0.6.13 vs test/plugin/constants.rb in fluent-plugin-google-cloud-0.6.14
- old
+ new
@@ -18,10 +18,11 @@
include Fluent::GoogleCloudOutput::ConfigConstants
include Fluent::GoogleCloudOutput::InternalConstants
# Generic attributes.
HOSTNAME = Socket.gethostname
+ CUSTOM_LOGGING_API_URL = 'http://localhost:52000'.freeze
# TODO(qingling128) Separate constants into different submodules.
# Attributes used for the GCE metadata service.
PROJECT_ID = 'test-project-id'.freeze
ZONE = 'us-central1-b'.freeze
@@ -41,17 +42,20 @@
# Attributes used for the EC2 metadata service.
EC2_PROJECT_ID = 'test-ec2-project-id'.freeze
EC2_ZONE = 'us-west-2b'.freeze
EC2_PREFIXED_ZONE = "aws:#{EC2_ZONE}".freeze
+ EC2_REGION = 'us-west-2'.freeze
+ EC2_PREFIXED_REGION = "aws:#{EC2_REGION}".freeze
EC2_VM_ID = 'i-81c16767'.freeze
EC2_ACCOUNT_ID = '123456789012'.freeze
# The formatting here matches the format used on the VM.
EC2_IDENTITY_DOCUMENT = %({
"accountId" : "#{EC2_ACCOUNT_ID}",
"availabilityZone" : "#{EC2_ZONE}",
+ "region" : "#{EC2_REGION}",
"instanceId" : "#{EC2_VM_ID}"
}).freeze
# Managed VMs specific labels.
MANAGED_VM_BACKEND_NAME = 'default'.freeze
@@ -136,10 +140,14 @@
# Configuration files for various test scenarios.
APPLICATION_DEFAULT_CONFIG = %(
).freeze
+ CUSTOM_LOGGING_API_URL_CONFIG = %(
+ logging_api_url #{CUSTOM_LOGGING_API_URL}
+ ).freeze
+
DETECT_JSON_CONFIG = %(
detect_json true
).freeze
PARTIAL_SUCCESS_CONFIG = %(
@@ -218,10 +226,15 @@
CONFIG_EC2_PROJECT_ID_AND_CUSTOM_VM_ID = %(
project_id #{EC2_PROJECT_ID}
vm_id #{CUSTOM_VM_ID}
).freeze
+ CONFIG_EC2_PROJECT_ID_USE_REGION = %(
+ project_id #{EC2_PROJECT_ID}
+ use_aws_availability_zone false
+ ).freeze
+
CONFIG_DATAFLOW = %(
subservice_name "#{DATAFLOW_CONSTANTS[:service]}"
labels {
"#{DATAFLOW_CONSTANTS[:service]}/region" : "#{DATAFLOW_REGION}",
"#{DATAFLOW_CONSTANTS[:service]}/job_name" : "#{DATAFLOW_JOB_NAME}",
@@ -242,10 +255,14 @@
CONFIG_CUSTOM_TRACE_KEY_SPECIFIED = %(
trace_key custom_trace_key
).freeze
+ CONFIG_CUSTOM_SPAN_ID_KEY_SPECIFIED = %(
+ span_id_key custom_span_id_key
+ ).freeze
+
# Service configurations for various services.
# GCE.
COMPUTE_PARAMS_NO_LOG_NAME = {
resource: {
@@ -504,26 +521,34 @@
labels: {
"#{COMPUTE_CONSTANTS[:service]}/resource_name" => CUSTOM_HOSTNAME
}
}.freeze
- EC2_PARAMS = {
+ EC2_REGION_PARAMS = {
resource: {
type: EC2_CONSTANTS[:resource_type],
labels: {
'instance_id' => EC2_VM_ID,
- 'region' => EC2_PREFIXED_ZONE,
+ 'region' => EC2_PREFIXED_REGION,
'aws_account' => EC2_ACCOUNT_ID
}
},
log_name: 'test',
project_id: EC2_PROJECT_ID,
labels: {
"#{EC2_CONSTANTS[:service]}/resource_name" => HOSTNAME
}
}.freeze
+ EC2_ZONE_PARAMS = EC2_REGION_PARAMS.merge(
+ resource: EC2_REGION_PARAMS[:resource].merge(
+ labels: EC2_REGION_PARAMS[:resource][:labels].merge(
+ 'region' => EC2_PREFIXED_ZONE
+ )
+ )
+ ).freeze
+
HTTP_REQUEST_MESSAGE = {
'requestMethod' => 'POST',
'requestUrl' => 'http://example/',
'requestSize' => 210,
'status' => 200,
@@ -649,6 +674,48 @@
'aracter :\" } }'
}
]
}
}.freeze
+
+ # rubocop:disable Style/StringLiterals
+ PARTIAL_SUCCESS_GRPC_METADATA = {
+ 'google.logging.v2.writelogentriespartialerrors-bin' =>
+ Google::Logging::V2::WriteLogEntriesPartialErrors.encode(
+ Google::Logging::V2::WriteLogEntriesPartialErrors.new(
+ log_entry_errors: {
+ 0 => Google::Rpc::Status.new(
+ code: GRPC::Core::StatusCodes::PERMISSION_DENIED,
+ message: "User not authorized.",
+ details: []),
+ 1 => Google::Rpc::Status.new(
+ code: GRPC::Core::StatusCodes::INVALID_ARGUMENT,
+ message: "Log name contains illegal character :",
+ details: []),
+ 3 => Google::Rpc::Status.new(
+ code: GRPC::Core::StatusCodes::INVALID_ARGUMENT,
+ message: "Log name contains illegal character :",
+ details: []) })),
+ 'google.rpc.debuginfo-bin' =>
+ "\x12\xA7\x03[ORIGINAL ERROR] generic::permission_denied: User not auth" \
+ "orized. [google.rpc.error_details_ext] { message: \"User not authorize" \
+ "d.\" details { type_url: \"type.googleapis.com/google.logging.v2.Write" \
+ "LogEntriesPartialErrors\" value: \"\\n\\034\\010\\000\\022\\030\\010\\" \
+ "007\\022\\024User not authorized.\\n-\\010\\001\\022)\\010\\003\\022%L" \
+ "og name contains illegal character :\\n-\\010\\002\\022)\\010\\003\\02" \
+ "2%Log name contains illegal character :\" } }",
+ 'grpc-status-details-bin' =>
+ "\b\a\x12\x14User not authorized.\x1A\xC2\x01\nBtype.googleapis.com/goo" \
+ "gle.logging.v2.WriteLogEntriesPartialErrors\x12|\n\x1C\b\x00\x12\x18\b" \
+ "\a\x12\x14User not authorized.\n-\b\x01\x12)\b\x03\x12%Log name contai" \
+ "ns illegal character :\n-\b\x02\x12)\b\x03\x12%Log name contains illeg" \
+ "al character :\x1A\xD7\x03\n(type.googleapis.com/google.rpc.DebugInfo" \
+ "\x12\xAA\x03\x12\xA7\x03[ORIGINAL ERROR] generic::permission_denied: U" \
+ "ser not authorized. [google.rpc.error_details_ext] { message: \"User n" \
+ "ot authorized.\" details { type_url: \"type.googleapis.com/google.logg" \
+ "ing.v2.WriteLogEntriesPartialErrors\" value: \"\\n\\034\\010\\000\\022" \
+ "\\030\\010\\007\\022\\024User not authorized.\\n-\\010\\001\\022)\\010" \
+ "\\003\\022%Log name contains illegal character :\\n-\\010\\002\\022)" \
+ "\\010\\003\\022%Log name contains illegal character :\" } }"
+ }.freeze
+ # rubocop:enable Style/StringLiterals
end