@@ -92,7 +92,7 @@ func TestImportManagerHasServiceErrorNoMultipleServicesWithAppHost(t *testing.T)
92
92
slices .Contains (args .Args , "--getProperty:IsAspireHost" )
93
93
}).RespondFn (func (args exec.RunArgs ) (exec.RunResult , error ) {
94
94
return exec.RunResult {
95
- Stdout : "true" ,
95
+ Stdout : aspireAppHostSniffResult ,
96
96
ExitCode : 0 ,
97
97
}, nil
98
98
})
@@ -145,7 +145,7 @@ func TestImportManagerHasServiceErrorAppHostMustTargetContainerApp(t *testing.T)
145
145
slices .Contains (args .Args , "--getProperty:IsAspireHost" )
146
146
}).RespondFn (func (args exec.RunArgs ) (exec.RunResult , error ) {
147
147
return exec.RunResult {
148
- Stdout : "true" ,
148
+ Stdout : aspireAppHostSniffResult ,
149
149
ExitCode : 0 ,
150
150
}, nil
151
151
})
@@ -278,7 +278,7 @@ func TestImportManagerProjectInfrastructureAspire(t *testing.T) {
278
278
slices .Contains (args .Args , "--getProperty:IsAspireHost" )
279
279
}).RespondFn (func (args exec.RunArgs ) (exec.RunResult , error ) {
280
280
return exec.RunResult {
281
- Stdout : "true" ,
281
+ Stdout : aspireAppHostSniffResult ,
282
282
ExitCode : 0 ,
283
283
}, nil
284
284
})
@@ -462,3 +462,52 @@ func TestImportManager_SynthAllInfrastructure_FromResources(t *testing.T) {
462
462
_ , err = im .SynthAllInfrastructure (context .Background (), prjConfig )
463
463
assert .Error (t , err )
464
464
}
465
+
466
+ // aspireAppHostSniffResult is mock data that would be returned by `dotnet msbuild` when fetching information about an
467
+ // Aspire project. This is used to simulate the scenario where a project is an Aspire project. A real Aspire project would
468
+ // have many entries in the ProjectCapability array (unrelated to the Aspire capability), but most have been omitted for
469
+ // simplicity. An unrelated entry is included to ensure we are looking at the entire array of capabilities.
470
+ // nolint: lll
471
+ var aspireAppHostSniffResult string = `{
472
+ "Properties": {
473
+ "IsAspireHost": "true"
474
+ },
475
+ "Items": {
476
+ "ProjectCapability": [
477
+ {
478
+ "Identity": "LocalUserSecrets",
479
+ "FullPath": "/Users/matell/dd/ellismg/AspireBicep/AspireStarter/AspireStarter.AppHost/LocalUserSecrets",
480
+ "RootDir": "/",
481
+ "Filename": "LocalUserSecrets",
482
+ "Extension": "",
483
+ "RelativeDir": "",
484
+ "Directory": "Users/matell/dd/ellismg/AspireBicep/AspireStarter/AspireStarter.AppHost/",
485
+ "RecursiveDir": "",
486
+ "ModifiedTime": "",
487
+ "CreatedTime": "",
488
+ "AccessedTime": "",
489
+ "DefiningProjectFullPath": "/Users/matell/.nuget/packages/microsoft.extensions.configuration.usersecrets/8.0.0/buildTransitive/net6.0/Microsoft.Extensions.Configuration.UserSecrets.props",
490
+ "DefiningProjectDirectory": "/Users/matell/.nuget/packages/microsoft.extensions.configuration.usersecrets/8.0.0/buildTransitive/net6.0/",
491
+ "DefiningProjectName": "Microsoft.Extensions.Configuration.UserSecrets",
492
+ "DefiningProjectExtension": ".props"
493
+ },
494
+ {
495
+ "Identity": "Aspire",
496
+ "FullPath": "/Users/matell/dd/ellismg/AspireBicep/AspireStarter/AspireStarter.AppHost/Aspire",
497
+ "RootDir": "/",
498
+ "Filename": "Aspire",
499
+ "Extension": "",
500
+ "RelativeDir": "",
501
+ "Directory": "Users/matell/dd/ellismg/AspireBicep/AspireStarter/AspireStarter.AppHost/",
502
+ "RecursiveDir": "",
503
+ "ModifiedTime": "",
504
+ "CreatedTime": "",
505
+ "AccessedTime": "",
506
+ "DefiningProjectFullPath": "/Users/matell/.nuget/packages/aspire.hosting.apphost/8.2.0/build/Aspire.Hosting.AppHost.targets",
507
+ "DefiningProjectDirectory": "/Users/matell/.nuget/packages/aspire.hosting.apphost/8.2.0/build/",
508
+ "DefiningProjectName": "Aspire.Hosting.AppHost",
509
+ "DefiningProjectExtension": ".targets"
510
+ }
511
+ ]
512
+ }
513
+ }`
0 commit comments