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

Moved src/Assets to test/TestAssets #41924

Merged
merged 18 commits into from
Jul 12, 2024

Conversation

MiYanni
Copy link
Member

@MiYanni MiYanni commented Jul 2, 2024

Summary

From when src/Tests was moved to test, I did not realize at that time that everything in src/Assets are also only test assets. I ran into this situation when attempting to get the Installer tests running in Helix, as their test assets were in test/TestAssets. So, this PR is to merge both together into test/TestAssets.

A majority of the files were moved over with no changes. Some files were deleted as those existed in both locations. Therefore, I just moved the changes from the 'newer' src/Assets files into the ones that already existed. You'll also see files being deleted and the new files being created if the folder already existed in the destination. Otherwise, everything else was just a simple 'rename'.

Manual File Changes

  • sdk.sln
  • TemplateEngine.slnf
  • CODEOWNERS
  • build/RunTestsOnHelix.cmd
  • build/RunTestsOnHelix.sh
  • test/UnitTests.proj
  • test/Directory.Build.targets
  • test/TestAssets/Directory.Build.props
  • test/TestAssets/Directory.Build.targets
  • test/Microsoft.NET.TestFramework/BuildTestPackages.targets
  • src/Cli/dotnet/commands/dotnet-new/README.md
  • src/Layout/redist/targets/OverlaySdkOnLKG.targets
  • src/SourceBuild/content/eng/allowed-vmr-binaries.txt

@MiYanni MiYanni requested a review from a team July 2, 2024 18:25
@MiYanni MiYanni requested review from tmat, arkalyanms and a team as code owners July 2, 2024 18:25
@dotnet-issue-labeler dotnet-issue-labeler bot added Area-dotnet new the item is related to dotnet new command untriaged Request triage from a team member labels Jul 2, 2024
@MiYanni MiYanni requested review from a team as code owners July 2, 2024 22:14
@MiYanni
Copy link
Member Author

MiYanni commented Jul 12, 2024

FYI, when this goes to be merged, I will squash merge it to remove the debugging commits I made to find the LinkBase Asset rename I missed originally.

@@ -145,7 +139,7 @@ public static void Initialize(TestCommandLine commandLine)
{
testContext.TestExecutionDirectory = (Path.Combine(FindFolderInTree("artifacts", AppContext.BaseDirectory), "tmp", repoConfiguration));

testContext.TestAssetsDirectory = FindFolderInTree(Path.Combine("src", "Assets"), AppContext.BaseDirectory);
testContext.TestAssetsDirectory = FindFolderInTree(Path.Combine("test", "TestAssets"), AppContext.BaseDirectory);
Copy link
Member

Choose a reason for hiding this comment

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

Can we put test and TestAssets in constants somewhere. They appear more than once and someone is going to miss making a future change and only modify one occurrence.

Copy link
Member Author

Choose a reason for hiding this comment

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

To be blunt, this code is confusing enough. I'd rather just write it logically to represent the scenarios that are necessary. Right now, I don't know those scenarios precisely without tearing everything apart and refactoring it.

That said, investing more right now into this file to "clean it up" isn't worth it. If you want me to do that, I'd rather do it in a separate PR. This PR is to simply move the folder. This entire file should have constants that represent the expected paths, not just test and TestAssets. For example, TestAssets exists in different locations and is used for different purposes. Adding constants for them doesn't actually represent the correct way this stuff is used. I can talk offline if you want about it, but it is also why it took me 3+ days to figure out 1 folder that was named wrong.

Copy link
Member

Choose a reason for hiding this comment

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

I do agree with @joeloff it's a wonderful idea to have these as constants somewhere, but I also think that's a big enough change that it would be easier to review in a separate PR as @MiYanni suggests.

@@ -79,7 +79,7 @@

<LockFiles Include="..\src\Tasks\Microsoft.NET.Build.Tasks.UnitTests\LockFiles\**\*.*" />

<AssetFiles Include="..\src\Assets\**\**\**\*.*" />
<AssetFiles Include="TestAssets\**\*.*" />
Copy link
Member

Choose a reason for hiding this comment

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

Should we consider putting this behind a $(TestAssets) property?

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 this is fine for now. The design of TestAssets is actually incorrect to begin with. It assumes that all test projects require ALL TestAssets, which is wrong. So, we do a lot of duplicate file copying. I'd have to refactor the test projects to make sense. I've discussed this with Marc, but it isn't something I can focus effort on right now.

Copy link
Member

@nagilson nagilson left a comment

Choose a reason for hiding this comment

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

The changes look good to me, thanks for moving these assets over and cleaning stuff up as always. This file structure makes more sense. :)

@MiYanni MiYanni merged commit 68681c1 into dotnet:main Jul 12, 2024
37 checks passed
@MiYanni MiYanni mentioned this pull request Jul 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-dotnet new the item is related to dotnet new command untriaged Request triage from a team member
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants