public async Task InitializeAsync()
        {
            // start host via CLI if testing locally
            if (Constants.FunctionsHostUrl.Contains("localhost"))
            {
                // kill existing func processes
                _logger.LogInformation("Shutting down any running functions hosts..");
                FixtureHelpers.KillExistingFuncHosts();

                // start functions process
                _logger.LogInformation($"Starting functions host for {Constants.FunctionAppCollectionName}...");
                _funcProcess = FixtureHelpers.GetFuncHostProcess();
                string workingDir = _funcProcess.StartInfo.WorkingDirectory;
                _logger.LogInformation($"  Working dir: '${workingDir}' Exists: '{Directory.Exists(workingDir)}'");
                string fileName = _funcProcess.StartInfo.FileName;
                _logger.LogInformation($"  File name:   '${fileName}' Exists: '{File.Exists(fileName)}'");

                await CosmosDBHelpers.CreateDocumentCollections();

                FixtureHelpers.StartProcessWithLogging(_funcProcess, _logger);

                await TestUtility.RetryAsync(() =>
                {
                    return(Task.FromResult(TestLogs.CoreToolsLogs.Any(p => p.Contains("Host lock lease acquired by instance ID"))));
                });
            }
        }
        public async Task InitializeAsync()
        {
            // start host via CLI if testing locally
            if (Constants.FunctionsHostUrl.Contains("localhost"))
            {
                // kill existing func processes
                _logger.LogInformation("Shutting down any running functions hosts..");
                FixtureHelpers.KillExistingFuncHosts();

                // start functions process
                _logger.LogInformation($"Starting functions host for {Constants.FunctionAppCollectionName}...");
                _funcProcess = FixtureHelpers.GetFuncHostProcess();
                string workingDir = _funcProcess.StartInfo.WorkingDirectory;
                _logger.LogInformation($"  Working dir: '${workingDir}' Exists: '{Directory.Exists(workingDir)}'");
                string fileName = _funcProcess.StartInfo.FileName;
                _logger.LogInformation($"  File name:   '${fileName}' Exists: '{File.Exists(fileName)}'");

                if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
                {
                    // Currently only HTTP is supported in Linux CI.
                    _funcProcess.StartInfo.ArgumentList.Add("--functions");
                    _funcProcess.StartInfo.ArgumentList.Add("HelloFromQuery");
                    _funcProcess.StartInfo.ArgumentList.Add("HelloFromJsonBody");
                    _funcProcess.StartInfo.ArgumentList.Add("HelloUsingPoco");
                    _funcProcess.StartInfo.ArgumentList.Add("ExceptionFunction");
                }

                await CosmosDBHelpers.TryCreateDocumentCollectionsAsync(_logger);

                FixtureHelpers.StartProcessWithLogging(_funcProcess, _logger);

                if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
                {
                    // ensure child processes are cleaned up
                    _jobObjectRegistry = new JobObjectRegistry();
                    _jobObjectRegistry.Register(_funcProcess);
                }

                var httpClient = new HttpClient();
                _logger.LogInformation("Waiting for host to be running...");
                await TestUtility.RetryAsync(async() =>
                {
                    try
                    {
                        var response = await httpClient.GetAsync($"{Constants.FunctionsHostUrl}/admin/host/status");
                        var content  = await response.Content.ReadAsStringAsync();
                        var doc      = JsonDocument.Parse(content);
                        if (doc.RootElement.TryGetProperty("state", out JsonElement value) &&
                            value.GetString() == "Running")
                        {
                            _logger.LogInformation($"  Current state: Running");
                            return(true);
                        }

                        _logger.LogInformation($"  Current state: {value}");
                        return(false);
                    }
                    catch
                    {
                        // Can get exceptions before host is running.
                        _logger.LogInformation($"  Current state: process starting");
                        return(false);
                    }
                }, userMessageCallback : () => string.Join(System.Environment.NewLine, TestLogs.CoreToolsLogs));
            }
        }