Browse Source

Infrastructure and test cleanup (#359)

pull/368/head
Justin Kotalik 6 years ago
committed by GitHub
parent
commit
935e680f25
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 161
      samples/multi-project/multi-project-production.example.yaml
  2. 28
      test/E2ETest/TestHelpers.cs
  3. 114
      test/E2ETest/TyeAssert.cs
  4. 8
      test/E2ETest/TyeBuildTests.cs
  5. 8
      test/E2ETest/TyeGenerateTests.cs
  6. 51
      test/E2ETest/TyeInitTests.cs
  7. 4
      test/E2ETest/TyePurgeTests.cs
  8. 45
      test/E2ETest/TyeRunTests.cs
  9. 10
      test/E2ETest/testassets/init/single-project.yaml
  10. 7
      test/E2ETest/testassets/projects/apps-with-ingress/ApplicationA/ApplicationA.csproj
  11. 26
      test/E2ETest/testassets/projects/apps-with-ingress/ApplicationA/Program.cs
  12. 27
      test/E2ETest/testassets/projects/apps-with-ingress/ApplicationA/Properties/launchSettings.json
  13. 40
      test/E2ETest/testassets/projects/apps-with-ingress/ApplicationA/Startup.cs
  14. 6
      test/E2ETest/testassets/projects/apps-with-ingress/ApplicationA/appsettings.Development.json
  15. 20
      test/E2ETest/testassets/projects/apps-with-ingress/ApplicationA/appsettings.json
  16. 7
      test/E2ETest/testassets/projects/apps-with-ingress/ApplicationB/ApplicationB.csproj
  17. 26
      test/E2ETest/testassets/projects/apps-with-ingress/ApplicationB/Program.cs
  18. 27
      test/E2ETest/testassets/projects/apps-with-ingress/ApplicationB/Properties/launchSettings.json
  19. 40
      test/E2ETest/testassets/projects/apps-with-ingress/ApplicationB/Startup.cs
  20. 6
      test/E2ETest/testassets/projects/apps-with-ingress/ApplicationB/appsettings.Development.json
  21. 20
      test/E2ETest/testassets/projects/apps-with-ingress/ApplicationB/appsettings.json
  22. 48
      test/E2ETest/testassets/projects/apps-with-ingress/apps-with-ingress.sln
  23. 28
      test/E2ETest/testassets/projects/apps-with-ingress/tye.yaml
  24. 24
      test/E2ETest/testassets/projects/frontend-backend/backend/Program.cs
  25. 27
      test/E2ETest/testassets/projects/frontend-backend/backend/Properties/launchSettings.json
  26. 62
      test/E2ETest/testassets/projects/frontend-backend/backend/Startup.cs
  27. 6
      test/E2ETest/testassets/projects/frontend-backend/backend/appsettings.Development.json
  28. 20
      test/E2ETest/testassets/projects/frontend-backend/backend/appsettings.json
  29. 12
      test/E2ETest/testassets/projects/frontend-backend/backend/backend.csproj
  30. 99
      test/E2ETest/testassets/projects/frontend-backend/frontend-backend-production.example.yaml
  31. 48
      test/E2ETest/testassets/projects/frontend-backend/frontend-backend.sln
  32. 24
      test/E2ETest/testassets/projects/frontend-backend/frontend/Program.cs
  33. 27
      test/E2ETest/testassets/projects/frontend-backend/frontend/Properties/launchSettings.json
  34. 87
      test/E2ETest/testassets/projects/frontend-backend/frontend/Startup.cs
  35. 6
      test/E2ETest/testassets/projects/frontend-backend/frontend/appsettings.Development.json
  36. 19
      test/E2ETest/testassets/projects/frontend-backend/frontend/appsettings.json
  37. 12
      test/E2ETest/testassets/projects/frontend-backend/frontend/frontend.csproj
  38. 8
      test/E2ETest/testassets/projects/frontend-backend/tye.yaml
  39. 0
      test/E2ETest/testassets/projects/multi-project/backend/IOrderService.cs
  40. 0
      test/E2ETest/testassets/projects/multi-project/backend/Order.cs
  41. 0
      test/E2ETest/testassets/projects/multi-project/backend/OrdersService.cs
  42. 70
      test/E2ETest/testassets/projects/multi-project/backend/Program.cs
  43. 54
      test/E2ETest/testassets/projects/multi-project/backend/Properties/launchSettings.json
  44. 138
      test/E2ETest/testassets/projects/multi-project/backend/Startup.cs
  45. 9
      test/E2ETest/testassets/projects/multi-project/backend/appsettings.Development.json
  46. 10
      test/E2ETest/testassets/projects/multi-project/backend/appsettings.json
  47. 32
      test/E2ETest/testassets/projects/multi-project/backend/backend.csproj
  48. 0
      test/E2ETest/testassets/projects/multi-project/deploy/rabbitmq.yaml
  49. 0
      test/E2ETest/testassets/projects/multi-project/frontend/IOrderService.cs
  50. 0
      test/E2ETest/testassets/projects/multi-project/frontend/Order.cs
  51. 0
      test/E2ETest/testassets/projects/multi-project/frontend/Pages/Error.cshtml
  52. 0
      test/E2ETest/testassets/projects/multi-project/frontend/Pages/Error.cshtml.cs
  53. 0
      test/E2ETest/testassets/projects/multi-project/frontend/Pages/Index.cshtml
  54. 0
      test/E2ETest/testassets/projects/multi-project/frontend/Pages/Index.cshtml.cs
  55. 0
      test/E2ETest/testassets/projects/multi-project/frontend/Pages/Privacy.cshtml
  56. 0
      test/E2ETest/testassets/projects/multi-project/frontend/Pages/Privacy.cshtml.cs
  57. 0
      test/E2ETest/testassets/projects/multi-project/frontend/Pages/Shared/_Layout.cshtml
  58. 0
      test/E2ETest/testassets/projects/multi-project/frontend/Pages/Shared/_ValidationScriptsPartial.cshtml
  59. 0
      test/E2ETest/testassets/projects/multi-project/frontend/Pages/_ViewImports.cshtml
  60. 0
      test/E2ETest/testassets/projects/multi-project/frontend/Pages/_ViewStart.cshtml
  61. 60
      test/E2ETest/testassets/projects/multi-project/frontend/Program.cs
  62. 54
      test/E2ETest/testassets/projects/multi-project/frontend/Properties/launchSettings.json
  63. 112
      test/E2ETest/testassets/projects/multi-project/frontend/Startup.cs
  64. 9
      test/E2ETest/testassets/projects/multi-project/frontend/appsettings.Development.json
  65. 10
      test/E2ETest/testassets/projects/multi-project/frontend/appsettings.json
  66. 32
      test/E2ETest/testassets/projects/multi-project/frontend/frontend.csproj
  67. 0
      test/E2ETest/testassets/projects/multi-project/frontend/wwwroot/css/site.css
  68. 0
      test/E2ETest/testassets/projects/multi-project/frontend/wwwroot/favicon.ico
  69. 0
      test/E2ETest/testassets/projects/multi-project/frontend/wwwroot/js/site.js
  70. 0
      test/E2ETest/testassets/projects/multi-project/frontend/wwwroot/lib/bootstrap/LICENSE
  71. 0
      test/E2ETest/testassets/projects/multi-project/frontend/wwwroot/lib/bootstrap/dist/css/bootstrap-grid.css
  72. 0
      test/E2ETest/testassets/projects/multi-project/frontend/wwwroot/lib/bootstrap/dist/css/bootstrap-grid.css.map
  73. 0
      test/E2ETest/testassets/projects/multi-project/frontend/wwwroot/lib/bootstrap/dist/css/bootstrap-grid.min.css
  74. 0
      test/E2ETest/testassets/projects/multi-project/frontend/wwwroot/lib/bootstrap/dist/css/bootstrap-grid.min.css.map
  75. 0
      test/E2ETest/testassets/projects/multi-project/frontend/wwwroot/lib/bootstrap/dist/css/bootstrap-reboot.css
  76. 0
      test/E2ETest/testassets/projects/multi-project/frontend/wwwroot/lib/bootstrap/dist/css/bootstrap-reboot.css.map
  77. 0
      test/E2ETest/testassets/projects/multi-project/frontend/wwwroot/lib/bootstrap/dist/css/bootstrap-reboot.min.css
  78. 0
      test/E2ETest/testassets/projects/multi-project/frontend/wwwroot/lib/bootstrap/dist/css/bootstrap-reboot.min.css.map
  79. 0
      test/E2ETest/testassets/projects/multi-project/frontend/wwwroot/lib/bootstrap/dist/css/bootstrap.css
  80. 0
      test/E2ETest/testassets/projects/multi-project/frontend/wwwroot/lib/bootstrap/dist/css/bootstrap.css.map
  81. 0
      test/E2ETest/testassets/projects/multi-project/frontend/wwwroot/lib/bootstrap/dist/css/bootstrap.min.css
  82. 0
      test/E2ETest/testassets/projects/multi-project/frontend/wwwroot/lib/bootstrap/dist/css/bootstrap.min.css.map
  83. 0
      test/E2ETest/testassets/projects/multi-project/frontend/wwwroot/lib/bootstrap/dist/js/bootstrap.bundle.js
  84. 0
      test/E2ETest/testassets/projects/multi-project/frontend/wwwroot/lib/bootstrap/dist/js/bootstrap.bundle.js.map
  85. 0
      test/E2ETest/testassets/projects/multi-project/frontend/wwwroot/lib/bootstrap/dist/js/bootstrap.bundle.min.js
  86. 0
      test/E2ETest/testassets/projects/multi-project/frontend/wwwroot/lib/bootstrap/dist/js/bootstrap.bundle.min.js.map
  87. 0
      test/E2ETest/testassets/projects/multi-project/frontend/wwwroot/lib/bootstrap/dist/js/bootstrap.js
  88. 0
      test/E2ETest/testassets/projects/multi-project/frontend/wwwroot/lib/bootstrap/dist/js/bootstrap.js.map
  89. 0
      test/E2ETest/testassets/projects/multi-project/frontend/wwwroot/lib/bootstrap/dist/js/bootstrap.min.js
  90. 0
      test/E2ETest/testassets/projects/multi-project/frontend/wwwroot/lib/bootstrap/dist/js/bootstrap.min.js.map
  91. 0
      test/E2ETest/testassets/projects/multi-project/frontend/wwwroot/lib/jquery-validation-unobtrusive/LICENSE.txt
  92. 0
      test/E2ETest/testassets/projects/multi-project/frontend/wwwroot/lib/jquery-validation-unobtrusive/jquery.validate.unobtrusive.js
  93. 0
      test/E2ETest/testassets/projects/multi-project/frontend/wwwroot/lib/jquery-validation-unobtrusive/jquery.validate.unobtrusive.min.js
  94. 0
      test/E2ETest/testassets/projects/multi-project/frontend/wwwroot/lib/jquery-validation/LICENSE.md
  95. 0
      test/E2ETest/testassets/projects/multi-project/frontend/wwwroot/lib/jquery-validation/dist/additional-methods.js
  96. 0
      test/E2ETest/testassets/projects/multi-project/frontend/wwwroot/lib/jquery-validation/dist/additional-methods.min.js
  97. 0
      test/E2ETest/testassets/projects/multi-project/frontend/wwwroot/lib/jquery-validation/dist/jquery.validate.js
  98. 0
      test/E2ETest/testassets/projects/multi-project/frontend/wwwroot/lib/jquery-validation/dist/jquery.validate.min.js
  99. 0
      test/E2ETest/testassets/projects/multi-project/frontend/wwwroot/lib/jquery/LICENSE.txt
  100. 0
      test/E2ETest/testassets/projects/multi-project/frontend/wwwroot/lib/jquery/dist/jquery.js

161
samples/multi-project/multi-project-production.example.yaml

@ -1,161 +0,0 @@
kind: Deployment
apiVersion: apps/v1
metadata:
name: backend
labels:
app.kubernetes.io/name: backend
app.kubernetes.io/part-of: multi-project
spec:
selector:
matchLabels:
app.kubernetes.io/name: backend
template:
metadata:
labels:
app.kubernetes.io/name: backend
app.kubernetes.io/part-of: multi-project
spec:
containers:
- name: backend
image: rynowak/backend:0.1.18-alpha.gbab4910d38
env:
- name: ASPNETCORE_URLS
value: http://*:7000
- name: SERVICE__FRONTEND__PORT
value: '8000'
- name: SERVICE__FRONTEND__HOST
value: 'frontend'
volumeMounts:
- name: rabbit-rabbit
mountPath: /var/tye/bindings/rabbit-rabbit
readOnly: true
ports:
- containerPort: 7000
volumes:
- name: rabbit-rabbit
secret:
secretName: binding-production-rabbit-rabbit-secret
items:
- key: connectionstring
path: CONNECTIONSTRINGS__RABBIT
...
---
kind: Service
apiVersion: v1
metadata:
name: backend
labels:
app.kubernetes.io/name: backend
app.kubernetes.io/part-of: multi-project
spec:
selector:
app.kubernetes.io/name: backend
type: ClusterIP
ports:
- name: backend
protocol: TCP
port: 7000
targetPort: 7000
...
---
kind: Deployment
apiVersion: apps/v1
metadata:
name: frontend
labels:
app.kubernetes.io/name: frontend
app.kubernetes.io/part-of: multi-project
spec:
selector:
matchLabels:
app.kubernetes.io/name: frontend
template:
metadata:
labels:
app.kubernetes.io/name: frontend
app.kubernetes.io/part-of: multi-project
spec:
containers:
- name: frontend
image: rynowak/frontend:0.1.18-alpha.gbab4910d38
env:
- name: ASPNETCORE_URLS
value: http://*:8000
- name: SERVICE__BACKEND__PORT
value: '7000'
- name: SERVICE__BACKEND__HOST
value: 'backend'
volumeMounts:
- name: rabbit-rabbit
mountPath: /var/tye/bindings/rabbit-rabbit
readOnly: true
ports:
- containerPort: 8000
volumes:
- name: rabbit-rabbit
secret:
secretName: binding-production-rabbit-rabbit-secret
items:
- key: connectionstring
path: CONNECTIONSTRINGS__RABBIT
...
---
kind: Service
apiVersion: v1
metadata:
name: frontend
labels:
app.kubernetes.io/name: frontend
app.kubernetes.io/part-of: multi-project
spec:
selector:
app.kubernetes.io/name: frontend
type: ClusterIP
ports:
- name: frontend
protocol: TCP
port: 8000
targetPort: 8000
...
---
kind: Deployment
apiVersion: apps/v1
metadata:
name: worker
labels:
app.kubernetes.io/name: worker
app.kubernetes.io/part-of: multi-project
spec:
selector:
matchLabels:
app.kubernetes.io/name: worker
template:
metadata:
labels:
app.kubernetes.io/name: worker
app.kubernetes.io/part-of: multi-project
spec:
containers:
- name: worker
image: rynowak/worker:0.1.18-alpha.gbab4910d38
env:
- name: SERVICE__BACKEND__PORT
value: '7000'
- name: SERVICE__BACKEND__HOST
value: 'backend'
- name: SERVICE__FRONTEND__PORT
value: '8000'
- name: SERVICE__FRONTEND__HOST
value: 'frontend'
volumeMounts:
- name: rabbit-rabbit
mountPath: /var/tye/bindings/rabbit-rabbit
readOnly: true
volumes:
- name: rabbit-rabbit
secret:
secretName: binding-production-rabbit-rabbit-secret
items:
- key: connectionstring
path: CONNECTIONSTRINGS__RABBIT
...

28
test/E2ETest/TestHelpers.cs

@ -3,18 +3,15 @@
// See the LICENSE file in the project root for more information.
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reactive.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Tye.Hosting;
using Microsoft.Tye.Hosting.Model;
using Xunit;
using Xunit.Abstractions;
using Microsoft.Tye;
namespace E2ETest
@ -78,31 +75,6 @@ namespace E2ETest
return directory;
}
internal static TempDirectory CopySampleProjectDirectory(string projectName)
{
var temp = TempDirectory.Create(preferUserDirectoryOnMacOS: true);
DirectoryCopy.Copy(GetSampleProjectDirectory(projectName).FullName, temp.DirectoryPath);
// We need to hijack any P2P references to Tye libraries.
// Test projects must use $(TyeLibrariesPath) to find their references.
var libraryPath = Path.Combine(TestHelpers.GetSolutionRootDirectory("tye"), "src");
if (!libraryPath.EndsWith(Path.DirectorySeparatorChar))
{
libraryPath += Path.DirectorySeparatorChar;
}
File.WriteAllText(
Path.Combine(temp.DirectoryPath, "Directory.Build.props"),
$@"
<Project>
<PropertyGroup>
<TyeLibrariesPath>{libraryPath}</TyeLibrariesPath>
</PropertyGroup>
</Project>");
return temp;
}
internal static TempDirectory CopyTestProjectDirectory(string projectName)
{
var temp = TempDirectory.Create(preferUserDirectoryOnMacOS: true);

114
test/E2ETest/TyeAssert.cs

@ -0,0 +1,114 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System.Linq;
using Microsoft.Tye.ConfigModel;
using Xunit;
namespace E2ETest
{
public static class TyeAssert
{
public static void Equal(ConfigApplication expected, ConfigApplication actual)
{
Assert.Equal(expected.Name, actual.Name);
Assert.Equal(expected.Registry, actual.Registry);
Assert.Equal(expected.Network, actual.Network);
foreach (var ingress in actual.Ingress)
{
var otherIngress = expected
.Ingress
.Where(o => o.Name == ingress.Name)
.Single();
Assert.NotNull(otherIngress);
Assert.Equal(otherIngress.Replicas, ingress.Replicas);
foreach (var rule in ingress.Rules)
{
var otherRule = otherIngress
.Rules
.Where(o => o.Path == rule.Path && o.Host == rule.Host && o.Service == rule.Service)
.Single();
Assert.NotNull(otherRule);
}
foreach (var binding in ingress.Bindings)
{
var otherBinding = otherIngress
.Bindings
.Where(o => o.Name == binding.Name && o.Port == binding.Port && o.Protocol == binding.Protocol)
.Single();
Assert.NotNull(otherBinding);
}
}
foreach (var service in actual.Services)
{
var otherService = expected
.Services
.Where(o => o.Name == service.Name)
.Single();
Assert.NotNull(otherService);
Assert.Equal(otherService.Args, service.Args);
Assert.Equal(otherService.Build, service.Build);
Assert.Equal(otherService.Executable, service.Executable);
Assert.Equal(otherService.External, service.External);
Assert.Equal(otherService.Image, service.Image);
Assert.Equal(otherService.Project, service.Project);
Assert.Equal(otherService.Replicas, service.Replicas);
Assert.Equal(otherService.WorkingDirectory, service.WorkingDirectory);
foreach (var binding in service.Bindings)
{
var otherBinding = otherService.Bindings
.Where(o => o.Name == binding.Name
&& o.Port == binding.Port
&& o.Protocol == binding.Protocol
&& o.ConnectionString == binding.ConnectionString
&& o.ContainerPort == binding.ContainerPort
&& o.Host == binding.Host)
.Single();
Assert.NotNull(otherBinding);
}
foreach (var binding in service.Bindings)
{
var otherBinding = otherService.Bindings
.Where(o => o.Name == binding.Name
&& o.Port == binding.Port
&& o.Protocol == binding.Protocol
&& o.ConnectionString == binding.ConnectionString
&& o.ContainerPort == binding.ContainerPort
&& o.Host == binding.Host)
.Single();
Assert.NotNull(otherBinding);
}
foreach (var config in service.Configuration)
{
var otherConfig = otherService.Configuration
.Where(o => o.Name == config.Name
&& o.Value == config.Value)
.Single();
Assert.NotNull(otherConfig);
}
foreach (var volume in service.Volumes)
{
var otherVolume = otherService.Volumes
.Where(o => o.Name == volume.Name
&& o.Target == volume.Target
&& o.Source == volume.Source)
.Single();
Assert.NotNull(otherVolume);
}
}
}
}
}

8
test/E2ETest/TyeBuildTests.cs

@ -30,7 +30,7 @@ namespace E2ETest
var projectName = "single-project";
var environment = "production";
using var projectDirectory = CopySampleProjectDirectory(projectName);
using var projectDirectory = CopyTestProjectDirectory(projectName);
var projectFile = new FileInfo(Path.Combine(projectDirectory.DirectoryPath, "tye.yaml"));
@ -61,7 +61,7 @@ namespace E2ETest
var projectName = "frontend-backend";
var environment = "production";
using var projectDirectory = CopySampleProjectDirectory(projectName);
using var projectDirectory = CopyTestProjectDirectory(projectName);
var projectFile = new FileInfo(Path.Combine(projectDirectory.DirectoryPath, "tye.yaml"));
@ -95,7 +95,7 @@ namespace E2ETest
var projectName = "multi-project";
var environment = "production";
using var projectDirectory = CopySampleProjectDirectory(projectName);
using var projectDirectory = CopyTestProjectDirectory(projectName);
var projectFile = new FileInfo(Path.Combine(projectDirectory.DirectoryPath, "tye.yaml"));
@ -129,7 +129,7 @@ namespace E2ETest
var projectName = "single-project";
var environment = "production";
using var projectDirectory = CopySampleProjectDirectory(projectName);
using var projectDirectory = CopyTestProjectDirectory(projectName);
var projectFile = new FileInfo(Path.Combine(projectDirectory.DirectoryPath, "tye.yaml"));
var outputContext = new OutputContext(sink, Verbosity.Debug);

8
test/E2ETest/TyeGenerateTests.cs

@ -32,7 +32,7 @@ namespace E2ETest
var projectName = "single-project";
var environment = "production";
using var projectDirectory = CopySampleProjectDirectory(projectName);
using var projectDirectory = CopyTestProjectDirectory(projectName);
var projectFile = new FileInfo(Path.Combine(projectDirectory.DirectoryPath, "tye.yaml"));
@ -69,7 +69,7 @@ namespace E2ETest
var projectName = "frontend-backend";
var environment = "production";
using var projectDirectory = CopySampleProjectDirectory(projectName);
using var projectDirectory = CopyTestProjectDirectory(projectName);
var projectFile = new FileInfo(Path.Combine(projectDirectory.DirectoryPath, "tye.yaml"));
@ -110,7 +110,7 @@ namespace E2ETest
var projectName = "multi-project";
var environment = "production";
using var projectDirectory = CopySampleProjectDirectory(projectName);
using var projectDirectory = CopyTestProjectDirectory(projectName);
var projectFile = new FileInfo(Path.Combine(projectDirectory.DirectoryPath, "tye.yaml"));
@ -151,7 +151,7 @@ namespace E2ETest
var projectName = "single-project";
var environment = "production";
using var projectDirectory = CopySampleProjectDirectory("single-project");
using var projectDirectory = CopyTestProjectDirectory("single-project");
var projectFile = new FileInfo(Path.Combine(projectDirectory.DirectoryPath, "tye.yaml"));

51
test/E2ETest/TyeInitTests.cs

@ -5,8 +5,11 @@
using System;
using System.IO;
using Microsoft.Tye;
using Microsoft.Tye.ConfigModel;
using Xunit;
using Xunit.Abstractions;
using YamlDotNet.Serialization;
using YamlDotNet.Serialization.NamingConventions;
using static E2ETest.TestHelpers;
namespace E2ETest
@ -15,52 +18,38 @@ namespace E2ETest
{
private readonly ITestOutputHelper output;
private readonly TestOutputLogEventSink sink;
private readonly IDeserializer _deserializer;
public TyeInitTests(ITestOutputHelper output)
{
this.output = output;
sink = new TestOutputLogEventSink(output);
_deserializer = new DeserializerBuilder()
.WithNamingConvention(CamelCaseNamingConvention.Instance)
.Build();
}
[Fact]
public void SingleProjectInitTest()
public void Init_WorksForMultipleProjects()
{
using var projectDirectory = CopySampleProjectDirectory(Path.Combine("single-project", "test-project"));
File.Delete(Path.Combine(projectDirectory.DirectoryPath, "tye.yaml"));
var projectFile = new FileInfo(Path.Combine(projectDirectory.DirectoryPath, "test-project.csproj"));
var (content, _) = InitHost.CreateTyeFileContent(projectFile, force: false);
var expectedContent = File.ReadAllText("testassets/init/single-project.yaml");
output.WriteLine(content);
Assert.Equal(expectedContent.NormalizeNewLines(), content.NormalizeNewLines());
}
[Fact]
public void MultiProjectInitTest()
{
using var projectDirectory = CopySampleProjectDirectory("multi-project");
// delete already present yaml
using var projectDirectory = CopyTestProjectDirectory("multi-project");
File.Delete(Path.Combine(projectDirectory.DirectoryPath, "tye.yaml"));
var projectFile = new FileInfo(Path.Combine(projectDirectory.DirectoryPath, "multi-project.sln"));
var (content, _) = InitHost.CreateTyeFileContent(projectFile, force: false);
var expectedContent = File.ReadAllText("testassets/init/multi-project.yaml");
var actual = _deserializer.Deserialize<ConfigApplication>(content);
output.WriteLine(content);
var expectedContent = File.ReadAllText("testassets/init/multi-project.yaml");
var expected = _deserializer.Deserialize<ConfigApplication>(expectedContent);
Assert.Equal(expectedContent.NormalizeNewLines(), content.NormalizeNewLines());
TyeAssert.Equal(expected, actual);
}
[Fact]
public void FrontendBackendTest()
public void Init_WorksForMultipleProjects_FileComparison()
{
using var projectDirectory = CopySampleProjectDirectory("frontend-backend");
using var projectDirectory = CopyTestProjectDirectory("frontend-backend");
// delete already present yaml
File.Delete(Path.Combine(projectDirectory.DirectoryPath, "tye.yaml"));
@ -81,17 +70,15 @@ namespace E2ETest
{
using var projectDirectory = CopyTestProjectDirectory("project-types");
// delete already present yaml
File.Delete(Path.Combine(projectDirectory.DirectoryPath, "tye.yaml"));
var projectFile = new FileInfo(Path.Combine(projectDirectory.DirectoryPath, "project-types.sln"));
var (content, _) = InitHost.CreateTyeFileContent(projectFile, force: false);
var expectedContent = File.ReadAllText("testassets/init/project-types.yaml");
var actual = _deserializer.Deserialize<ConfigApplication>(content);
output.WriteLine(content);
var expectedContent = File.ReadAllText("testassets/init/project-types.yaml");
var expected = _deserializer.Deserialize<ConfigApplication>(expectedContent);
Assert.Equal(expectedContent.NormalizeNewLines(), content.NormalizeNewLines());
TyeAssert.Equal(expected, actual);
}
}
}

4
test/E2ETest/TyePurgeTests.cs

@ -31,7 +31,7 @@ namespace E2ETest
[Fact]
public async Task FrontendBackendPurgeTest()
{
using var projectDirectory = CopySampleProjectDirectory("frontend-backend");
using var projectDirectory = CopyTestProjectDirectory("frontend-backend");
var projectFile = new FileInfo(Path.Combine(projectDirectory.DirectoryPath, "tye.yaml"));
var tyeDir = new DirectoryInfo(Path.Combine(projectDirectory.DirectoryPath, ".tye"));
@ -69,7 +69,7 @@ namespace E2ETest
[SkipIfDockerNotRunning]
public async Task MultiProjectPurgeTest()
{
using var projectDirectory = CopySampleProjectDirectory("multi-project");
using var projectDirectory = CopyTestProjectDirectory("multi-project");
var projectFile = new FileInfo(Path.Combine(projectDirectory.DirectoryPath, "tye.yaml"));
var tyeDir = new DirectoryInfo(Path.Combine(projectDirectory.DirectoryPath, ".tye"));

45
test/E2ETest/TyeRunTests.cs

@ -44,37 +44,10 @@ namespace E2ETest
_options.Converters.Add(new JsonStringEnumConverter(JsonNamingPolicy.CamelCase));
}
[Fact]
public async Task SingleProjectRunTest()
{
using var projectDirectory = CopySampleProjectDirectory(Path.Combine("single-project", "test-project"));
var projectFile = new FileInfo(Path.Combine(projectDirectory.DirectoryPath, "test-project.csproj"));
var outputContext = new OutputContext(_sink, Verbosity.Debug);
var application = await ApplicationFactory.CreateAsync(outputContext, projectFile);
var handler = new HttpClientHandler
{
ServerCertificateCustomValidationCallback = (a, b, c, d) => true,
AllowAutoRedirect = false
};
var client = new HttpClient(new RetryHandler(handler));
await RunHostingApplication(application, Array.Empty<string>(), async (app, uri) =>
{
var testUri = await GetServiceUrl(client, uri, "test-project");
var testResponse = await client.GetAsync(testUri);
Assert.True(testResponse.IsSuccessStatusCode);
});
}
[Fact]
public async Task FrontendBackendRunTest()
{
using var projectDirectory = CopySampleProjectDirectory("frontend-backend");
using var projectDirectory = CopyTestProjectDirectory("frontend-backend");
var projectFile = new FileInfo(Path.Combine(projectDirectory.DirectoryPath, "tye.yaml"));
var outputContext = new OutputContext(_sink, Verbosity.Debug);
@ -105,7 +78,7 @@ namespace E2ETest
[SkipIfDockerNotRunning]
public async Task FrontendBackendRunTestWithDocker()
{
using var projectDirectory = CopySampleProjectDirectory("frontend-backend");
using var projectDirectory = CopyTestProjectDirectory("frontend-backend");
var projectFile = new FileInfo(Path.Combine(projectDirectory.DirectoryPath, "tye.yaml"));
var outputContext = new OutputContext(_sink, Verbosity.Debug);
@ -139,7 +112,7 @@ namespace E2ETest
[SkipIfDockerNotRunning]
public async Task FrontendProjectBackendDocker()
{
using var projectDirectory = CopySampleProjectDirectory("frontend-backend");
using var projectDirectory = CopyTestProjectDirectory("frontend-backend");
var projectFile = new FileInfo(Path.Combine(projectDirectory.DirectoryPath, "tye.yaml"));
var outputContext = new OutputContext(_sink, Verbosity.Debug);
@ -183,7 +156,7 @@ namespace E2ETest
[SkipIfDockerNotRunning]
public async Task FrontendDockerBackendProject()
{
using var projectDirectory = CopySampleProjectDirectory("frontend-backend");
using var projectDirectory = CopyTestProjectDirectory("frontend-backend");
var projectFile = new FileInfo(Path.Combine(projectDirectory.DirectoryPath, "tye.yaml"));
var outputContext = new OutputContext(_sink, Verbosity.Debug);
@ -282,7 +255,7 @@ namespace E2ETest
[SkipIfDockerNotRunning]
public async Task DockerNetworkAssignmentTest()
{
using var projectDirectory = CopySampleProjectDirectory("frontend-backend");
using var projectDirectory = CopyTestProjectDirectory("frontend-backend");
var projectFile = new FileInfo(Path.Combine(projectDirectory.DirectoryPath, "tye.yaml"));
var outputContext = new OutputContext(_sink, Verbosity.Debug);
@ -339,7 +312,7 @@ namespace E2ETest
[SkipIfDockerNotRunning]
public async Task DockerNetworkAssignmentForNonExistingNetworkTest()
{
using var projectDirectory = CopySampleProjectDirectory("frontend-backend");
using var projectDirectory = CopyTestProjectDirectory("frontend-backend");
var projectFile = new FileInfo(Path.Combine(projectDirectory.DirectoryPath, "tye.yaml"));
var outputContext = new OutputContext(_sink, Verbosity.Debug);
@ -423,7 +396,7 @@ namespace E2ETest
[Fact]
public async Task IngressRunTest()
{
using var projectDirectory = CopySampleProjectDirectory("apps-with-ingress");
using var projectDirectory = CopyTestProjectDirectory("apps-with-ingress");
var projectFile = new FileInfo(Path.Combine(projectDirectory.DirectoryPath, "tye.yaml"));
var outputContext = new OutputContext(_sink, Verbosity.Debug);
@ -472,7 +445,7 @@ namespace E2ETest
[SkipIfDockerNotRunning]
public async Task NginxIngressTest()
{
using var projectDirectory = CopySampleProjectDirectory("nginx-ingress");
using var projectDirectory = CopyTestProjectDirectory("nginx-ingress");
var projectFile = new FileInfo(Path.Combine(projectDirectory.DirectoryPath, "tye.yaml"));
var outputContext = new OutputContext(_sink, Verbosity.Debug);
@ -511,7 +484,7 @@ namespace E2ETest
[Fact]
public async Task NullDebugTargetsDoesNotThrow()
{
using var projectDirectory = CopySampleProjectDirectory(Path.Combine("single-project", "test-project"));
using var projectDirectory = CopyTestProjectDirectory(Path.Combine("single-project", "test-project"));
var projectFile = new FileInfo(Path.Combine(projectDirectory.DirectoryPath, "test-project.csproj"));

10
test/E2ETest/testassets/init/single-project.yaml

@ -1,10 +0,0 @@
# tye application configuration file
# read all about it at https://github.com/dotnet/tye
#
# when you've given us a try, we'd love to know what you think:
# https://aka.ms/AA7q20u
#
name: test-project
services:
- name: test-project
project: test-project.csproj

7
test/E2ETest/testassets/projects/apps-with-ingress/ApplicationA/ApplicationA.csproj

@ -0,0 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
</PropertyGroup>
</Project>

26
test/E2ETest/testassets/projects/apps-with-ingress/ApplicationA/Program.cs

@ -0,0 +1,26 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
namespace ApplicationA
{
public class Program
{
public static void Main(string[] args)
{
CreateHostBuilder(args).Build().Run();
}
public static IHostBuilder CreateHostBuilder(string[] args) =>
Host.CreateDefaultBuilder(args)
.ConfigureWebHostDefaults(webBuilder =>
{
webBuilder.UseStartup<Startup>();
});
}
}

27
test/E2ETest/testassets/projects/apps-with-ingress/ApplicationA/Properties/launchSettings.json

@ -0,0 +1,27 @@
{
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:2755",
"sslPort": 44369
}
},
"profiles": {
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"ApplicationA": {
"commandName": "Project",
"launchBrowser": true,
"applicationUrl": "https://localhost:5001;http://localhost:5000",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
}
}
}

40
test/E2ETest/testassets/projects/apps-with-ingress/ApplicationA/Startup.cs

@ -0,0 +1,40 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
namespace ApplicationA
{
public class Startup
{
// This method gets called by the runtime. Use this method to add services to the container.
// For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940
public void ConfigureServices(IServiceCollection services)
{
}
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
}
app.UseRouting();
app.UseEndpoints(endpoints =>
{
endpoints.MapGet("/", async context =>
{
await context.Response.WriteAsync("Hello from Application A " + Environment.GetEnvironmentVariable("APP_INSTANCE") ?? Environment.GetEnvironmentVariable("HOSTNAME"));
});
});
}
}
}

6
samples/multi-project/backend/appsettings.Development.json → test/E2ETest/testassets/projects/apps-with-ingress/ApplicationA/appsettings.Development.json

@ -1,9 +1,9 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft": "Warning",
"Microsoft.Hosting.Lifetime": "Information"
"Default": "Information",
"Microsoft": "Warning",
"Microsoft.Hosting.Lifetime": "Information"
}
}
}

20
samples/multi-project/backend/appsettings.json → test/E2ETest/testassets/projects/apps-with-ingress/ApplicationA/appsettings.json

@ -1,10 +1,10 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft": "Warning",
"Microsoft.Hosting.Lifetime": "Information"
}
},
"AllowedHosts": "*"
}
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft": "Warning",
"Microsoft.Hosting.Lifetime": "Information"
}
},
"AllowedHosts": "*"
}

