Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[aws/s3]: fix s3_input integration test #39648

Merged

Conversation

pkoutsovasilis
Copy link
Contributor

@pkoutsovasilis pkoutsovasilis commented May 21, 2024

Proposed commit message

This PR fixes the following errors captured https://github.com/elastic/ingest-dev/issues/3312

input/awss3/input_integration_test.go:138:46: undefined: s3Input
input/awss3/input_integration_test.go:144:19: undefined: s3Input
input/awss3/input_integration_test.go:238:14: undefined: s3Input

Initially these tests resulted as broken because of this PR #39353 which quoting from the description

This change is meant to have no functional effect, it is strictly a cleanup and reorganization in preparation for future changes. The hope is that the new layout makes initialization steps and logical dependencies clearer.

split up the pre-existing s3input to s3PollerInput and sqsReaderInput without reflecting this in the x-pack/filebeat/input/awss3/input_integration_test.go. However, even when applying the necessary changes in the former, another error surfaces. Specifically this one

  | InternalErrorexception while calling sqs with unknown operation: Traceback (most recent call last):
  | File "/opt/code/localstack/localstack/aws/chain.py", line 90, in handle
  | handler(self, self.context, response)
  | File "/opt/code/localstack/localstack/aws/handlers/service.py", line 64, in call
  | return self.parse_and_enrich(context)
  | File "/opt/code/localstack/localstack/aws/handlers/service.py", line 77, in parse_and_enrich
  | operation, instance = parser.parse(context.request)
  | File "/opt/code/localstack/localstack/aws/protocol/parser.py", line 172, in wrapper
  | return func(*args, **kwargs)
  | File "/opt/code/localstack/localstack/aws/protocol/parser.py", line 366, in parse
  | raise ProtocolParserError(
  | localstack.aws.protocol.parser.ProtocolParserError: Operation detection failed. Missing Action in request for query-protocol service ServiceModel(sqs).

I can trace the above only to the update of aws package dependencies which happened in this #39454 and it wasn't tested with aws label. To fix this error the image of localstack, spawned during the aws integration tests, had to be updated to 3.1.0

Checklist

  • My code follows the style guidelines of this project
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have made corresponding change to the default configuration files
  • I have added tests that prove my fix is effective or that my feature works
  • I have added an entry in CHANGELOG.next.asciidoc or CHANGELOG-developer.next.asciidoc.

Disruptive User Impact

Author's Checklist

N/A

How to test this PR locally

Open a PR on beats CI and add the aws label

Related issues

Use cases

N/A

Screenshots

N/A

Logs

N/A

@pkoutsovasilis pkoutsovasilis added the aws Enable builds in the CI for aws cloud testing label May 21, 2024
@botelastic botelastic bot added the needs_team Indicates that the issue/PR needs a Team:* label label May 21, 2024
Copy link
Contributor

mergify bot commented May 21, 2024

This pull request does not have a backport label.
If this is a bug or security fix, could you label this PR @pkoutsovasilis? 🙏.
For such, you'll need to label your PR with:

  • The upcoming major version of the Elastic Stack
  • The upcoming minor version of the Elastic Stack (if you're not pushing a breaking change)

To fixup this pull request, you need to add the backport labels for the needed
branches, such as:

  • backport-v8./d.0 is the label to automatically backport to the 8./d branch. /d is the digit

@pkoutsovasilis pkoutsovasilis changed the title fix: s3_input integration test [aws/s3]: fix s3_input integration test May 21, 2024
@pkoutsovasilis pkoutsovasilis added the Team:obs-ds-hosted-services Label for the Observability Hosted Services team label May 22, 2024
@botelastic botelastic bot removed the needs_team Indicates that the issue/PR needs a Team:* label label May 22, 2024
@pkoutsovasilis pkoutsovasilis marked this pull request as ready for review May 22, 2024 07:59
@pkoutsovasilis pkoutsovasilis requested review from a team as code owners May 22, 2024 07:59
@elasticmachine
Copy link
Collaborator

Pinging @elastic/obs-ds-hosted-services (Team:obs-ds-hosted-services)

@botelastic botelastic bot added the Team:Automation Label for the Observability productivity team label May 22, 2024
@dliappis dliappis self-requested a review May 22, 2024 08:02
Copy link
Contributor

@dliappis dliappis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@pierrehilbert pierrehilbert added the Team:Elastic-Agent-Data-Plane Label for the Agent Data Plane team label May 22, 2024
@elasticmachine
Copy link
Collaborator

Pinging @elastic/elastic-agent-data-plane (Team:Elastic-Agent-Data-Plane)

@pierrehilbert pierrehilbert requested a review from faec May 22, 2024 08:23
@bhapas
Copy link
Contributor

bhapas commented May 22, 2024

@pkoutsovasilis Thanks for taking this up... Can you attach the logs of test run locally.
Something like in this source PR

@pkoutsovasilis
Copy link
Contributor Author

pkoutsovasilis commented May 22, 2024

@pkoutsovasilis Thanks for taking this up... Can you attach the logs of test run locally. Something like in this source PR

I can attach them for sure @bhapas but why you need these particular logs attached here and not seeing that this test has run and passed from BK?

PS: not only TestInputRunSQSOnLocalstack was affected by #39353

@bhapas
Copy link
Contributor

bhapas commented May 22, 2024

@pkoutsovasilis Thanks for taking this up... Can you attach the logs of test run locally. Something like in this source PR

I can attach them for sure @bhapas but why you need these particular logs attached here and not seeing that this test has run and passed from BK?

PS: not only TestInputRunSQSOnLocalstack was affected by #39353

Good Question.. I did not find the Cloud Module tests that failed before with -tags aws , integration . May be I got blind. Can you point me to the succesful run :-)

@pkoutsovasilis
Copy link
Contributor Author

pkoutsovasilis commented May 22, 2024

Good Question.. I did not find the Cloud Module tests that failed before with -tags aws , integration . May be I got blind. Can you point me to the succesful run :-)

I am getting mixed signals here, you want a failure or a success?! 😆

Either way, here you can see that TestInputRunSQSOnLocalstack PASSES now, and here you can see when it was failing, is that helpful @bhapas ?

@bhapas
Copy link
Contributor

bhapas commented May 22, 2024

@pkoutsovasilis Thanks for taking this up... Can you attach the logs of test run locally. Something like in this source PR

I can attach them for sure @bhapas but why you need these particular logs attached here and not seeing that this test has run and passed from BK?
PS: not only TestInputRunSQSOnLocalstack was affected by #39353

Good Question.. I did not find the Cloud Module tests that failed before with -tags aws , integration . May be I got blind. Can you point me to the succesful run :-)

I am getting mixed signals here, you want a failure or a success?! 😆

Found a successful one though. Never mind :-)

@@ -353,7 +358,7 @@ func TestInputRunS3(t *testing.T) {
assert.EqualValues(t, s3Input.metrics.s3ObjectsRequestedTotal.Get(), 7)
assert.EqualValues(t, s3Input.metrics.s3ObjectsListedTotal.Get(), 8)
assert.EqualValues(t, s3Input.metrics.s3ObjectsProcessedTotal.Get(), 7)
assert.EqualValues(t, s3Input.metrics.s3ObjectsAckedTotal.Get(), 6)
assert.EqualValues(t, s3Input.metrics.s3ObjectsAckedTotal.Get(), 7)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did the number of acked objects changed?

Copy link
Contributor Author

@pkoutsovasilis pkoutsovasilis May 22, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

first because it was failing but also this should be 7 to begin with, right???

  1. "testdata/events-array.json",
  2. "testdata/invalid.json",
  3. "testdata/log.json",
  4. "testdata/log.ndjson",
  5. "testdata/multiline.json",
  6. "testdata/multiline.json.gz",
  7. "testdata/multiline.txt"

Copy link
Contributor

@faec faec left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thanks!

it wasn't tested with aws label

Does this mean these tests are only run when the aws label is set? It looks like 2-3 unrelated errors accumulated here, if these tests aren't being run automatically on things that touch AWS code/libs then we should probably fix that.

@@ -402,7 +407,10 @@ func makeAWSConfig(t *testing.T, region string) aws.Config {

func drainSQS(t *testing.T, region string, queueURL string, cfg aws.Config) {
sqs := &awsSQSAPI{
client: sqs.NewFromConfig(cfg),
client: sqs.NewFromConfig(cfg, func(options *sqs.Options) {
//options.ClientLogMode = aws.LogResponseWithBody
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Leftover comment?

Copy link
Contributor Author

@pkoutsovasilis pkoutsovasilis May 23, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

comment so somebody can enable the client log mode and see what the client is responding with when tests are failing with an error like this one. you want it removed?

@dliappis
Copy link
Contributor

Does this mean these tests are only run when the aws label is set? It looks like 2-3 unrelated errors accumulated here, if these tests aren't being run automatically on things that touch AWS code/libs then we should probably fix that.

Correct. This was the behavior for some time on Jenkins already (see https://github.com/elastic/observability-dev/blob/main/docs/dc/beats-ci/README.md#github-labels) and it was migrated over to Buildkite too. We had a discussion with @pierrehilbert and the platform ingest eng prod team about improvements and not having to rely on users to remember to use the right label on such PRs.

@zmoog
Copy link
Contributor

zmoog commented May 24, 2024

Does this mean these tests are only run when the aws label is set? It looks like 2-3 unrelated errors accumulated here, if these tests aren't being run automatically on things that touch AWS code/libs then we should probably fix that.

Correct. This was the behavior for some time on Jenkins already (see https://github.com/elastic/observability-dev/blob/main/docs/dc/beats-ci/README.md#github-labels) and it was migrated over to Buildkite too. We had a discussion with @pierrehilbert and the platform ingest eng prod team about improvements and not having to rely on users to remember to use the right label on such PRs.

Interesting!

So, should we add the aws label when creating the PR to enable AWS SDK dependencies update with Dependabot?

    labels:
      - automation
      - dependabot
      - aws

I created the first PR for Azure, but PRs to manage AWS and GCP dependencies with Dependabot are coming.

@pkoutsovasilis pkoutsovasilis merged commit 566d3bf into elastic:main May 24, 2024
18 checks passed
@pkoutsovasilis pkoutsovasilis deleted the pkoutsovasilis/fix_s3_input branch May 24, 2024 08:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
aws Enable builds in the CI for aws cloud testing Team:Automation Label for the Observability productivity team Team:Elastic-Agent-Data-Plane Label for the Agent Data Plane team Team:obs-ds-hosted-services Label for the Observability Hosted Services team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants