diff --git a/plugins/inputs/logfile/logfile_test.go b/plugins/inputs/logfile/logfile_test.go index f5a38ab48c..2c1a2e98dd 100644 --- a/plugins/inputs/logfile/logfile_test.go +++ b/plugins/inputs/logfile/logfile_test.go @@ -453,7 +453,7 @@ func createWriteRead(t *testing.T, prefix string, logFile *LogFile, done chan bo select { case <-done2: t.Log("Child completed before timeout (as expected)") - case <-time.After(time.Second * 10): + case <-time.After(time.Second * 20): require.Fail(t, "timeout waiting for child") } t.Log("Verify 1st temp file was auto deleted.") diff --git a/translator/translate/otel/exporter/awsemf/translator.go b/translator/translate/otel/exporter/awsemf/translator.go index b33881ed70..b985438525 100644 --- a/translator/translate/otel/exporter/awsemf/translator.go +++ b/translator/translate/otel/exporter/awsemf/translator.go @@ -93,6 +93,7 @@ func (t *translator) Translate(c *confmap.Conf) (component.Config, error) { if credentialsFileKey, ok := agent.Global_Config.Credentials[agent.CredentialsFile_Key]; ok { cfg.AWSSessionSettings.SharedCredentialsFile = []string{fmt.Sprintf("%v", credentialsFileKey)} } + cfg.AWSSessionSettings.RoleARN = agent.Global_Config.Role_arn cfg.AWSSessionSettings.IMDSRetries = retryer.GetDefaultRetryNumber() if isEcs(c) { diff --git a/translator/translate/otel/exporter/awsemf/translator_test.go b/translator/translate/otel/exporter/awsemf/translator_test.go index fb76195e0c..2418ae17fa 100644 --- a/translator/translate/otel/exporter/awsemf/translator_test.go +++ b/translator/translate/otel/exporter/awsemf/translator_test.go @@ -12,6 +12,7 @@ import ( "go.opentelemetry.io/collector/confmap" legacytranslator "github.com/aws/amazon-cloudwatch-agent/translator" + "github.com/aws/amazon-cloudwatch-agent/translator/translate/agent" ) var nilSlice []string @@ -19,6 +20,8 @@ var nilMetricDescriptorsSlice []awsemfexporter.MetricDescriptor func TestTranslator(t *testing.T) { tt := NewTranslator() + agent.Global_Config.Region = "us-east-1" + agent.Global_Config.Role_arn = "global_arn" require.EqualValues(t, "awsemf", tt.ID().String()) testCases := map[string]struct { env map[string]string @@ -675,6 +678,8 @@ func TestTranslator(t *testing.T) { require.Equal(t, testCase.want["resource_to_telemetry_conversion"], gotCfg.ResourceToTelemetrySettings) require.ElementsMatch(t, testCase.want["metric_declarations"], gotCfg.MetricDeclarations) require.ElementsMatch(t, testCase.want["metric_descriptors"], gotCfg.MetricDescriptors) + require.Equal(t, "global_arn", gotCfg.RoleARN) + require.Equal(t, "us-east-1", gotCfg.Region) } }) }