7
test/E2ETest/testassets/projects/apps-with-ingress/ApplicationB/ApplicationB.csproj

@ -0,0 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
</PropertyGroup>
</Project>

26
test/E2ETest/testassets/projects/apps-with-ingress/ApplicationB/Program.cs

@ -0,0 +1,26 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
namespace ApplicationB
{
public class Program
{
public static void Main(string[] args)
{
CreateHostBuilder(args).Build().Run();
}
public static IHostBuilder CreateHostBuilder(string[] args) =>
Host.CreateDefaultBuilder(args)
.ConfigureWebHostDefaults(webBuilder =>
{
webBuilder.UseStartup<Startup>();
});
}
}

27
test/E2ETest/testassets/projects/apps-with-ingress/ApplicationB/Properties/launchSettings.json

@ -0,0 +1,27 @@
{
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:19251",
"sslPort": 44343
}
},
"profiles": {
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"ApplicationB": {
"commandName": "Project",
"launchBrowser": true,
"applicationUrl": "https://localhost:5001;http://localhost:5000",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
}
}
}

40
test/E2ETest/testassets/projects/apps-with-ingress/ApplicationB/Startup.cs

@ -0,0 +1,40 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
namespace ApplicationB
{
public class Startup
{
// This method gets called by the runtime. Use this method to add services to the container.
// For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940
public void ConfigureServices(IServiceCollection services)
{
}
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
}
app.UseRouting();
app.UseEndpoints(endpoints =>
{
endpoints.MapGet("/", async context =>
{
await context.Response.WriteAsync("Hello from Application B " + Environment.GetEnvironmentVariable("APP_INSTANCE") ?? Environment.GetEnvironmentVariable("HOSTNAME"));
});
});
}
}
}

6
samples/multi-project/worker/appsettings.Development.json → test/E2ETest/testassets/projects/apps-with-ingress/ApplicationB/appsettings.Development.json

@ -1,9 +1,9 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft": "Warning",
"Microsoft.Hosting.Lifetime": "Information"
"Default": "Information",
"Microsoft": "Warning",
"Microsoft.Hosting.Lifetime": "Information"
}
}
}

20
samples/single-project/test-project/appsettings.json → test/E2ETest/testassets/projects/apps-with-ingress/ApplicationB/appsettings.json

@ -1,10 +1,10 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft": "Warning",
"Microsoft.Hosting.Lifetime": "Information"
}
},
"AllowedHosts": "*"
}
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft": "Warning",
"Microsoft.Hosting.Lifetime": "Information"
}
},
"AllowedHosts": "*"
}

48
test/E2ETest/testassets/projects/apps-with-ingress/apps-with-ingress.sln

@ -0,0 +1,48 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.26124.0
MinimumVisualStudioVersion = 15.0.26124.0
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ApplicationA", "ApplicationA\ApplicationA.csproj", "{5A9DC239-55BB-4951-B081-35931BF8C867}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ApplicationB", "ApplicationB\ApplicationB.csproj", "{AE1F10D3-BFAE-4D23-ADCF-06770237285D}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release|Any CPU = Release|Any CPU
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{5A9DC239-55BB-4951-B081-35931BF8C867}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{5A9DC239-55BB-4951-B081-35931BF8C867}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5A9DC239-55BB-4951-B081-35931BF8C867}.Debug|x64.ActiveCfg = Debug|Any CPU
{5A9DC239-55BB-4951-B081-35931BF8C867}.Debug|x64.Build.0 = Debug|Any CPU
{5A9DC239-55BB-4951-B081-35931BF8C867}.Debug|x86.ActiveCfg = Debug|Any CPU
{5A9DC239-55BB-4951-B081-35931BF8C867}.Debug|x86.Build.0 = Debug|Any CPU
{5A9DC239-55BB-4951-B081-35931BF8C867}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5A9DC239-55BB-4951-B081-35931BF8C867}.Release|Any CPU.Build.0 = Release|Any CPU
{5A9DC239-55BB-4951-B081-35931BF8C867}.Release|x64.ActiveCfg = Release|Any CPU
{5A9DC239-55BB-4951-B081-35931BF8C867}.Release|x64.Build.0 = Release|Any CPU
{5A9DC239-55BB-4951-B081-35931BF8C867}.Release|x86.ActiveCfg = Release|Any CPU
{5A9DC239-55BB-4951-B081-35931BF8C867}.Release|x86.Build.0 = Release|Any CPU
{AE1F10D3-BFAE-4D23-ADCF-06770237285D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{AE1F10D3-BFAE-4D23-ADCF-06770237285D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{AE1F10D3-BFAE-4D23-ADCF-06770237285D}.Debug|x64.ActiveCfg = Debug|Any CPU
{AE1F10D3-BFAE-4D23-ADCF-06770237285D}.Debug|x64.Build.0 = Debug|Any CPU
{AE1F10D3-BFAE-4D23-ADCF-06770237285D}.Debug|x86.ActiveCfg = Debug|Any CPU
{AE1F10D3-BFAE-4D23-ADCF-06770237285D}.Debug|x86.Build.0 = Debug|Any CPU
{AE1F10D3-BFAE-4D23-ADCF-06770237285D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{AE1F10D3-BFAE-4D23-ADCF-06770237285D}.Release|Any CPU.Build.0 = Release|Any CPU
{AE1F10D3-BFAE-4D23-ADCF-06770237285D}.Release|x64.ActiveCfg = Release|Any CPU
{AE1F10D3-BFAE-4D23-ADCF-06770237285D}.Release|x64.Build.0 = Release|Any CPU
{AE1F10D3-BFAE-4D23-ADCF-06770237285D}.Release|x86.ActiveCfg = Release|Any CPU
{AE1F10D3-BFAE-4D23-ADCF-06770237285D}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
EndGlobal

28
test/E2ETest/testassets/projects/apps-with-ingress/tye.yaml

@ -0,0 +1,28 @@
# tye application configuration file
# read all about it at https://github.com/dotnet/tye
#
# when you've given us a try, we'd love to know what you think:
# https://aka.ms/AA7q20u
#
name: apps-with-ingress
ingress:
- name: ingress
bindings:
- port: 8080
rules:
- path: /A
service: appA
- path: /B
service: appB
- host: a.example.com
service: appA
- host: b.example.com
service: appB
services:
- name: appA
project: ApplicationA/ApplicationA.csproj
replicas: 2
- name: appB
project: ApplicationB/ApplicationB.csproj
replicas: 2

24
test/E2ETest/testassets/projects/frontend-backend/backend/Program.cs

@ -0,0 +1,24 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Hosting;
namespace Backend
{
public class Program
{
public static void Main(string[] args)
{
CreateHostBuilder(args).Build().Run();
}
public static IHostBuilder CreateHostBuilder(string[] args) =>
Host.CreateDefaultBuilder(args)
.ConfigureWebHostDefaults(webBuilder =>
{
webBuilder.UseStartup<Startup>();
});
}
}

27
test/E2ETest/testassets/projects/frontend-backend/backend/Properties/launchSettings.json

@ -0,0 +1,27 @@
{
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:21017",
"sslPort": 44378
}
},
"profiles": {
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"backend": {
"commandName": "Project",
"launchBrowser": true,
"applicationUrl": "https://localhost:5002;http://localhost:5003",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
}
}
}

62
test/E2ETest/testassets/projects/frontend-backend/backend/Startup.cs

@ -0,0 +1,62 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System.Net;
using System.Text.Json;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http.Features;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Hosting;
namespace Backend
{
public class Startup
{
private readonly JsonSerializerOptions options = new JsonSerializerOptions()
{
PropertyNameCaseInsensitive = true,
PropertyNamingPolicy = JsonNamingPolicy.CamelCase,
};
public Startup(IConfiguration configuration)
{
Configuration = configuration;
}
public IConfiguration Configuration { get; }
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
}
app.UseRouting();
app.UseEndpoints(endpoints =>
{
endpoints.MapGet("/", async context =>
{
var backendInfo = new BackendInfo()
{
IP = context.Connection.LocalIpAddress.ToString(),
Hostname = Dns.GetHostName(),
};
context.Response.ContentType = "application/json; charset=utf-8";
await JsonSerializer.SerializeAsync(context.Response.Body, backendInfo);
});
});
}
class BackendInfo
{
public string IP { get; set; } = default!;
public string Hostname { get; set; } = default!;
}
}
}

6
samples/single-project/test-project/appsettings.Development.json → test/E2ETest/testassets/projects/frontend-backend/backend/appsettings.Development.json

@ -1,9 +1,9 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft": "Warning",
"Microsoft.Hosting.Lifetime": "Information"
"Default": "Information",
"Microsoft": "Warning",
"Microsoft.Hosting.Lifetime": "Information"
}
}
}

20
samples/multi-project/frontend/appsettings.json → test/E2ETest/testassets/projects/frontend-backend/backend/appsettings.json

@ -1,10 +1,10 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft": "Warning",
"Microsoft.Hosting.Lifetime": "Information"
}
},
"AllowedHosts": "*"
}
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft": "Warning",
"Microsoft.Hosting.Lifetime": "Information"
}
},
"AllowedHosts": "*"
}

12
test/E2ETest/testassets/projects/frontend-backend/backend/backend.csproj

@ -0,0 +1,12 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<RootNamespace>Backend</RootNamespace>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="$(TyeLibrariesPath)\Microsoft.Tye.Extensions.Configuration\Microsoft.Tye.Extensions.Configuration.csproj" />
</ItemGroup>
</Project>

99
test/E2ETest/testassets/projects/frontend-backend/frontend-backend-production.example.yaml

@ -0,0 +1,99 @@
kind: Deployment
apiVersion: apps/v1
metadata:
name: backend
labels:
app.kubernetes.io/name: backend
app.kubernetes.io/part-of: frontend-backend
spec:
selector:
matchLabels:
app.kubernetes.io/name: backend
template:
metadata:
labels:
app.kubernetes.io/name: backend
app.kubernetes.io/part-of: frontend-backend
spec:
containers:
- name: backend
image: rynowak/backend:0.1.17-alpha.gd8612934f5
env:
- name: ASPNETCORE_URLS
value: http://*:5050
- name: SERVICE__FRONTEND__PORT
value: '5051'
- name: SERVICE__FRONTEND__HOST
value: 'frontend'
ports:
- containerPort: 5050
...
---
kind: Service
apiVersion: v1
metadata:
name: backend
labels:
app.kubernetes.io/name: backend
app.kubernetes.io/part-of: frontend-backend
spec:
selector:
app.kubernetes.io/name: backend
type: ClusterIP
ports:
- name: web
protocol: TCP
port: 5050
targetPort: 5050
...
---
kind: Deployment
apiVersion: apps/v1
metadata:
name: frontend
labels:
app.kubernetes.io/name: frontend
app.kubernetes.io/part-of: frontend-backend
spec:
selector:
matchLabels:
app.kubernetes.io/name: frontend
template:
metadata:
labels:
app.kubernetes.io/name: frontend
app.kubernetes.io/part-of: frontend-backend
spec:
containers:
- name: frontend
image: rynowak/frontend:0.1.17-alpha.gd8612934f5
env:
- name: ASPNETCORE_URLS
value: http://*:5051
- name: SERVICE__BACKEND__PORT
value: '5050'
- name: SERVICE__BACKEND__HOST
value: 'backend'
ports:
- containerPort: 5051
...
---
kind: Service
apiVersion: v1
metadata:
name: frontend
labels:
app.kubernetes.io/name: frontend
app.kubernetes.io/part-of: frontend-backend
spec:
selector:
app.kubernetes.io/name: frontend
type: ClusterIP
ports:
- name: web
protocol: TCP
port: 5051
targetPort: 5051
...
tPort: 5051
...

48
test/E2ETest/testassets/projects/frontend-backend/frontend-backend.sln

@ -0,0 +1,48 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.26124.0
MinimumVisualStudioVersion = 15.0.26124.0
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "backend", "backend\backend.csproj", "{E900C6D9-7A87-49E3-93E5-97E6402E3939}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "frontend", "frontend\frontend.csproj", "{3BCACB4B-8506-4A5C-B4EE-FC76627EBE11}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release|Any CPU = Release|Any CPU
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{E900C6D9-7A87-49E3-93E5-97E6402E3939}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E900C6D9-7A87-49E3-93E5-97E6402E3939}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E900C6D9-7A87-49E3-93E5-97E6402E3939}.Debug|x64.ActiveCfg = Debug|Any CPU
{E900C6D9-7A87-49E3-93E5-97E6402E3939}.Debug|x64.Build.0 = Debug|Any CPU
{E900C6D9-7A87-49E3-93E5-97E6402E3939}.Debug|x86.ActiveCfg = Debug|Any CPU
{E900C6D9-7A87-49E3-93E5-97E6402E3939}.Debug|x86.Build.0 = Debug|Any CPU
{E900C6D9-7A87-49E3-93E5-97E6402E3939}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E900C6D9-7A87-49E3-93E5-97E6402E3939}.Release|Any CPU.Build.0 = Release|Any CPU
{E900C6D9-7A87-49E3-93E5-97E6402E3939}.Release|x64.ActiveCfg = Release|Any CPU
{E900C6D9-7A87-49E3-93E5-97E6402E3939}.Release|x64.Build.0 = Release|Any CPU
{E900C6D9-7A87-49E3-93E5-97E6402E3939}.Release|x86.ActiveCfg = Release|Any CPU
{E900C6D9-7A87-49E3-93E5-97E6402E3939}.Release|x86.Build.0 = Release|Any CPU
{3BCACB4B-8506-4A5C-B4EE-FC76627EBE11}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{3BCACB4B-8506-4A5C-B4EE-FC76627EBE11}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3BCACB4B-8506-4A5C-B4EE-FC76627EBE11}.Debug|x64.ActiveCfg = Debug|Any CPU
{3BCACB4B-8506-4A5C-B4EE-FC76627EBE11}.Debug|x64.Build.0 = Debug|Any CPU
{3BCACB4B-8506-4A5C-B4EE-FC76627EBE11}.Debug|x86.ActiveCfg = Debug|Any CPU
{3BCACB4B-8506-4A5C-B4EE-FC76627EBE11}.Debug|x86.Build.0 = Debug|Any CPU
{3BCACB4B-8506-4A5C-B4EE-FC76627EBE11}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3BCACB4B-8506-4A5C-B4EE-FC76627EBE11}.Release|Any CPU.Build.0 = Release|Any CPU
{3BCACB4B-8506-4A5C-B4EE-FC76627EBE11}.Release|x64.ActiveCfg = Release|Any CPU
{3BCACB4B-8506-4A5C-B4EE-FC76627EBE11}.Release|x64.Build.0 = Release|Any CPU
{3BCACB4B-8506-4A5C-B4EE-FC76627EBE11}.Release|x86.ActiveCfg = Release|Any CPU
{3BCACB4B-8506-4A5C-B4EE-FC76627EBE11}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
EndGlobal

24
test/E2ETest/testassets/projects/frontend-backend/frontend/Program.cs

@ -0,0 +1,24 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Hosting;
namespace Frontend
{
public class Program
{
public static void Main(string[] args)
{
CreateHostBuilder(args).Build().Run();
}
public static IHostBuilder CreateHostBuilder(string[] args) =>
Host.CreateDefaultBuilder(args)
.ConfigureWebHostDefaults(webBuilder =>
{
webBuilder.UseStartup<Startup>();
});
}
}

27
test/E2ETest/testassets/projects/frontend-backend/frontend/Properties/launchSettings.json

@ -0,0 +1,27 @@
{
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:16377",
"sslPort": 44392
}
},
"profiles": {
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"frontend": {
"commandName": "Project",
"launchBrowser": true,
"applicationUrl": "https://localhost:5001;http://localhost:5000",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
}
}
}

87
test/E2ETest/testassets/projects/frontend-backend/frontend/Startup.cs

@ -0,0 +1,87 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Text.Json;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Http.Features;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
namespace Frontend
{
public class Startup
{
private readonly JsonSerializerOptions options = new JsonSerializerOptions()
{
PropertyNameCaseInsensitive = true,
PropertyNamingPolicy = JsonNamingPolicy.CamelCase,
};
public Startup(IConfiguration configuration)
{
Configuration = configuration;
}
public IConfiguration Configuration { get; }
public void ConfigureServices(IServiceCollection services)
{
services.AddHealthChecks();
}
public void Configure(IApplicationBuilder app, IWebHostEnvironment env, ILogger<Startup> logger)
{
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
}
app.UseRouting();
app.UseEndpoints(endpoints =>
{
var uri = Configuration.GetServiceUri("backend")!;
logger.LogInformation("Backend URL: {BackendUrl}", uri);
var httpClient = new HttpClient()
{
BaseAddress = uri
};
endpoints.MapGet("/", async context =>
{
var bytes = await httpClient.GetByteArrayAsync("/");
var backendInfo = JsonSerializer.Deserialize<BackendInfo>(bytes, options);
await context.Response.WriteAsync($"Frontend Listening IP: {context.Connection.LocalIpAddress}{Environment.NewLine}");
await context.Response.WriteAsync($"Frontend Hostname: {Dns.GetHostName()}{Environment.NewLine}");
await context.Response.WriteAsync($"EnvVar Configuration value: {Configuration["App:Value"]}{Environment.NewLine}");
await context.Response.WriteAsync($"Backend Listening IP: {backendInfo.IP}{Environment.NewLine}");
await context.Response.WriteAsync($"Backend Hostname: {backendInfo.Hostname}{Environment.NewLine}");
var addresses = await Dns.GetHostAddressesAsync(uri.Host);
await context.Response.WriteAsync($"Backend Host Addresses: {string.Join(", ", addresses.Select(a => a.ToString()))}");
});
endpoints.MapHealthChecks("/healthz");
});
}
class BackendInfo
{
public string IP { get; set; } = default!;
public string Hostname { get; set; } = default!;
}
}
}

6
samples/multi-project/frontend/appsettings.Development.json → test/E2ETest/testassets/projects/frontend-backend/frontend/appsettings.Development.json

@ -1,9 +1,9 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft": "Warning",
"Microsoft.Hosting.Lifetime": "Information"
"Default": "Information",
"Microsoft": "Warning",
"Microsoft.Hosting.Lifetime": "Information"
}
}
}

19
samples/multi-project/worker/appsettings.json → test/E2ETest/testassets/projects/frontend-backend/frontend/appsettings.json

@ -1,9 +1,10 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft": "Warning",
"Microsoft.Hosting.Lifetime": "Information"
}
}
}
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft": "Warning",
"Microsoft.Hosting.Lifetime": "Information"
}
},
"AllowedHosts": "*"
}

12
test/E2ETest/testassets/projects/frontend-backend/frontend/frontend.csproj

@ -0,0 +1,12 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<RootNamespace>Frontend</RootNamespace>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="$(TyeLibrariesPath)\Microsoft.Tye.Extensions.Configuration\Microsoft.Tye.Extensions.Configuration.csproj" />
</ItemGroup>
</Project>

8
test/E2ETest/testassets/projects/frontend-backend/tye.yaml

@ -0,0 +1,8 @@
# tye application configuration file
# read all about it at https://github.com/dotnet/tye
name: frontend-backend
services:
- name: backend
project: backend/backend.csproj
- name: frontend
project: frontend/frontend.csproj

0
samples/multi-project/backend/IOrderService.cs → test/E2ETest/testassets/projects/multi-project/backend/IOrderService.cs

0
samples/multi-project/backend/Order.cs → test/E2ETest/testassets/projects/multi-project/backend/Order.cs

0
samples/multi-project/backend/OrdersService.cs → test/E2ETest/testassets/projects/multi-project/backend/OrdersService.cs

70
samples/multi-project/backend/Program.cs → test/E2ETest/testassets/projects/multi-project/backend/Program.cs

@ -1,35 +1,35 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System;
using System.Diagnostics;
using System.IO;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Server.Kestrel.Core;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Hosting;
namespace Backend
{
public class Program
{
public static void Main(string[] args)
{
Activity.DefaultIdFormat = ActivityIdFormat.W3C;
CreateHostBuilder(args).Build().Run();
}
public static IHostBuilder CreateHostBuilder(string[] args) =>
Host.CreateDefaultBuilder(args)
.ConfigureWebHostDefaults(web =>
{
web.UseStartup<Startup>()
.ConfigureKestrel(options =>
{
options.ConfigureEndpointDefaults(o => o.Protocols = HttpProtocols.Http2);
});
});
}
}
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System;
using System.Diagnostics;
using System.IO;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Server.Kestrel.Core;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Hosting;
namespace Backend
{
public class Program
{
public static void Main(string[] args)
{
Activity.DefaultIdFormat = ActivityIdFormat.W3C;
CreateHostBuilder(args).Build().Run();
}
public static IHostBuilder CreateHostBuilder(string[] args) =>
Host.CreateDefaultBuilder(args)
.ConfigureWebHostDefaults(web =>
{
web.UseStartup<Startup>()
.ConfigureKestrel(options =>
{
options.ConfigureEndpointDefaults(o => o.Protocols = HttpProtocols.Http2);
});
});
}
}

54
samples/multi-project/backend/Properties/launchSettings.json → test/E2ETest/testassets/projects/multi-project/backend/Properties/launchSettings.json

