Skip to content

Commit

Permalink
modifying tests to see if they work
Browse files Browse the repository at this point in the history
  • Loading branch information
aishwaryabh committed Sep 11, 2024
1 parent 525aa6b commit 38b3920
Showing 1 changed file with 16 additions and 50 deletions.
66 changes: 16 additions & 50 deletions test/Azure.Functions.Cli.Tests/E2E/StartTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ await CliTester.Run(new RunConfiguration
},
Test = async (workingDir, p) =>
{
using (var client = new HttpClient() { BaseAddress = new Uri("http://localhost:7071/") })
using (var client = new HttpClient() { BaseAddress = new Uri("http://localhost:7077/") })
{
(await WaitUntilReady(client)).Should().BeTrue(because: _serverNotReady);
var response = await client.GetAsync("/api/HttpTrigger?name=Test");
Expand Down Expand Up @@ -106,7 +106,7 @@ await CliTester.Run(new RunConfiguration
{
"init . --worker-runtime node",
"new --template \"Http trigger\" --name HttpTrigger",
"start --verbose --language-worker --port 7078 -- \"--inspect=5050\""
"start --verbose --language-worker -- \"--inspect=5050\""
},
ExpectExit = false,
OutputContains = new[]
Expand All @@ -115,7 +115,7 @@ await CliTester.Run(new RunConfiguration
},
Test = async (_, p) =>
{
await Task.Delay(TimeSpan.FromSeconds(15));
await Task.Delay(TimeSpan.FromSeconds(30));
p.Kill();
},
CommandTimeout = TimeSpan.FromSeconds(300)
Expand Down Expand Up @@ -174,7 +174,7 @@ await CliTester.Run(new RunConfiguration[]
{
Commands = new[]
{
"start"
"start --port 5000"
},
ExpectExit = false,
OutputContains = new []
Expand All @@ -184,7 +184,7 @@ await CliTester.Run(new RunConfiguration[]
Test = async (_, p) =>
{
// give the host time to load functions and print any errors
await Task.Delay(TimeSpan.FromSeconds(10));
await Task.Delay(TimeSpan.FromSeconds(60));
p.Kill();
}
},
Expand Down Expand Up @@ -263,7 +263,7 @@ await CliTester.Run(new RunConfiguration[]
{
Commands = new[]
{
"start"
"start --port 5005"
},
ExpectExit = false,
OutputContains = new []
Expand Down Expand Up @@ -309,7 +309,7 @@ await CliTester.Run(new RunConfiguration
result.Should().Be("Hello, Test. This HTTP triggered function executed successfully.", because: "response from default function should be 'Hello, {name}. This HTTP triggered function executed successfully.'");
}
},
CommandTimeout = TimeSpan.FromSeconds(300),
CommandTimeout = TimeSpan.FromSeconds(900),
}, _output);
}

Expand Down Expand Up @@ -338,7 +338,7 @@ await CliTester.Run(new RunConfiguration
result.Should().Be("Welcome to Azure Functions!", because: "response from default function should be 'Welcome to Azure Functions!'");
}
},
CommandTimeout = TimeSpan.FromSeconds(300),
CommandTimeout = TimeSpan.FromSeconds(900),
}, _output);
}

Expand Down Expand Up @@ -387,12 +387,12 @@ await CliTester.Run(new RunConfiguration
{
"init . --worker-runtime dotnet --target-framework net8.0",
"new --template Httptrigger --name HttpTrigger",
"start --port 7073 --verbose --runtime inproc8"
"start --port 7070 --verbose --runtime inproc8"
},
ExpectExit = false,
Test = async (workingDir, p) =>
{
using (var client = new HttpClient() { BaseAddress = new Uri("http://localhost:7073") })
using (var client = new HttpClient() { BaseAddress = new Uri("http://localhost:7070") })
{
(await WaitUntilReady(client)).Should().BeTrue(because: _serverNotReady);
var response = await client.GetAsync("/api/HttpTrigger?name=Test");
Expand Down Expand Up @@ -443,7 +443,7 @@ await CliTester.Run(new RunConfiguration
}
}
},
CommandTimeout = TimeSpan.FromSeconds(300),
CommandTimeout = TimeSpan.FromSeconds(900),
}, _output);
}

Expand Down Expand Up @@ -476,7 +476,7 @@ await CliTester.Run(new RunConfiguration
}
}
},
CommandTimeout = TimeSpan.FromSeconds(300),
CommandTimeout = TimeSpan.FromSeconds(900),
}, _output);
}

Expand Down Expand Up @@ -511,7 +511,7 @@ await CliTester.Run(new RunConfiguration
}
}
},
CommandTimeout = TimeSpan.FromSeconds(300),
CommandTimeout = TimeSpan.FromSeconds(900),
}, _output);
}

Expand Down Expand Up @@ -545,41 +545,7 @@ await CliTester.Run(new RunConfiguration
}
}
},
CommandTimeout = TimeSpan.FromSeconds(300),
}, _output);
}

[Fact]
public async Task start_dotnet_in_proc_csharp_with_oop_host_without_runtime_specified()
{
await CliTester.Run(new RunConfiguration
{
Commands = new[]
{
"init . --worker-runtime dotnet-isolated",
"new --template Httptrigger --name HttpTrigger",
"start --port 7073 --verbose"
},
ExpectExit = false,
Test = async (workingDir, p) =>
{
using (var client = new HttpClient() { BaseAddress = new Uri("http://localhost:7073") })
{
(await WaitUntilReady(client)).Should().BeTrue(because: _serverNotReady);
var response = await client.GetAsync("/api/HttpTrigger?name=Test");
var result = await response.Content.ReadAsStringAsync();
p.Kill();
await Task.Delay(TimeSpan.FromSeconds(2));
result.Should().Be("Welcome to Azure Functions!", because: "response from default function should be 'Welcome to Azure Functions!'");

if (_output is Xunit.Sdk.TestOutputHelper testOutputHelper)
{
testOutputHelper.Output.Should().Contain("4.10");
testOutputHelper.Output.Should().Contain("Selected out-of-process-host");
}
}
},
CommandTimeout = TimeSpan.FromSeconds(300),
CommandTimeout = TimeSpan.FromSeconds(900),
}, _output);
}

Expand Down Expand Up @@ -823,12 +789,12 @@ await CliTester.Run(new RunConfiguration
"new --template \"Http trigger\" --name http1",
"new --template \"Http trigger\" --name http2",
"new --template \"Http trigger\" --name http3",
"start --functions http2 http1"
"start --functions http2 http1 --port 5001"
},
ExpectExit = false,
Test = async (workingDir, p) =>
{
using (var client = new HttpClient() { BaseAddress = new Uri("http://localhost:7071/") })
using (var client = new HttpClient() { BaseAddress = new Uri("http://localhost:5001/") })
{
(await WaitUntilReady(client)).Should().BeTrue(because: _serverNotReady);
var response = await client.GetAsync("/api/http1?name=Test");
Expand Down

0 comments on commit 38b3920

Please sign in to comment.