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 problems running E2E tests locally #957

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

DaveTryon
Copy link
Contributor

As called out in #930, we have recently begun to have local E2E test failures. Upon investigation, the problem was determined that the test logs are being written to the folder we are using as the BuildDropPath, and that causes the SBOM validation to fail. This seems to be a recent change (bug?) in Visual Studio--we have been able to specify the --results-directory parameter when running from the command line, but attempts to change it when running from inside Visual Studio have proven unsuccessful.

This PR works around the problem by copying the existing folder to a temporary folder before running the tests, then cleaning up the temporary folder after the tests complete. Since the Microsoft.Sbom.Targets.Tests project has both net472 and net80 targets, we need to ensure that each target has its own directory.

The AbstractGenerateSbomTaskInputTests.cs and AbstractGenerateSbomTaskTests.cs tests were refactored to allow the names of the concrete classes to be passed into the abstract base classes. The old code used CurrentDirectory, which no longer seemed correct, so I renamed it to TestBuildDropPath. The SPDX 3.0 E2E tests will probably use these same abstract classes.

I'm not thrilled with having 3 copies of the Xcopy function. At one point I had it down to 2 copies (one per project), but once it was written, the extra overhead was worse than having the extra copy. Happy to entertain options here if people have strong feelings.

@DaveTryon DaveTryon requested a review from a team as a code owner March 4, 2025 06:39
@DaveTryon
Copy link
Contributor Author

/azp run

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant