public async Task NativeDependency_NoRuntimes()
        {
            // Test that we load the correct native assembly when built against a rid, which removed
            // the runtimes folder. We should be finding the assembly in the bin dir directly.

            await RunTest(async() =>
            {
                var config       = TestHelpers.GetTestConfiguration();
                var connStr      = config.GetConnectionString("CosmosDB");
                string cosmosKey = "ConnectionStrings__CosmosDB";

                var envVars = new Dictionary <string, string>
                {
                    { cosmosKey, connStr }
                };

                _launcher = new HostProcessLauncher("NativeDependencyNoRuntimes", envVars);
                await _launcher.StartHostAsync();

                var client   = _launcher.HttpClient;
                var response = await client.GetAsync($"api/NativeDependencyNoRuntimes");

                // The function does all the validation internally.
                Assert.Equal(HttpStatusCode.OK, response.StatusCode);
            });
        }
        public async Task NativeDependency_Quirks()
        {
            // Test a specific bug that hit on v2 with earlier versions of the VS SDK, only
            // when publishing

            await RunTest(async() =>
            {
                var config       = TestHelpers.GetTestConfiguration();
                var connStr      = config.GetConnectionString("CosmosDB");
                string cosmosKey = "ConnectionStrings__CosmosDB";

                var envVars = new Dictionary <string, string>
                {
                    { cosmosKey, connStr }
                };

                _launcher = new HostProcessLauncher("NativeDependencyOldSdk", envVars, usePublishPath: true, "netcoreapp2.2");
                await _launcher.StartHostAsync();

                var client   = _launcher.HttpClient;
                var response = await client.GetAsync($"api/NativeDependencyOldSdk");

                // The function does all the validation internally.
                Assert.Equal(HttpStatusCode.OK, response.StatusCode);
            });
        }
        public async Task Fallback_IsThreadSafe()
        {
            await RunTest(async() =>
            {
                _launcher = new HostProcessLauncher("AssemblyLoadContextRace");
                await _launcher.StartHostAsync();

                var client   = _launcher.HttpClient;
                var response = await client.GetAsync($"api/Function1");

                // The function does all the validation internally.
                Assert.Equal(HttpStatusCode.OK, response.StatusCode);
            });
        }
Beispiel #4
0
        public async Task Fallback_IsThreadSafe()
        {
            await RunTest(async() =>
            {
                _launcher = new HostProcessLauncher("AssemblyLoadContextRace");
                await _launcher.StartHostAsync();

                var client   = _launcher.HttpClient;
                var response = await client.GetAsync($"api/Function1");

                // The function does all the validation internally.
                Assert.True(HttpStatusCode.OK == response.StatusCode, $"Test failed with {response.StatusCode}: {await response.Content.ReadAsStringAsync()}");
            });
        }
        public async Task MultipleDepenendencyVersions()
        {
            // Test that we consult the deps file

            await RunTest(async() =>
            {
                _launcher = new HostProcessLauncher("MultipleDependencyVersions");
                await _launcher.StartHostAsync();

                var client   = _launcher.HttpClient;
                var response = await client.GetAsync($"api/MultipleDependencyVersions");

                // The function does all the validation internally.
                Assert.Equal(HttpStatusCode.OK, response.StatusCode);
            });
        }
Beispiel #6
0
        public async Task MultipleDepenendencyVersions()
        {
            // Test that we consult the deps file

            await RunTest(async() =>
            {
                _launcher = new HostProcessLauncher("MultipleDependencyVersions");
                await _launcher.StartHostAsync();

                var client   = _launcher.HttpClient;
                var response = await client.GetAsync($"api/MultipleDependencyVersions");

                // The function does all the validation internally.
                Assert.True(HttpStatusCode.OK == response.StatusCode, $"Test failed with {response.StatusCode}: {await response.Content.ReadAsStringAsync()}");
            });
        }
        public async Task ReferenceOlderRuntimeAssembly()
        {
            // Test that we still return host version, even if it's a major version below.
            // The test project used repros the scenario because it references the Storage extension,
            // which has references to Extensions.Hosting.Abstractions 2.1. The project itself directly
            // references 2.2 of this assembly and before the fix, would throw an exception on Startup.

            await RunTest(async() =>
            {
                _launcher = new HostProcessLauncher("ReferenceOlderRuntimeAssembly");
                await _launcher.StartHostAsync();

                var client   = _launcher.HttpClient;
                var response = await client.GetAsync($"api/ReferenceOlderRuntimeAssembly");

                // The function does all the validation internally.
                Assert.Equal(HttpStatusCode.OK, response.StatusCode);
            });
        }