Skip to content

Try using xml logger #18491

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

Merged
merged 11 commits into from
Jan 24, 2020
Merged

Try using xml logger #18491

merged 11 commits into from
Jan 24, 2020

Conversation

HaoK
Copy link
Member

@HaoK HaoK commented Jan 21, 2020

Try using xml vstest logger instead of trx to try and get xunit reporter working. Also add support for logs to windows command and various minor cleanup

@ghost ghost added the area-infrastructure Includes: MSBuild projects/targets, build scripts, CI, Installers and shared framework label Jan 21, 2020
@HaoK
Copy link
Member Author

HaoK commented Jan 23, 2020

@MattGal can you help me figure out where I need to copy the xml test results file for xml reporter to upload them correctly?

We are trying to see if moving away from trx would get this to work faster, so we installed https://github.com/spekt/xunit.testlogger which is generating an xml file now, but its not being found by the reporter, I tried copying it to root, but maybe it needs to go somewhere else?

I copied TestResults.xml

Copying TestResults/* to Root/
Searching '/datadisks/disk1/work/BD980A0A/w/9A710897/e' for test results files
No results file found in any of the following formats: xunit, junit, trx
+ date -u +%FT%TZ
2020-01-23T22:39:45Z
+ /usr/bin/python3 /datadisks/disk1/work/BD980A0A/p/xunit-reporter.py
2020-01-23T22:39:45.919Z	ERROR  	xunit-reporter.py	xunit-reporter(80)	main	Unable to report xunit results: no test results xml file found.
+ exit 1

@HaoK HaoK requested review from analogrelay and a team January 23, 2020 23:26
@MattGal
Copy link
Member

MattGal commented Jan 24, 2020

@MattGal can you help me figure out where I need to copy the xml test results file for xml reporter to upload them correctly?

We are trying to see if moving away from trx would get this to work faster, so we installed https://github.com/spekt/xunit.testlogger which is generating an xml file now, but its not being found by the reporter, I tried copying it to root, but maybe it needs to go somewhere else?

I copied TestResults.xml

Copying TestResults/* to Root/
Searching '/datadisks/disk1/work/BD980A0A/w/9A710897/e' for test results files
No results file found in any of the following formats: xunit, junit, trx
+ date -u +%FT%TZ
2020-01-23T22:39:45Z
+ /usr/bin/python3 /datadisks/disk1/work/BD980A0A/p/xunit-reporter.py
2020-01-23T22:39:45.919Z	ERROR  	xunit-reporter.py	xunit-reporter(80)	main	Unable to report xunit results: no test results xml file found.
+ exit 1

Some points:

  • If you want XUnit reporter to find your XML, it should just be in $HELIX_WORKITEM_ROOT . This line and the related function do a non-recursive walk of this folder. Since you want to ingest your xunit to Kusto this is the one you want.
  • Often this won't hurt folks, but please avoid copying files into root (on docker work items it really doesn't matter) because they will never be cleaned up til the machine is deleted.
  • If you just want a file uploaded, put a copy of it (or ideally create it initially) under $HELIX_WORKITEM_UPLOAD_ROOT.
  • XUnit output names arbitraily need to match (case-sensitive because Linux):
acceptableXUnitFileNames = [
    "testResults.xml",
    "test-results.xml",
    "test_results.xml"
]

@analogrelay
Copy link
Contributor

I see results in Kusto! 🎉

echo "Copying TestResults\* to Root\"
for /r TestResults %x in (*.xml) do copy "%x" out
echo "Copying TestResults\TestResults.xml to ."
copy TestResults\TestResults.xml testResults.xml
Copy link
Contributor

Choose a reason for hiding this comment

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

Of course, this means we're only going to get data from un-quarantined tests. We should come up with a plan for how to get this data out. Maybe we have to rethink our quarantine process.

If we ran a single run of all tests, we'd still be able to tell if they were quarantined or not by the traits. Unfortunately, the run would fail even when only quarantined tests fail.

Another option is to change how the quarantine process works and just skip tests that are quarantined. It would mean we can't monitor them for when they get non-flaky, but we'd still be able to track which tests were skipped because they were flaky and track the number of skipped flaky tests over time so that teams can drive that number down.

Food for thought at the next DoI meeting :).

Copy link
Member Author

Choose a reason for hiding this comment

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

I think we should probably just add a flaky-test.yml and just run all tests in that run every day on master, and get rid of the flaky test pass in our normal PRs

Copy link
Member Author

Choose a reason for hiding this comment

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

Then we'd have all the data in kusto

Copy link
Contributor

Choose a reason for hiding this comment

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

Yep, I think a separate run is the solution. I think we can (and should) continue running them on PRs if we can though. The main downside is that for projects with no quarantined tests, we’ll submit a Helix work item with almost no action, it will run 0 tests. We could start with that though. I did some spelunking and it’s definitely feasible to run a little code to check a test assembly (once built) for any quarantined tests using the vstest APIs. That way we could save submitting a no-op job to helix.

Copy link
Member Author

Choose a reason for hiding this comment

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

Cool maybe we can just repurpose the old helix-test pipeline to be the flaky helix test run

@HaoK
Copy link
Member Author

HaoK commented Jan 24, 2020

Windows and linux look like they are working now, marking as ready for review

@HaoK HaoK marked this pull request as ready for review January 24, 2020 09:37
@HaoK HaoK merged commit 9501874 into master Jan 24, 2020
@HaoK HaoK deleted the haok/testlog branch January 24, 2020 17:38
@Pilchie
Copy link
Member

Pilchie commented Jan 24, 2020

Hooray!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-infrastructure Includes: MSBuild projects/targets, build scripts, CI, Installers and shared framework
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants