|
|
|
@ -39,7 +39,7 @@ func Test_executeSyncLogQuery(t *testing.T) { |
|
|
|
|
|
|
|
|
|
t.Run("getCWLogsClient is called with region from input JSON", func(t *testing.T) { |
|
|
|
|
cli = fakeCWLogsClient{queryResults: cloudwatchlogs.GetQueryResultsOutput{Status: aws.String("Complete")}} |
|
|
|
|
im := datasource.NewInstanceManager(func(s backend.DataSourceInstanceSettings) (instancemgmt.Instance, error) { |
|
|
|
|
im := datasource.NewInstanceManager(func(ctx context.Context, s backend.DataSourceInstanceSettings) (instancemgmt.Instance, error) { |
|
|
|
|
return DataSource{Settings: models.CloudWatchSettings{}}, nil |
|
|
|
|
}) |
|
|
|
|
sess := fakeSessionCache{} |
|
|
|
@ -65,7 +65,7 @@ func Test_executeSyncLogQuery(t *testing.T) { |
|
|
|
|
|
|
|
|
|
t.Run("getCWLogsClient is called with region from instance manager when region is default", func(t *testing.T) { |
|
|
|
|
cli = fakeCWLogsClient{queryResults: cloudwatchlogs.GetQueryResultsOutput{Status: aws.String("Complete")}} |
|
|
|
|
im := datasource.NewInstanceManager(func(s backend.DataSourceInstanceSettings) (instancemgmt.Instance, error) { |
|
|
|
|
im := datasource.NewInstanceManager(func(ctx context.Context, s backend.DataSourceInstanceSettings) (instancemgmt.Instance, error) { |
|
|
|
|
return DataSource{Settings: models.CloudWatchSettings{AWSDatasourceSettings: awsds.AWSDatasourceSettings{Region: "instance manager's region"}}}, nil |
|
|
|
|
}) |
|
|
|
|
sess := fakeSessionCache{} |
|
|
|
@ -122,7 +122,7 @@ func Test_executeSyncLogQuery(t *testing.T) { |
|
|
|
|
t.Run(tc.name, func(t *testing.T) { |
|
|
|
|
syncCalled = false |
|
|
|
|
cli = fakeCWLogsClient{queryResults: cloudwatchlogs.GetQueryResultsOutput{Status: aws.String("Complete")}} |
|
|
|
|
im := datasource.NewInstanceManager(func(s backend.DataSourceInstanceSettings) (instancemgmt.Instance, error) { |
|
|
|
|
im := datasource.NewInstanceManager(func(ctx context.Context, s backend.DataSourceInstanceSettings) (instancemgmt.Instance, error) { |
|
|
|
|
return DataSource{Settings: models.CloudWatchSettings{AWSDatasourceSettings: awsds.AWSDatasourceSettings{Region: "instance manager's region"}}}, nil |
|
|
|
|
}) |
|
|
|
|
sess := fakeSessionCache{} |
|
|
|
@ -170,7 +170,7 @@ func Test_executeSyncLogQuery_handles_RefId_from_input_queries(t *testing.T) { |
|
|
|
|
QueryId: aws.String("abcd-efgh-ijkl-mnop"), |
|
|
|
|
}, nil) |
|
|
|
|
cli.On("GetQueryResultsWithContext", mock.Anything, mock.Anything, mock.Anything).Return(&cloudwatchlogs.GetQueryResultsOutput{Status: aws.String("Complete")}, nil) |
|
|
|
|
im := datasource.NewInstanceManager(func(s backend.DataSourceInstanceSettings) (instancemgmt.Instance, error) { |
|
|
|
|
im := datasource.NewInstanceManager(func(ctx context.Context, s backend.DataSourceInstanceSettings) (instancemgmt.Instance, error) { |
|
|
|
|
return DataSource{Settings: models.CloudWatchSettings{}}, nil |
|
|
|
|
}) |
|
|
|
|
executor := newExecutor(im, newTestConfig(), &fakeSessionCache{}, featuremgmt.WithFeatures()) |
|
|
|
@ -199,7 +199,7 @@ func Test_executeSyncLogQuery_handles_RefId_from_input_queries(t *testing.T) { |
|
|
|
|
QueryId: aws.String("abcd-efgh-ijkl-mnop"), |
|
|
|
|
}, nil) |
|
|
|
|
cli.On("GetQueryResultsWithContext", mock.Anything, mock.Anything, mock.Anything).Return(&cloudwatchlogs.GetQueryResultsOutput{Status: aws.String("Complete")}, nil) |
|
|
|
|
im := datasource.NewInstanceManager(func(s backend.DataSourceInstanceSettings) (instancemgmt.Instance, error) { |
|
|
|
|
im := datasource.NewInstanceManager(func(ctx context.Context, s backend.DataSourceInstanceSettings) (instancemgmt.Instance, error) { |
|
|
|
|
return DataSource{Settings: models.CloudWatchSettings{}}, nil |
|
|
|
|
}) |
|
|
|
|
executor := newExecutor(im, newTestConfig(), &fakeSessionCache{}, featuremgmt.WithFeatures()) |
|
|
|
@ -268,7 +268,7 @@ func Test_executeSyncLogQuery_handles_RefId_from_input_queries(t *testing.T) { |
|
|
|
|
}}}, |
|
|
|
|
Status: aws.String("Complete")}, nil) |
|
|
|
|
|
|
|
|
|
im := datasource.NewInstanceManager(func(s backend.DataSourceInstanceSettings) (instancemgmt.Instance, error) { |
|
|
|
|
im := datasource.NewInstanceManager(func(ctx context.Context, s backend.DataSourceInstanceSettings) (instancemgmt.Instance, error) { |
|
|
|
|
return DataSource{Settings: models.CloudWatchSettings{}}, nil |
|
|
|
|
}) |
|
|
|
|
executor := newExecutor(im, newTestConfig(), &fakeSessionCache{}, featuremgmt.WithFeatures()) |
|
|
|
@ -313,7 +313,7 @@ func Test_executeSyncLogQuery_handles_RefId_from_input_queries(t *testing.T) { |
|
|
|
|
QueryId: aws.String("abcd-efgh-ijkl-mnop"), |
|
|
|
|
}, nil) |
|
|
|
|
cli.On("GetQueryResultsWithContext", mock.Anything, mock.Anything, mock.Anything).Return(&cloudwatchlogs.GetQueryResultsOutput{Status: aws.String("Running")}, nil) |
|
|
|
|
im := datasource.NewInstanceManager(func(s backend.DataSourceInstanceSettings) (instancemgmt.Instance, error) { |
|
|
|
|
im := datasource.NewInstanceManager(func(ctx context.Context, s backend.DataSourceInstanceSettings) (instancemgmt.Instance, error) { |
|
|
|
|
return DataSource{Settings: models.CloudWatchSettings{LogsTimeout: models.Duration{Duration: time.Millisecond}}}, nil |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
@ -346,7 +346,7 @@ func Test_executeSyncLogQuery_handles_RefId_from_input_queries(t *testing.T) { |
|
|
|
|
&cloudwatchlogs.GetQueryResultsOutput{Status: aws.String("Complete")}, |
|
|
|
|
&fakeAWSError{code: "foo", message: "bar"}, |
|
|
|
|
) |
|
|
|
|
im := datasource.NewInstanceManager(func(s backend.DataSourceInstanceSettings) (instancemgmt.Instance, error) { |
|
|
|
|
im := datasource.NewInstanceManager(func(ctx context.Context, s backend.DataSourceInstanceSettings) (instancemgmt.Instance, error) { |
|
|
|
|
return DataSource{Settings: models.CloudWatchSettings{}}, nil |
|
|
|
|
}) |
|
|
|
|
executor := newExecutor(im, newTestConfig(), &fakeSessionCache{}, featuremgmt.WithFeatures()) |
|
|
|
|