@ -1,27 +1,27 @@
{
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:40079",
"sslPort": 44368
}
},
"profiles": {
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"backend": {
"commandName": "Project",
"launchBrowser": true,
"applicationUrl": "https://localhost:5001;http://localhost:5000",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
}
}
}
{
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:40079",
"sslPort": 44368
}
},
"profiles": {
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"backend": {
"commandName": "Project",
"launchBrowser": true,
"applicationUrl": "https://localhost:5001;http://localhost:5000",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
}
}
}

138
samples/multi-project/backend/Startup.cs → test/E2ETest/testassets/projects/multi-project/backend/Startup.cs

@ -1,69 +1,69 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using ProtoBuf.Grpc.Server;
using RabbitMQ.Client;
namespace Backend
{
public class Startup
{
public Startup(IConfiguration configuration)
{
Configuration = configuration;
}
public IConfiguration Configuration { get; }
public void ConfigureServices(IServiceCollection services)
{
services.AddAuthorization();
services.AddCodeFirstGrpc();
services.AddSingleton(sp =>
{
var uri = Configuration.GetServiceUri("rabbit");
var endpoint = new AmqpTcpEndpoint(uri);
var factory = new ConnectionFactory()
{
Endpoint = endpoint,
};
var connection = factory.CreateConnection();
var channel = connection.CreateModel();
channel.QueueDeclare(queue: "orders",
durable: false,
exclusive: false,
autoDelete: false,
arguments: null);
return channel;
});
}
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
}
app.UseRouting();
app.UseAuthorization();
app.UseEndpoints(endpoints =>
{
endpoints.MapGrpcService<OrdersService>();
});
}
}
}
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using ProtoBuf.Grpc.Server;
using RabbitMQ.Client;
namespace Backend
{
public class Startup
{
public Startup(IConfiguration configuration)
{
Configuration = configuration;
}
public IConfiguration Configuration { get; }
public void ConfigureServices(IServiceCollection services)
{
services.AddAuthorization();
services.AddCodeFirstGrpc();
services.AddSingleton(sp =>
{
var uri = Configuration.GetServiceUri("rabbit");
var endpoint = new AmqpTcpEndpoint(uri);
var factory = new ConnectionFactory()
{
Endpoint = endpoint,
};
var connection = factory.CreateConnection();
var channel = connection.CreateModel();
channel.QueueDeclare(queue: "orders",
durable: false,
exclusive: false,
autoDelete: false,
arguments: null);
return channel;
});
}
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
}
app.UseRouting();
app.UseAuthorization();
app.UseEndpoints(endpoints =>
{
endpoints.MapGrpcService<OrdersService>();
});
}
}
}

9
test/E2ETest/testassets/projects/multi-project/backend/appsettings.Development.json

@ -0,0 +1,9 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft": "Warning",
"Microsoft.Hosting.Lifetime": "Information"
}
}
}

10
test/E2ETest/testassets/projects/multi-project/backend/appsettings.json

@ -0,0 +1,10 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft": "Warning",
"Microsoft.Hosting.Lifetime": "Information"
}
},
"AllowedHosts": "*"
}

32
samples/multi-project/backend/backend.csproj → test/E2ETest/testassets/projects/multi-project/backend/backend.csproj

@ -1,16 +1,16 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<RootNamespace>Backend</RootNamespace>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="$(TyeLibrariesPath)\Microsoft.Tye.Extensions.Configuration\Microsoft.Tye.Extensions.Configuration.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="RabbitMQ.Client" Version="5.1.2" />
<PackageReference Include="protobuf-net.Grpc.AspNetCore" Version="1.0.21" />
</ItemGroup>
</Project>
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<RootNamespace>Backend</RootNamespace>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="$(TyeLibrariesPath)\Microsoft.Tye.Extensions.Configuration\Microsoft.Tye.Extensions.Configuration.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="RabbitMQ.Client" Version="5.1.2" />
<PackageReference Include="protobuf-net.Grpc.AspNetCore" Version="1.0.21" />
</ItemGroup>
</Project>

0
samples/multi-project/deploy/rabbitmq.yaml → test/E2ETest/testassets/projects/multi-project/deploy/rabbitmq.yaml

0
samples/multi-project/frontend/IOrderService.cs → test/E2ETest/testassets/projects/multi-project/frontend/IOrderService.cs

0
samples/multi-project/frontend/Order.cs → test/E2ETest/testassets/projects/multi-project/frontend/Order.cs

0
samples/multi-project/frontend/Pages/Error.cshtml → test/E2ETest/testassets/projects/multi-project/frontend/Pages/Error.cshtml

0
samples/multi-project/frontend/Pages/Error.cshtml.cs → test/E2ETest/testassets/projects/multi-project/frontend/Pages/Error.cshtml.cs

0
samples/multi-project/frontend/Pages/Index.cshtml → test/E2ETest/testassets/projects/multi-project/frontend/Pages/Index.cshtml

0
samples/multi-project/frontend/Pages/Index.cshtml.cs → test/E2ETest/testassets/projects/multi-project/frontend/Pages/Index.cshtml.cs

0
samples/multi-project/frontend/Pages/Privacy.cshtml → test/E2ETest/testassets/projects/multi-project/frontend/Pages/Privacy.cshtml

0
samples/multi-project/frontend/Pages/Privacy.cshtml.cs → test/E2ETest/testassets/projects/multi-project/frontend/Pages/Privacy.cshtml.cs

0
samples/multi-project/frontend/Pages/Shared/_Layout.cshtml → test/E2ETest/testassets/projects/multi-project/frontend/Pages/Shared/_Layout.cshtml

0
samples/multi-project/frontend/Pages/Shared/_ValidationScriptsPartial.cshtml → test/E2ETest/testassets/projects/multi-project/frontend/Pages/Shared/_ValidationScriptsPartial.cshtml

0
samples/multi-project/frontend/Pages/_ViewImports.cshtml → test/E2ETest/testassets/projects/multi-project/frontend/Pages/_ViewImports.cshtml

0
samples/multi-project/frontend/Pages/_ViewStart.cshtml → test/E2ETest/testassets/projects/multi-project/frontend/Pages/_ViewStart.cshtml

60
samples/multi-project/frontend/Program.cs → test/E2ETest/testassets/projects/multi-project/frontend/Program.cs

@ -1,30 +1,30 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System;
using System.Diagnostics;
using System.IO;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Hosting;
using ProtoBuf.Grpc.Client;
namespace Frontend
{
public class Program
{
public static void Main(string[] args)
{
Activity.DefaultIdFormat = ActivityIdFormat.W3C;
CreateHostBuilder(args).Build().Run();
}
public static IHostBuilder CreateHostBuilder(string[] args) =>
Host.CreateDefaultBuilder(args)
.ConfigureWebHostDefaults(webBuilder =>
{
webBuilder.UseStartup<Startup>();
});
}
}
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System;
using System.Diagnostics;
using System.IO;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Hosting;
using ProtoBuf.Grpc.Client;
namespace Frontend
{
public class Program
{
public static void Main(string[] args)
{
Activity.DefaultIdFormat = ActivityIdFormat.W3C;
CreateHostBuilder(args).Build().Run();
}
public static IHostBuilder CreateHostBuilder(string[] args) =>
Host.CreateDefaultBuilder(args)
.ConfigureWebHostDefaults(webBuilder =>
{
webBuilder.UseStartup<Startup>();
});
}
}

54
samples/multi-project/frontend/Properties/launchSettings.json → test/E2ETest/testassets/projects/multi-project/frontend/Properties/launchSettings.json

@ -1,27 +1,27 @@
{
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:46024",
"sslPort": 44343
}
},
"profiles": {
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"frontend": {
"commandName": "Project",
"launchBrowser": true,
"applicationUrl": "https://localhost:5001;http://localhost:5000",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
}
}
}
{
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:46024",
"sslPort": 44343
}
},
"profiles": {
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"frontend": {
"commandName": "Project",
"launchBrowser": true,
"applicationUrl": "https://localhost:5001;http://localhost:5000",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
}
}
}

112
samples/multi-project/frontend/Startup.cs → test/E2ETest/testassets/projects/multi-project/frontend/Startup.cs

@ -1,56 +1,56 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using Grpc.Net.Client;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using ProtoBuf.Grpc.Client;
using Shared;
namespace Frontend
{
public class Startup
{
public Startup(IConfiguration configuration)
{
Configuration = configuration;
}
public IConfiguration Configuration { get; }
public void ConfigureServices(IServiceCollection services)
{
services.AddRazorPages();
var address = Configuration.GetServiceUri("backend");
services.AddSingleton(_ =>
{
GrpcClientFactory.AllowUnencryptedHttp2 = true;
return GrpcChannel.ForAddress(address!).CreateGrpcService<IOrderService>();
});
}
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
}
app.UseStaticFiles();
app.UseRouting();
app.UseAuthorization();
app.UseEndpoints(endpoints =>
{
endpoints.MapRazorPages();
});
}
}
}
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using Grpc.Net.Client;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using ProtoBuf.Grpc.Client;
using Shared;
namespace Frontend
{
public class Startup
{
public Startup(IConfiguration configuration)
{
Configuration = configuration;
}
public IConfiguration Configuration { get; }
public void ConfigureServices(IServiceCollection services)
{
services.AddRazorPages();
var address = Configuration.GetServiceUri("backend");
services.AddSingleton(_ =>
{
GrpcClientFactory.AllowUnencryptedHttp2 = true;
return GrpcChannel.ForAddress(address!).CreateGrpcService<IOrderService>();
});
}
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
}
app.UseStaticFiles();
app.UseRouting();
app.UseAuthorization();
app.UseEndpoints(endpoints =>
{
endpoints.MapRazorPages();
});
}
}
}

