@@ -15,8 +15,11 @@ public GivenDotnetWorkloadRestore(ITestOutputHelper log) : base(log)
15
15
[ Fact ]
16
16
public void ProjectsThatDoNotSupportWorkloadsAreNotInspected ( )
17
17
{
18
- var testDir = _testAssetsManager . CreateTestDirectory ( ) . Path ;
19
- var cliHome = Path . Combine ( testDir , ".home" ) ;
18
+ if ( IsRunningInContainer ( ) )
19
+ {
20
+ // Skipping test in a Helix container environment due to read-only DOTNET_ROOT, which causes workload restore to fail when writing workload metadata.
21
+ return ;
22
+ }
20
23
21
24
var projectPath =
22
25
_testAssetsManager
@@ -26,7 +29,6 @@ public void ProjectsThatDoNotSupportWorkloadsAreNotInspected()
26
29
27
30
new DotnetWorkloadCommand ( Log , "restore" )
28
31
. WithWorkingDirectory ( projectPath )
29
- . WithEnvironmentVariable ( "DOTNET_CLI_HOME" , cliHome )
30
32
. Execute ( )
31
33
. Should ( )
32
34
// if we did try to restore the dcproj in this TestAsset we would fail, so passing means we didn't!
@@ -36,8 +38,11 @@ public void ProjectsThatDoNotSupportWorkloadsAreNotInspected()
36
38
[ Fact ]
37
39
public void ProjectsThatDoNotSupportWorkloadsAndAreTransitivelyReferencedDoNotBreakTheBuild ( )
38
40
{
39
- var testDir = _testAssetsManager . CreateTestDirectory ( ) . Path ;
40
- var cliHome = Path . Combine ( testDir , ".home" ) ;
41
+ if ( IsRunningInContainer ( ) )
42
+ {
43
+ // Skipping test in a Helix container environment due to read-only DOTNET_ROOT, which causes workload restore to fail when writing workload metadata.
44
+ return ;
45
+ }
41
46
42
47
var projectPath =
43
48
_testAssetsManager
@@ -47,10 +52,14 @@ public void ProjectsThatDoNotSupportWorkloadsAndAreTransitivelyReferencedDoNotBr
47
52
48
53
new DotnetWorkloadCommand ( Log , "restore" )
49
54
. WithWorkingDirectory ( projectPath )
50
- . WithEnvironmentVariable ( "DOTNET_CLI_HOME" , cliHome )
51
55
. Execute ( )
52
56
. Should ( )
53
57
// if we did try to restore the esproj in this TestAsset we would fail, so passing means we didn't!
54
58
. Pass ( ) ;
55
59
}
60
+
61
+ private bool IsRunningInContainer ( )
62
+ {
63
+ return File . Exists ( "/.dockerenv" ) && RuntimeInformation . OSDescription . Contains ( "Ubuntu" ) ;
64
+ }
56
65
}
0 commit comments