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

Fix TestEventLogFile, TestContainerCMDEventToStderr and TestEventLogOutputConfiguredViaFleet #5341

Merged
merged 2 commits into from
Aug 22, 2024

Conversation

belimawr
Copy link
Contributor

@belimawr belimawr commented Aug 21, 2024

What does this PR do?

Fix TestEventLogFile, TestContainerCMDEventToStderr and TestEventLogOutputConfiguredViaFleet by updating the string that needs to be searched in the logs.

Why is it important?

It fixes some test that were breaking CI

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/fragments using the changelog tool
  • I have added an integration test or an E2E test

Disruptive User Impact

There is no disruptive user impact because this PR is fixing a broken test

How to test this PR locally

Package the Elastic-Agent from this PR:

DEV=true SNAPSHOT=true EXTERNAL=true PACKAGES="deb,rpm,tar.gz" PLATFORMS=linux/amd64 mage -v package

Then run one of the integration test that were failing: TestEventLogFile, TestContainerCMDEventToStderr or TestEventLogOutputConfiguredViaFleet

SNAPSHOT=true TEST_PLATFORMS="linux/amd64" mage -v integration:single  TestEventLogFile

Related issues

Questions to ask yourself

  • How are we going to support this in production?
  • How are we going to measure its adoption?
  • How are we going to debug this?
  • What are the metrics I should take care of?
  • ...

Fix TestEventLogFile by updating the string that needs to be searched
in the logs.
@belimawr belimawr added Team:Elastic-Agent-Data-Plane Label for the Agent Data Plane team skip-changelog labels Aug 21, 2024
@belimawr belimawr requested a review from a team as a code owner August 21, 2024 20:26
@elasticmachine
Copy link
Contributor

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

@belimawr belimawr self-assigned this Aug 21, 2024
Copy link
Contributor

mergify bot commented Aug 21, 2024

This pull request does not have a backport label. Could you fix it @belimawr? 🙏
To fixup this pull request, you need to add the backport labels for the needed
branches, such as:

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

NOTE: backport-skip has been added to this pull request.

@ycombinator ycombinator enabled auto-merge (squash) August 21, 2024 21:08
@belimawr belimawr changed the title Fix TestEventLogFile Fix TestEventLogFile, TestContainerCMDEventToStderr and TestEventLogOutputConfiguredViaFleet Aug 21, 2024
Fix TestContainerCMDEventToStderr and
TestEventLogOutputConfiguredViaFleet as they were also searching for
strings Beats does not log any more.
Copy link

@ycombinator
Copy link
Contributor

Looks like TestEventLogOutputConfiguredViaFleet failed in CI:

=== RUN   TestEventLogOutputConfiguredViaFleet
    container_cmd_test.go:75: Creating enrollment API key...
    fetcher.go:93: Using existing artifact elastic-agent-8.16.0-SNAPSHOT-linux-x86_64.tar.gz
    fixture.go:282: Extracting artifact elastic-agent-8.16.0-SNAPSHOT-linux-x86_64.tar.gz to /tmp/TestEventLogOutputConfiguredViaFleet2549331463/001
    fixture.go:300: Completed extraction of artifact elastic-agent-8.16.0-SNAPSHOT-linux-x86_64.tar.gz to /tmp/TestEventLogOutputConfiguredViaFleet2549331463/001
    fixture.go:900: Components were not modified from the fetched artifact
    fixture.go:657: >> running binary with: [/tmp/TestEventLogOutputConfiguredViaFleet2549331463/001/elastic-agent-8.16.0-SNAPSHOT-linux-x86_64/elastic-agent status --output json]
    fixture.go:657: >> running binary with: [/tmp/TestEventLogOutputConfiguredViaFleet2549331463/001/elastic-agent-8.16.0-SNAPSHOT-linux-x86_64/elastic-agent status --output json]
    fixture.go:657: >> running binary with: [/tmp/TestEventLogOutputConfiguredViaFleet2549331463/001/elastic-agent-8.16.0-SNAPSHOT-linux-x86_64/elastic-agent status --output json]
    fixture.go:657: >> running binary with: [/tmp/TestEventLogOutputConfiguredViaFleet2549331463/001/elastic-agent-8.16.0-SNAPSHOT-linux-x86_64/elastic-agent status --output json]
    fixture.go:657: >> running binary with: [/tmp/TestEventLogOutputConfiguredViaFleet2549331463/001/elastic-agent-8.16.0-SNAPSHOT-linux-x86_64/elastic-agent status --output json]
    fixture.go:657: >> running binary with: [/tmp/TestEventLogOutputConfiguredViaFleet2549331463/001/elastic-agent-8.16.0-SNAPSHOT-linux-x86_64/elastic-agent status --output json]
    event_logging_test.go:316: 
        	Error Trace:	/home/ubuntu/agent/testing/integration/event_logging_test.go:316
        	            				/home/ubuntu/agent/testing/integration/event_logging_test.go:231
        	Error:      	Condition never satisfied
        	Test:       	TestEventLogOutputConfiguredViaFleet
        	Messages:   	could not find event log file
    container_cmd_test.go:98: >> cleaning up: killing the Elastic-Agent process
--- FAIL: TestEventLogOutputConfiguredViaFleet (88.16s)

@ycombinator ycombinator merged commit b96a4ca into elastic:main Aug 22, 2024
13 checks passed
@belimawr
Copy link
Contributor Author

Looks like TestEventLogOutputConfiguredViaFleet failed in CI:

=== RUN   TestEventLogOutputConfiguredViaFleet
    container_cmd_test.go:75: Creating enrollment API key...
    fetcher.go:93: Using existing artifact elastic-agent-8.16.0-SNAPSHOT-linux-x86_64.tar.gz
    fixture.go:282: Extracting artifact elastic-agent-8.16.0-SNAPSHOT-linux-x86_64.tar.gz to /tmp/TestEventLogOutputConfiguredViaFleet2549331463/001
    fixture.go:300: Completed extraction of artifact elastic-agent-8.16.0-SNAPSHOT-linux-x86_64.tar.gz to /tmp/TestEventLogOutputConfiguredViaFleet2549331463/001
    fixture.go:900: Components were not modified from the fetched artifact
    fixture.go:657: >> running binary with: [/tmp/TestEventLogOutputConfiguredViaFleet2549331463/001/elastic-agent-8.16.0-SNAPSHOT-linux-x86_64/elastic-agent status --output json]
    fixture.go:657: >> running binary with: [/tmp/TestEventLogOutputConfiguredViaFleet2549331463/001/elastic-agent-8.16.0-SNAPSHOT-linux-x86_64/elastic-agent status --output json]
    fixture.go:657: >> running binary with: [/tmp/TestEventLogOutputConfiguredViaFleet2549331463/001/elastic-agent-8.16.0-SNAPSHOT-linux-x86_64/elastic-agent status --output json]
    fixture.go:657: >> running binary with: [/tmp/TestEventLogOutputConfiguredViaFleet2549331463/001/elastic-agent-8.16.0-SNAPSHOT-linux-x86_64/elastic-agent status --output json]
    fixture.go:657: >> running binary with: [/tmp/TestEventLogOutputConfiguredViaFleet2549331463/001/elastic-agent-8.16.0-SNAPSHOT-linux-x86_64/elastic-agent status --output json]
    fixture.go:657: >> running binary with: [/tmp/TestEventLogOutputConfiguredViaFleet2549331463/001/elastic-agent-8.16.0-SNAPSHOT-linux-x86_64/elastic-agent status --output json]
    event_logging_test.go:316: 
        	Error Trace:	/home/ubuntu/agent/testing/integration/event_logging_test.go:316
        	            				/home/ubuntu/agent/testing/integration/event_logging_test.go:231
        	Error:      	Condition never satisfied
        	Test:       	TestEventLogOutputConfiguredViaFleet
        	Messages:   	could not find event log file
    container_cmd_test.go:98: >> cleaning up: killing the Elastic-Agent process
--- FAIL: TestEventLogOutputConfiguredViaFleet (88.16s)

I believe it failed due to the flakiness reported on #5159. I'm working on reproducing this case.

@ycombinator ycombinator added backport-8.15 Automated backport to the 8.15 branch with mergify and removed backport-skip labels Aug 23, 2024
@ycombinator
Copy link
Contributor

Going to backport this PR to unblock some of the backport PRs where these tests are failing.

mergify bot pushed a commit that referenced this pull request Aug 23, 2024
Fix TestEventLogFile by updating the string that needs to be searched
in the logs.

(cherry picked from commit b96a4ca)
ycombinator pushed a commit that referenced this pull request Aug 23, 2024
Fix TestEventLogFile by updating the string that needs to be searched
in the logs.

(cherry picked from commit b96a4ca)

Co-authored-by: Tiago Queiroz <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-8.15 Automated backport to the 8.15 branch with mergify skip-changelog Team:Elastic-Agent-Data-Plane Label for the Agent Data Plane team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Flaky Test]: TestEventLogFile – did not find the expected log entry ... in the events log file
3 participants