Skip to content

Commit

Permalink
stashy
Browse files Browse the repository at this point in the history
  • Loading branch information
rysweet committed Jan 17, 2025
1 parent 1809b62 commit 6ae6067
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 9 deletions.
2 changes: 1 addition & 1 deletion dotnet/samples/Hello/Hello.AppHost/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
.WaitFor(backend);
#pragma warning disable ASPIREHOSTINGPYTHON001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed.
// xlang is over http for now - in prod use TLS between containers
builder.AddPythonApp("HelloAgentsPython", "../../../../python/packages/autogen-core/samples/xlang/hello_python_agent", "hello_python_agent.py", "../../../../../.venv")
builder.AddPythonApp("HelloAgentsPython", "../../../../python/samples/core_xlang_hello_python_agent", "hello_python_agent.py", "../../.venv")
.WithReference(backend)
.WithEnvironment("AGENT_HOST", backend.GetEndpoint("http"))
.WithEnvironment("STAY_ALIVE_ON_GOODBYE", "true")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": true,
"applicationUrl": "https://localhost:50670;http://localhost:50673",
"applicationUrl": "https://localhost:53071;http://localhost:50673",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
Expand Down
5 changes: 4 additions & 1 deletion dotnet/src/Microsoft.AutoGen/AgentHost/appsettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@
"LogLevel": {
"Default": "Warning",
"Microsoft": "Warning",
"Microsoft.Orleans": "Warning"
"Microsoft.Hosting.Lifetime": "Information",
"Microsoft.AspNetCore": "Information",
"Microsoft.Orleans": "Warning",
"Orleans.Runtime": "Warning"
}
},
"AllowedHosts": "*",
Expand Down
17 changes: 11 additions & 6 deletions dotnet/test/Microsoft.AutoGen.Core.Grpc.Tests/AgentGrpcTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ namespace Microsoft.AutoGen.Core.Grpc.Tests;
[Collection(GrpcClusterFixtureCollection.Name)]
public class AgentGrpcTests(GrpcRuntimeFixture fixture)
{
private readonly IServiceProvider _serviceProvider = fixture.AppHost.Services;
private readonly GrpcRuntimeFixture _fixture = fixture;
// need a variable to store the runtime instance
public static WebApplication? Host { get; private set; }
Expand All @@ -30,7 +29,7 @@ public class AgentGrpcTests(GrpcRuntimeFixture fixture)
[Fact]
public async Task Agent_ShouldThrowException_WhenNotInitialized()
{
var agent = ActivatorUtilities.CreateInstance<TestAgent>(_serviceProvider);
var agent = ActivatorUtilities.CreateInstance<TestAgent>(_fixture.Client.Services);
await Assert.ThrowsAsync<UninitializedAgentWorker.AgentInitalizedIncorrectlyException>(
async () =>
{
Expand Down Expand Up @@ -130,12 +129,18 @@ public async Task PublishMessageAsync_and_ReceiveMessageTest()
}
}
Assert.True(found);
/* await AgentsApp.PublishMessageAsync("TestEvent", new TextMessage()
{
Source = "TestEvent",
TextMessage_ = "buffer"
}, local: false).ConfigureAwait(true);
*/
await agent.PublishMessageAsync(new TextMessage()
{
Source = "TestEvent",
TextMessage_ = "buffer"
}).ConfigureAwait(true);
await Task.Delay(100);
await Task.Delay(10000);
Assert.True(TestAgent.ReceivedMessages.ContainsKey("TestEvent"));
_fixture.Stop();
}
Expand All @@ -156,7 +161,7 @@ public async Task InvokeCorrectHandler()
[Fact]
public async Task DelegateMessageToTestAgentAsync()
{
var client = _fixture.AppHost.Services.GetRequiredService<Client>();
var client = _fixture.Client.Services.GetRequiredService<Client>();
await client.PublishMessageAsync(new TextMessage()
{
Source = nameof(DelegateMessageToTestAgentAsync),
Expand Down Expand Up @@ -234,7 +239,7 @@ private static async Task<IHost> StartAppHostAsync()

}
public IHost Client { get; }
public IHost AppHost { get; }
public IHost? AppHost { get; }

/// <summary>
/// Start - starts the agent
Expand All @@ -253,7 +258,7 @@ private static async Task<IHost> StartAppHostAsync()
/// <returns>void</returns>
public void Stop()
{
IHostApplicationLifetime hostApplicationLifetime = AppHost.Services.GetRequiredService<IHostApplicationLifetime>();
IHostApplicationLifetime hostApplicationLifetime = Client.Services.GetRequiredService<IHostApplicationLifetime>();
hostApplicationLifetime.StopApplication();
}
}
Expand Down

0 comments on commit 6ae6067

Please sign in to comment.