Exemplo n.º 1
0
        public static async Task <IActionResult> Run([HttpTrigger(AuthorizationLevel.Function, "get", "post", Route = null)] HttpRequest req, ILogger log)
        {
            try
            {
                log.LogInformation($"Performance tests were started by http trigger at: {DateTime.Now}");

                string testId = string.Empty;
                req.GetQueryParameterDictionary().TryGetValue("testId", out testId);

                await PerformanceManager.Execute(testId, log);

                return(new ContentResult()
                {
                    Content = string.IsNullOrEmpty(testId) ? "All tests started" : $"Tests started: {testId}",
                    ContentType = "text/html"
                });
            }
            catch (Exception ex)
            {
                log.LogError(ex.ToString());
                return(new ContentResult()
                {
                    Content = "Exception:" + ex,
                    ContentType = "text/html"
                });
            }
        }
        public static async Task RunV3([TimerTrigger("0 0 16 * * *", RunOnStartup = false)] TimerInfo myTimer, ILogger log)
        {
            log.LogInformation($"Performance tests were started by timer trigger at: {DateTime.Now}");

            IPerformanceRunOptionsFactory factory = new V3PerformanceRunOptionsFactory(log);
            PerformanceRunOptions         options = await factory.CreateAsync();

            await PerformanceManager.Execute(string.Empty, options, log);
        }
Exemplo n.º 3
0
        public static async Task <IActionResult> Run([HttpTrigger(AuthorizationLevel.Function, "get", "post", Route = null)] HttpRequest req, ILogger log)
        {
            try
            {
                log.LogInformation($"Performance tests were started by http trigger at: {DateTime.Now}");

                string testId = string.Empty;
                req.GetQueryParameterDictionary().TryGetValue("testId", out testId);

                if (!req.GetQueryParameterDictionary().TryGetValue("version", out string version))
                {
                    return(new BadRequestObjectResult("Specify 'version' of 'v2' or 'v3' on the query string."));
                }

                PerformanceRunOptions options = null;
                switch (version.ToLowerInvariant())
                {
                case "v2":
                    IPerformanceRunOptionsFactory v2factory = new V2PerformanceRunOptionsFactory(log);
                    options = await v2factory.CreateAsync();

                    break;

                case "v3":
                    IPerformanceRunOptionsFactory v3factory = new V3PerformanceRunOptionsFactory(log);
                    options = await v3factory.CreateAsync();

                    break;

                default:
                    return(new BadRequestObjectResult("Specify 'version' of 'v2' or 'v3' on the query string."));
                }

                await PerformanceManager.Execute(testId, options, log);

                return(new ContentResult()
                {
                    Content = string.IsNullOrEmpty(testId) ? "All tests started" : $"Tests started: {testId}",
                    ContentType = "text/html"
                });
            }
            catch (Exception ex)
            {
                log.LogError(ex.ToString());
                return(new ContentResult()
                {
                    Content = "Exception:" + ex,
                    ContentType = "text/html"
                });
            }
        }
Exemplo n.º 4
0
        public static async Task <IActionResult> Run([HttpTrigger(AuthorizationLevel.Function, "get", "post", Route = null)] HttpRequest req, ILogger log)
        {
            log.LogInformation($"Performance tests were started by http trigger at: {DateTime.Now}");

            string testIds = string.Empty;

            req.GetQueryParameterDictionary().TryGetValue("testIds", out testIds);

            await PerformanceManager.Execute(testIds, log);

            return(new ContentResult()
            {
                Content = "Done",
                ContentType = "text/html",
            });
        }
        public static async Task Run([TimerTrigger("0 0 14 * * *")] TimerInfo myTimer, ILogger log)
        {
            log.LogInformation($"Performance tests were started by timer trigger at: {DateTime.Now}");

            await PerformanceManager.Execute(string.Empty, log);
        }