This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/bash | |
set -x | |
kubectl create -f https://gist.githubusercontent.com/jeffhollan/1b6a260e939f3f135f23a6f2f9404bf4/raw/e4ef5aa19ce398d97cb636d6c8668b0865871971/loadtest.yaml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases. | |
; #Warn ; Enable warnings to assist with detecting common errors. | |
SendMode Input ; Recommended for new scripts due to its superior speed and reliability. | |
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory. | |
^+1:: | |
Send, EventHub | |
Return | |
^+2:: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private static string apiEndpoint = Environment.GetEnvironmentVariables("API_ENDPOINT"); | |
[FunctionName("OddOrEvenQueue")] | |
public static async Task RunAsync(...) | |
{ | |
// ... | |
await client.PostAsync(apiEndpoint, new StringContent("Even")); | |
// ... | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static class CheckFunctionQuick | |
{ | |
public static HttpClient client = new HttpClient(); | |
[FunctionName("CheckFunctionQuick")] | |
public static async Task<IActionResult> RunAsync( | |
[HttpTrigger(AuthorizationLevel.Function, "post")]HttpRequest req, | |
ILogger log) | |
{ | |
log.LogInformation("C# Release Gate trigger function processed a request."); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Fact] | |
public async Task EvenNumberAsync() | |
{ | |
int number = 2; | |
FunctionTestLogger logger = new FunctionTestLogger(output); | |
await OddOrEvenQueue.RunAsync(number.ToString(), logger); | |
var wasEven = (from l in logger.getLogs() | |
where l.Equals("Was even") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public OddOrEvenQueueTest(ITestOutputHelper output) | |
{ | |
mockHttpMessageHandler = new Mock<MockHttpMessageHandler> { CallBase = true }; | |
this.output = output; | |
mockHttpMessageHandler | |
.Setup( | |
m => m.Send(It.IsAny<HttpRequestMessage>())) | |
.Returns( | |
new HttpResponseMessage |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var wasEven = (from l in logger.getLogs() | |
where l.Equals("Was even") | |
select l).Any(); | |
Assert.True(wasEven); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[FunctionName("OddOrEvenQueue")] | |
public static async Task RunAsync( | |
[QueueTrigger("numbers", Connection = "AzureWebJobsStorage")]string myNumber, | |
ILogger log) | |
{ | |
log.LogInformation($"Odd or even trigger fired - Queue"); | |
if (int.TryParse(myNumber, out int number)) | |
{ | |
if (number % 2 == 0) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Fact] | |
public void EvenNumber() | |
{ | |
int number = 2; | |
var request = GenerateHttpRequest(number); | |
var response = OddOrEven.Run(request, logger); | |
Assert.IsType<OkObjectResult>(response); | |
Assert.Equal("Even", ((OkObjectResult)response).Value as string); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[FunctionName("OddOrEven")] | |
public static IActionResult Run([HttpTrigger(AuthorizationLevel.Function, "get", "post")]HttpRequest req, ILogger log) | |
{ | |
log.LogInformation("Odd or even trigger fired - HTTP"); | |
string numberQueryValue = req.Query["number"]; | |
if (int.TryParse(numberQueryValue, out int number)) | |
{ | |
return new OkObjectResult(number % 2 == 0 ? "Even" : "Odd"); |