9
test/E2ETest/testassets/projects/multi-project/frontend/appsettings.Development.json

@ -0,0 +1,9 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft": "Warning",
"Microsoft.Hosting.Lifetime": "Information"
}
}
}

10
test/E2ETest/testassets/projects/multi-project/frontend/appsettings.json

@ -0,0 +1,10 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft": "Warning",
"Microsoft.Hosting.Lifetime": "Information"
}
},
"AllowedHosts": "*"
}

32
samples/multi-project/frontend/frontend.csproj → test/E2ETest/testassets/projects/multi-project/frontend/frontend.csproj

@ -1,16 +1,16 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="$(TyeLibrariesPath)\Microsoft.Tye.Extensions.Configuration\Microsoft.Tye.Extensions.Configuration.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Grpc.Net.Client" Version="2.26.0" />
<PackageReference Include="protobuf-net.Grpc" Version="1.0.21" />
</ItemGroup>
</Project>
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="$(TyeLibrariesPath)\Microsoft.Tye.Extensions.Configuration\Microsoft.Tye.Extensions.Configuration.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Grpc.Net.Client" Version="2.26.0" />
<PackageReference Include="protobuf-net.Grpc" Version="1.0.21" />
</ItemGroup>
</Project>

0
samples/multi-project/frontend/wwwroot/css/site.css → test/E2ETest/testassets/projects/multi-project/frontend/wwwroot/css/site.css

0
samples/multi-project/frontend/wwwroot/favicon.ico → test/E2ETest/testassets/projects/multi-project/frontend/wwwroot/favicon.ico

Before

Width:  |  Height:  |  Size: 31 KiB

After

Width:  |  Height:  |  Size: 31 KiB

0
samples/multi-project/frontend/wwwroot/js/site.js → test/E2ETest/testassets/projects/multi-project/frontend/wwwroot/js/site.js

0
samples/multi-project/frontend/wwwroot/lib/bootstrap/LICENSE → test/E2ETest/testassets/projects/multi-project/frontend/wwwroot/lib/bootstrap/LICENSE

0
samples/multi-project/frontend/wwwroot/lib/bootstrap/dist/css/bootstrap-grid.css → test/E2ETest/testassets/projects/multi-project/frontend/wwwroot/lib/bootstrap/dist/css/bootstrap-grid.css

0
samples/multi-project/frontend/wwwroot/lib/bootstrap/dist/css/bootstrap-grid.css.map → test/E2ETest/testassets/projects/multi-project/frontend/wwwroot/lib/bootstrap/dist/css/bootstrap-grid.css.map

0
samples/multi-project/frontend/wwwroot/lib/bootstrap/dist/css/bootstrap-grid.min.css → test/E2ETest/testassets/projects/multi-project/frontend/wwwroot/lib/bootstrap/dist/css/bootstrap-grid.min.css

0
samples/multi-project/frontend/wwwroot/lib/bootstrap/dist/css/bootstrap-grid.min.css.map → test/E2ETest/testassets/projects/multi-project/frontend/wwwroot/lib/bootstrap/dist/css/bootstrap-grid.min.css.map

0
samples/multi-project/frontend/wwwroot/lib/bootstrap/dist/css/bootstrap-reboot.css → test/E2ETest/testassets/projects/multi-project/frontend/wwwroot/lib/bootstrap/dist/css/bootstrap-reboot.css

0
samples/multi-project/frontend/wwwroot/lib/bootstrap/dist/css/bootstrap-reboot.css.map → test/E2ETest/testassets/projects/multi-project/frontend/wwwroot/lib/bootstrap/dist/css/bootstrap-reboot.css.map

0
samples/multi-project/frontend/wwwroot/lib/bootstrap/dist/css/bootstrap-reboot.min.css → test/E2ETest/testassets/projects/multi-project/frontend/wwwroot/lib/bootstrap/dist/css/bootstrap-reboot.min.css

0
samples/multi-project/frontend/wwwroot/lib/bootstrap/dist/css/bootstrap-reboot.min.css.map → test/E2ETest/testassets/projects/multi-project/frontend/wwwroot/lib/bootstrap/dist/css/bootstrap-reboot.min.css.map

0
samples/multi-project/frontend/wwwroot/lib/bootstrap/dist/css/bootstrap.css → test/E2ETest/testassets/projects/multi-project/frontend/wwwroot/lib/bootstrap/dist/css/bootstrap.css

0
samples/multi-project/frontend/wwwroot/lib/bootstrap/dist/css/bootstrap.css.map → test/E2ETest/testassets/projects/multi-project/frontend/wwwroot/lib/bootstrap/dist/css/bootstrap.css.map

0
samples/multi-project/frontend/wwwroot/lib/bootstrap/dist/css/bootstrap.min.css → test/E2ETest/testassets/projects/multi-project/frontend/wwwroot/lib/bootstrap/dist/css/bootstrap.min.css

0
samples/multi-project/frontend/wwwroot/lib/bootstrap/dist/css/bootstrap.min.css.map → test/E2ETest/testassets/projects/multi-project/frontend/wwwroot/lib/bootstrap/dist/css/bootstrap.min.css.map

0
samples/multi-project/frontend/wwwroot/lib/bootstrap/dist/js/bootstrap.bundle.js → test/E2ETest/testassets/projects/multi-project/frontend/wwwroot/lib/bootstrap/dist/js/bootstrap.bundle.js

0
samples/multi-project/frontend/wwwroot/lib/bootstrap/dist/js/bootstrap.bundle.js.map → test/E2ETest/testassets/projects/multi-project/frontend/wwwroot/lib/bootstrap/dist/js/bootstrap.bundle.js.map

0
samples/multi-project/frontend/wwwroot/lib/bootstrap/dist/js/bootstrap.bundle.min.js → test/E2ETest/testassets/projects/multi-project/frontend/wwwroot/lib/bootstrap/dist/js/bootstrap.bundle.min.js

0
samples/multi-project/frontend/wwwroot/lib/bootstrap/dist/js/bootstrap.bundle.min.js.map → test/E2ETest/testassets/projects/multi-project/frontend/wwwroot/lib/bootstrap/dist/js/bootstrap.bundle.min.js.map

0
samples/multi-project/frontend/wwwroot/lib/bootstrap/dist/js/bootstrap.js → test/E2ETest/testassets/projects/multi-project/frontend/wwwroot/lib/bootstrap/dist/js/bootstrap.js

0
samples/multi-project/frontend/wwwroot/lib/bootstrap/dist/js/bootstrap.js.map → test/E2ETest/testassets/projects/multi-project/frontend/wwwroot/lib/bootstrap/dist/js/bootstrap.js.map

0
samples/multi-project/frontend/wwwroot/lib/bootstrap/dist/js/bootstrap.min.js → test/E2ETest/testassets/projects/multi-project/frontend/wwwroot/lib/bootstrap/dist/js/bootstrap.min.js

0
samples/multi-project/frontend/wwwroot/lib/bootstrap/dist/js/bootstrap.min.js.map → test/E2ETest/testassets/projects/multi-project/frontend/wwwroot/lib/bootstrap/dist/js/bootstrap.min.js.map

0
samples/multi-project/frontend/wwwroot/lib/jquery-validation-unobtrusive/LICENSE.txt → test/E2ETest/testassets/projects/multi-project/frontend/wwwroot/lib/jquery-validation-unobtrusive/LICENSE.txt

0
samples/multi-project/frontend/wwwroot/lib/jquery-validation-unobtrusive/jquery.validate.unobtrusive.js → test/E2ETest/testassets/projects/multi-project/frontend/wwwroot/lib/jquery-validation-unobtrusive/jquery.validate.unobtrusive.js

0
samples/multi-project/frontend/wwwroot/lib/jquery-validation-unobtrusive/jquery.validate.unobtrusive.min.js → test/E2ETest/testassets/projects/multi-project/frontend/wwwroot/lib/jquery-validation-unobtrusive/jquery.validate.unobtrusive.min.js

0
samples/multi-project/frontend/wwwroot/lib/jquery-validation/LICENSE.md → test/E2ETest/testassets/projects/multi-project/frontend/wwwroot/lib/jquery-validation/LICENSE.md

0
samples/multi-project/frontend/wwwroot/lib/jquery-validation/dist/additional-methods.js → test/E2ETest/testassets/projects/multi-project/frontend/wwwroot/lib/jquery-validation/dist/additional-methods.js

0
samples/multi-project/frontend/wwwroot/lib/jquery-validation/dist/additional-methods.min.js → test/E2ETest/testassets/projects/multi-project/frontend/wwwroot/lib/jquery-validation/dist/additional-methods.min.js

0
samples/multi-project/frontend/wwwroot/lib/jquery-validation/dist/jquery.validate.js → test/E2ETest/testassets/projects/multi-project/frontend/wwwroot/lib/jquery-validation/dist/jquery.validate.js

0
samples/multi-project/frontend/wwwroot/lib/jquery-validation/dist/jquery.validate.min.js → test/E2ETest/testassets/projects/multi-project/frontend/wwwroot/lib/jquery-validation/dist/jquery.validate.min.js

0
samples/multi-project/frontend/wwwroot/lib/jquery/LICENSE.txt → test/E2ETest/testassets/projects/multi-project/frontend/wwwroot/lib/jquery/LICENSE.txt

0
samples/multi-project/frontend/wwwroot/lib/jquery/dist/jquery.js → test/E2ETest/testassets/projects/multi-project/frontend/wwwroot/lib/jquery/dist/jquery.js

Some files were not shown because too many files changed in this diff

Loading…
Cancel
Save