From 935e680f25957a5c8f34cce07ad3d790aa20eb6d Mon Sep 17 00:00:00 2001 From: Justin Kotalik Date: Tue, 14 Apr 2020 14:00:05 -0700 Subject: [PATCH] Infrastructure and test cleanup (#359) --- .../multi-project-production.example.yaml | 161 ------------------ test/E2ETest/TestHelpers.cs | 28 --- test/E2ETest/TyeAssert.cs | 114 +++++++++++++ test/E2ETest/TyeBuildTests.cs | 8 +- test/E2ETest/TyeGenerateTests.cs | 8 +- test/E2ETest/TyeInitTests.cs | 51 +++--- test/E2ETest/TyePurgeTests.cs | 4 +- test/E2ETest/TyeRunTests.cs | 45 +---- .../testassets/init/single-project.yaml | 10 -- .../ApplicationA/ApplicationA.csproj | 7 + .../apps-with-ingress/ApplicationA/Program.cs | 26 +++ .../Properties/launchSettings.json | 27 +++ .../apps-with-ingress/ApplicationA/Startup.cs | 40 +++++ .../appsettings.Development.json | 6 +- .../ApplicationA}/appsettings.json | 20 +-- .../ApplicationB/ApplicationB.csproj | 7 + .../apps-with-ingress/ApplicationB/Program.cs | 26 +++ .../Properties/launchSettings.json | 27 +++ .../apps-with-ingress/ApplicationB/Startup.cs | 40 +++++ .../appsettings.Development.json | 6 +- .../ApplicationB}/appsettings.json | 20 +-- .../apps-with-ingress/apps-with-ingress.sln | 48 ++++++ .../projects/apps-with-ingress/tye.yaml | 28 +++ .../frontend-backend/backend/Program.cs | 24 +++ .../backend/Properties/launchSettings.json | 27 +++ .../frontend-backend/backend/Startup.cs | 62 +++++++ .../backend}/appsettings.Development.json | 6 +- .../backend}/appsettings.json | 20 +-- .../frontend-backend/backend/backend.csproj | 12 ++ .../frontend-backend-production.example.yaml | 99 +++++++++++ .../frontend-backend/frontend-backend.sln | 48 ++++++ .../frontend-backend/frontend/Program.cs | 24 +++ .../frontend/Properties/launchSettings.json | 27 +++ .../frontend-backend/frontend/Startup.cs | 87 ++++++++++ .../frontend/appsettings.Development.json | 6 +- .../frontend}/appsettings.json | 19 ++- .../frontend-backend/frontend/frontend.csproj | 12 ++ .../projects/frontend-backend/tye.yaml | 8 + .../multi-project/backend/IOrderService.cs | 0 .../projects}/multi-project/backend/Order.cs | 0 .../multi-project/backend/OrdersService.cs | 0 .../multi-project/backend/Program.cs | 70 ++++---- .../backend/Properties/launchSettings.json | 54 +++--- .../multi-project/backend/Startup.cs | 138 +++++++-------- .../backend/appsettings.Development.json | 9 + .../multi-project/backend/appsettings.json | 10 ++ .../multi-project/backend/backend.csproj | 32 ++-- .../multi-project/deploy/rabbitmq.yaml | 0 .../multi-project/frontend/IOrderService.cs | 0 .../projects}/multi-project/frontend/Order.cs | 0 .../multi-project/frontend/Pages/Error.cshtml | 0 .../frontend/Pages/Error.cshtml.cs | 0 .../multi-project/frontend/Pages/Index.cshtml | 0 .../frontend/Pages/Index.cshtml.cs | 0 .../frontend/Pages/Privacy.cshtml | 0 .../frontend/Pages/Privacy.cshtml.cs | 0 .../frontend/Pages/Shared/_Layout.cshtml | 0 .../Shared/_ValidationScriptsPartial.cshtml | 0 .../frontend/Pages/_ViewImports.cshtml | 0 .../frontend/Pages/_ViewStart.cshtml | 0 .../multi-project/frontend/Program.cs | 60 +++---- .../frontend/Properties/launchSettings.json | 54 +++--- .../multi-project/frontend/Startup.cs | 112 ++++++------ .../frontend/appsettings.Development.json | 9 + .../multi-project/frontend/appsettings.json | 10 ++ .../multi-project/frontend/frontend.csproj | 32 ++-- .../frontend/wwwroot/css/site.css | 0 .../frontend/wwwroot/favicon.ico | Bin .../multi-project/frontend/wwwroot/js/site.js | 0 .../frontend/wwwroot/lib/bootstrap/LICENSE | 0 .../lib/bootstrap/dist/css/bootstrap-grid.css | 0 .../bootstrap/dist/css/bootstrap-grid.css.map | 0 .../bootstrap/dist/css/bootstrap-grid.min.css | 0 .../dist/css/bootstrap-grid.min.css.map | 0 .../bootstrap/dist/css/bootstrap-reboot.css | 0 .../dist/css/bootstrap-reboot.css.map | 0 .../dist/css/bootstrap-reboot.min.css | 0 .../dist/css/bootstrap-reboot.min.css.map | 0 .../lib/bootstrap/dist/css/bootstrap.css | 0 .../lib/bootstrap/dist/css/bootstrap.css.map | 0 .../lib/bootstrap/dist/css/bootstrap.min.css | 0 .../bootstrap/dist/css/bootstrap.min.css.map | 0 .../lib/bootstrap/dist/js/bootstrap.bundle.js | 0 .../bootstrap/dist/js/bootstrap.bundle.js.map | 0 .../bootstrap/dist/js/bootstrap.bundle.min.js | 0 .../dist/js/bootstrap.bundle.min.js.map | 0 .../lib/bootstrap/dist/js/bootstrap.js | 0 .../lib/bootstrap/dist/js/bootstrap.js.map | 0 .../lib/bootstrap/dist/js/bootstrap.min.js | 0 .../bootstrap/dist/js/bootstrap.min.js.map | 0 .../jquery-validation-unobtrusive/LICENSE.txt | 0 .../jquery.validate.unobtrusive.js | 0 .../jquery.validate.unobtrusive.min.js | 0 .../wwwroot/lib/jquery-validation/LICENSE.md | 0 .../dist/additional-methods.js | 0 .../dist/additional-methods.min.js | 0 .../jquery-validation/dist/jquery.validate.js | 0 .../dist/jquery.validate.min.js | 0 .../frontend/wwwroot/lib/jquery/LICENSE.txt | 0 .../wwwroot/lib/jquery/dist/jquery.js | 0 .../wwwroot/lib/jquery/dist/jquery.min.js | 0 .../wwwroot/lib/jquery/dist/jquery.min.map | 0 .../projects}/multi-project/multi-project.sln | 124 +++++++------- .../projects}/multi-project/tye.yaml | 4 +- .../projects}/multi-project/worker/Program.cs | 56 +++--- .../worker/Properties/launchSettings.json | 20 +-- .../multi-project/worker/QueueWorker.cs | 0 .../worker/appsettings.Development.json | 9 + .../multi-project/worker/appsettings.json | 9 + .../multi-project/worker/worker.csproj | 34 ++-- .../ApplicationA/ApplicationA.csproj | 7 + .../nginx-ingress/ApplicationA/Program.cs | 26 +++ .../Properties/launchSettings.json | 27 +++ .../nginx-ingress/ApplicationA/Startup.cs | 40 +++++ .../ApplicationA/appsettings.Development.json | 9 + .../ApplicationA/appsettings.json | 10 ++ .../ApplicationB/ApplicationB.csproj | 7 + .../nginx-ingress/ApplicationB/Program.cs | 26 +++ .../Properties/launchSettings.json | 27 +++ .../nginx-ingress/ApplicationB/Startup.cs | 40 +++++ .../ApplicationB/appsettings.Development.json | 9 + .../ApplicationB/appsettings.json | 10 ++ .../nginx-ingress/nginx-with-ingress.sln | 48 ++++++ .../projects/nginx-ingress/nginx.conf | 25 +++ .../projects/nginx-ingress/tye.yaml | 14 ++ .../single-project/single-project.sln | 68 ++++---- .../single-project/test-project/Program.cs | 60 +++---- .../Properties/launchSettings.json | 54 +++--- .../single-project/test-project/Startup.cs | 88 +++++----- .../test-project/appsettings.Development.json | 9 + .../test-project/appsettings.json | 10 ++ .../test-project/test-project.csproj | 16 +- .../projects}/single-project/tye.yaml | 0 test/UnitTests/Microsoft.Tye.UnitTests.csproj | 1 + test/UnitTests/TyeDeserializationTests.cs | 99 +---------- 135 files changed, 1854 insertions(+), 960 deletions(-) delete mode 100644 samples/multi-project/multi-project-production.example.yaml create mode 100644 test/E2ETest/TyeAssert.cs delete mode 100644 test/E2ETest/testassets/init/single-project.yaml create mode 100644 test/E2ETest/testassets/projects/apps-with-ingress/ApplicationA/ApplicationA.csproj create mode 100644 test/E2ETest/testassets/projects/apps-with-ingress/ApplicationA/Program.cs create mode 100644 test/E2ETest/testassets/projects/apps-with-ingress/ApplicationA/Properties/launchSettings.json create mode 100644 test/E2ETest/testassets/projects/apps-with-ingress/ApplicationA/Startup.cs rename {samples/multi-project/backend => test/E2ETest/testassets/projects/apps-with-ingress/ApplicationA}/appsettings.Development.json (98%) rename {samples/multi-project/backend => test/E2ETest/testassets/projects/apps-with-ingress/ApplicationA}/appsettings.json (94%) create mode 100644 test/E2ETest/testassets/projects/apps-with-ingress/ApplicationB/ApplicationB.csproj create mode 100644 test/E2ETest/testassets/projects/apps-with-ingress/ApplicationB/Program.cs create mode 100644 test/E2ETest/testassets/projects/apps-with-ingress/ApplicationB/Properties/launchSettings.json create mode 100644 test/E2ETest/testassets/projects/apps-with-ingress/ApplicationB/Startup.cs rename {samples/multi-project/worker => test/E2ETest/testassets/projects/apps-with-ingress/ApplicationB}/appsettings.Development.json (98%) rename {samples/single-project/test-project => test/E2ETest/testassets/projects/apps-with-ingress/ApplicationB}/appsettings.json (94%) create mode 100644 test/E2ETest/testassets/projects/apps-with-ingress/apps-with-ingress.sln create mode 100644 test/E2ETest/testassets/projects/apps-with-ingress/tye.yaml create mode 100644 test/E2ETest/testassets/projects/frontend-backend/backend/Program.cs create mode 100644 test/E2ETest/testassets/projects/frontend-backend/backend/Properties/launchSettings.json create mode 100644 test/E2ETest/testassets/projects/frontend-backend/backend/Startup.cs rename {samples/single-project/test-project => test/E2ETest/testassets/projects/frontend-backend/backend}/appsettings.Development.json (98%) rename {samples/multi-project/frontend => test/E2ETest/testassets/projects/frontend-backend/backend}/appsettings.json (94%) create mode 100644 test/E2ETest/testassets/projects/frontend-backend/backend/backend.csproj create mode 100644 test/E2ETest/testassets/projects/frontend-backend/frontend-backend-production.example.yaml create mode 100644 test/E2ETest/testassets/projects/frontend-backend/frontend-backend.sln create mode 100644 test/E2ETest/testassets/projects/frontend-backend/frontend/Program.cs create mode 100644 test/E2ETest/testassets/projects/frontend-backend/frontend/Properties/launchSettings.json create mode 100644 test/E2ETest/testassets/projects/frontend-backend/frontend/Startup.cs rename {samples/multi-project => test/E2ETest/testassets/projects/frontend-backend}/frontend/appsettings.Development.json (98%) rename {samples/multi-project/worker => test/E2ETest/testassets/projects/frontend-backend/frontend}/appsettings.json (85%) create mode 100644 test/E2ETest/testassets/projects/frontend-backend/frontend/frontend.csproj create mode 100644 test/E2ETest/testassets/projects/frontend-backend/tye.yaml rename {samples => test/E2ETest/testassets/projects}/multi-project/backend/IOrderService.cs (100%) rename {samples => test/E2ETest/testassets/projects}/multi-project/backend/Order.cs (100%) rename {samples => test/E2ETest/testassets/projects}/multi-project/backend/OrdersService.cs (100%) rename {samples => test/E2ETest/testassets/projects}/multi-project/backend/Program.cs (96%) rename {samples => test/E2ETest/testassets/projects}/multi-project/backend/Properties/launchSettings.json (96%) rename {samples => test/E2ETest/testassets/projects}/multi-project/backend/Startup.cs (96%) create mode 100644 test/E2ETest/testassets/projects/multi-project/backend/appsettings.Development.json create mode 100644 test/E2ETest/testassets/projects/multi-project/backend/appsettings.json rename {samples => test/E2ETest/testassets/projects}/multi-project/backend/backend.csproj (97%) rename {samples => test/E2ETest/testassets/projects}/multi-project/deploy/rabbitmq.yaml (100%) rename {samples => test/E2ETest/testassets/projects}/multi-project/frontend/IOrderService.cs (100%) rename {samples => test/E2ETest/testassets/projects}/multi-project/frontend/Order.cs (100%) rename {samples => test/E2ETest/testassets/projects}/multi-project/frontend/Pages/Error.cshtml (100%) rename {samples => test/E2ETest/testassets/projects}/multi-project/frontend/Pages/Error.cshtml.cs (100%) rename {samples => test/E2ETest/testassets/projects}/multi-project/frontend/Pages/Index.cshtml (100%) rename {samples => test/E2ETest/testassets/projects}/multi-project/frontend/Pages/Index.cshtml.cs (100%) rename {samples => test/E2ETest/testassets/projects}/multi-project/frontend/Pages/Privacy.cshtml (100%) rename {samples => test/E2ETest/testassets/projects}/multi-project/frontend/Pages/Privacy.cshtml.cs (100%) rename {samples => test/E2ETest/testassets/projects}/multi-project/frontend/Pages/Shared/_Layout.cshtml (100%) rename {samples => test/E2ETest/testassets/projects}/multi-project/frontend/Pages/Shared/_ValidationScriptsPartial.cshtml (100%) rename {samples => test/E2ETest/testassets/projects}/multi-project/frontend/Pages/_ViewImports.cshtml (100%) rename {samples => test/E2ETest/testassets/projects}/multi-project/frontend/Pages/_ViewStart.cshtml (100%) rename {samples => test/E2ETest/testassets/projects}/multi-project/frontend/Program.cs (96%) rename {samples => test/E2ETest/testassets/projects}/multi-project/frontend/Properties/launchSettings.json (96%) rename {samples => test/E2ETest/testassets/projects}/multi-project/frontend/Startup.cs (96%) create mode 100644 test/E2ETest/testassets/projects/multi-project/frontend/appsettings.Development.json create mode 100644 test/E2ETest/testassets/projects/multi-project/frontend/appsettings.json rename {samples => test/E2ETest/testassets/projects}/multi-project/frontend/frontend.csproj (96%) rename {samples => test/E2ETest/testassets/projects}/multi-project/frontend/wwwroot/css/site.css (100%) rename {samples => test/E2ETest/testassets/projects}/multi-project/frontend/wwwroot/favicon.ico (100%) rename {samples => test/E2ETest/testassets/projects}/multi-project/frontend/wwwroot/js/site.js (100%) rename {samples => test/E2ETest/testassets/projects}/multi-project/frontend/wwwroot/lib/bootstrap/LICENSE (100%) rename {samples => test/E2ETest/testassets/projects}/multi-project/frontend/wwwroot/lib/bootstrap/dist/css/bootstrap-grid.css (100%) rename {samples => test/E2ETest/testassets/projects}/multi-project/frontend/wwwroot/lib/bootstrap/dist/css/bootstrap-grid.css.map (100%) rename {samples => test/E2ETest/testassets/projects}/multi-project/frontend/wwwroot/lib/bootstrap/dist/css/bootstrap-grid.min.css (100%) rename {samples => test/E2ETest/testassets/projects}/multi-project/frontend/wwwroot/lib/bootstrap/dist/css/bootstrap-grid.min.css.map (100%) rename {samples => test/E2ETest/testassets/projects}/multi-project/frontend/wwwroot/lib/bootstrap/dist/css/bootstrap-reboot.css (100%) rename {samples => test/E2ETest/testassets/projects}/multi-project/frontend/wwwroot/lib/bootstrap/dist/css/bootstrap-reboot.css.map (100%) rename {samples => test/E2ETest/testassets/projects}/multi-project/frontend/wwwroot/lib/bootstrap/dist/css/bootstrap-reboot.min.css (100%) rename {samples => test/E2ETest/testassets/projects}/multi-project/frontend/wwwroot/lib/bootstrap/dist/css/bootstrap-reboot.min.css.map (100%) rename {samples => test/E2ETest/testassets/projects}/multi-project/frontend/wwwroot/lib/bootstrap/dist/css/bootstrap.css (100%) rename {samples => test/E2ETest/testassets/projects}/multi-project/frontend/wwwroot/lib/bootstrap/dist/css/bootstrap.css.map (100%) rename {samples => test/E2ETest/testassets/projects}/multi-project/frontend/wwwroot/lib/bootstrap/dist/css/bootstrap.min.css (100%) rename {samples => test/E2ETest/testassets/projects}/multi-project/frontend/wwwroot/lib/bootstrap/dist/css/bootstrap.min.css.map (100%) rename {samples => test/E2ETest/testassets/projects}/multi-project/frontend/wwwroot/lib/bootstrap/dist/js/bootstrap.bundle.js (100%) rename {samples => test/E2ETest/testassets/projects}/multi-project/frontend/wwwroot/lib/bootstrap/dist/js/bootstrap.bundle.js.map (100%) rename {samples => test/E2ETest/testassets/projects}/multi-project/frontend/wwwroot/lib/bootstrap/dist/js/bootstrap.bundle.min.js (100%) rename {samples => test/E2ETest/testassets/projects}/multi-project/frontend/wwwroot/lib/bootstrap/dist/js/bootstrap.bundle.min.js.map (100%) rename {samples => test/E2ETest/testassets/projects}/multi-project/frontend/wwwroot/lib/bootstrap/dist/js/bootstrap.js (100%) rename {samples => test/E2ETest/testassets/projects}/multi-project/frontend/wwwroot/lib/bootstrap/dist/js/bootstrap.js.map (100%) rename {samples => test/E2ETest/testassets/projects}/multi-project/frontend/wwwroot/lib/bootstrap/dist/js/bootstrap.min.js (100%) rename {samples => test/E2ETest/testassets/projects}/multi-project/frontend/wwwroot/lib/bootstrap/dist/js/bootstrap.min.js.map (100%) rename {samples => test/E2ETest/testassets/projects}/multi-project/frontend/wwwroot/lib/jquery-validation-unobtrusive/LICENSE.txt (100%) rename {samples => test/E2ETest/testassets/projects}/multi-project/frontend/wwwroot/lib/jquery-validation-unobtrusive/jquery.validate.unobtrusive.js (100%) rename {samples => test/E2ETest/testassets/projects}/multi-project/frontend/wwwroot/lib/jquery-validation-unobtrusive/jquery.validate.unobtrusive.min.js (100%) rename {samples => test/E2ETest/testassets/projects}/multi-project/frontend/wwwroot/lib/jquery-validation/LICENSE.md (100%) rename {samples => test/E2ETest/testassets/projects}/multi-project/frontend/wwwroot/lib/jquery-validation/dist/additional-methods.js (100%) rename {samples => test/E2ETest/testassets/projects}/multi-project/frontend/wwwroot/lib/jquery-validation/dist/additional-methods.min.js (100%) rename {samples => test/E2ETest/testassets/projects}/multi-project/frontend/wwwroot/lib/jquery-validation/dist/jquery.validate.js (100%) rename {samples => test/E2ETest/testassets/projects}/multi-project/frontend/wwwroot/lib/jquery-validation/dist/jquery.validate.min.js (100%) rename {samples => test/E2ETest/testassets/projects}/multi-project/frontend/wwwroot/lib/jquery/LICENSE.txt (100%) rename {samples => test/E2ETest/testassets/projects}/multi-project/frontend/wwwroot/lib/jquery/dist/jquery.js (100%) rename {samples => test/E2ETest/testassets/projects}/multi-project/frontend/wwwroot/lib/jquery/dist/jquery.min.js (100%) rename {samples => test/E2ETest/testassets/projects}/multi-project/frontend/wwwroot/lib/jquery/dist/jquery.min.map (100%) rename {samples => test/E2ETest/testassets/projects}/multi-project/multi-project.sln (98%) rename {samples => test/E2ETest/testassets/projects}/multi-project/tye.yaml (87%) rename {samples => test/E2ETest/testassets/projects}/multi-project/worker/Program.cs (96%) rename {samples => test/E2ETest/testassets/projects}/multi-project/worker/Properties/launchSettings.json (94%) rename {samples => test/E2ETest/testassets/projects}/multi-project/worker/QueueWorker.cs (100%) create mode 100644 test/E2ETest/testassets/projects/multi-project/worker/appsettings.Development.json create mode 100644 test/E2ETest/testassets/projects/multi-project/worker/appsettings.json rename {samples => test/E2ETest/testassets/projects}/multi-project/worker/worker.csproj (97%) create mode 100644 test/E2ETest/testassets/projects/nginx-ingress/ApplicationA/ApplicationA.csproj create mode 100644 test/E2ETest/testassets/projects/nginx-ingress/ApplicationA/Program.cs create mode 100644 test/E2ETest/testassets/projects/nginx-ingress/ApplicationA/Properties/launchSettings.json create mode 100644 test/E2ETest/testassets/projects/nginx-ingress/ApplicationA/Startup.cs create mode 100644 test/E2ETest/testassets/projects/nginx-ingress/ApplicationA/appsettings.Development.json create mode 100644 test/E2ETest/testassets/projects/nginx-ingress/ApplicationA/appsettings.json create mode 100644 test/E2ETest/testassets/projects/nginx-ingress/ApplicationB/ApplicationB.csproj create mode 100644 test/E2ETest/testassets/projects/nginx-ingress/ApplicationB/Program.cs create mode 100644 test/E2ETest/testassets/projects/nginx-ingress/ApplicationB/Properties/launchSettings.json create mode 100644 test/E2ETest/testassets/projects/nginx-ingress/ApplicationB/Startup.cs create mode 100644 test/E2ETest/testassets/projects/nginx-ingress/ApplicationB/appsettings.Development.json create mode 100644 test/E2ETest/testassets/projects/nginx-ingress/ApplicationB/appsettings.json create mode 100644 test/E2ETest/testassets/projects/nginx-ingress/nginx-with-ingress.sln create mode 100644 test/E2ETest/testassets/projects/nginx-ingress/nginx.conf create mode 100644 test/E2ETest/testassets/projects/nginx-ingress/tye.yaml rename {samples => test/E2ETest/testassets/projects}/single-project/single-project.sln (98%) rename {samples => test/E2ETest/testassets/projects}/single-project/test-project/Program.cs (96%) rename {samples => test/E2ETest/testassets/projects}/single-project/test-project/Properties/launchSettings.json (96%) rename {samples => test/E2ETest/testassets/projects}/single-project/test-project/Startup.cs (97%) create mode 100644 test/E2ETest/testassets/projects/single-project/test-project/appsettings.Development.json create mode 100644 test/E2ETest/testassets/projects/single-project/test-project/appsettings.json rename {samples => test/E2ETest/testassets/projects}/single-project/test-project/test-project.csproj (95%) rename {samples => test/E2ETest/testassets/projects}/single-project/tye.yaml (100%) diff --git a/samples/multi-project/multi-project-production.example.yaml b/samples/multi-project/multi-project-production.example.yaml deleted file mode 100644 index cd7e2f83..00000000 --- a/samples/multi-project/multi-project-production.example.yaml +++ /dev/null @@ -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 -... diff --git a/test/E2ETest/TestHelpers.cs b/test/E2ETest/TestHelpers.cs index 156a44e6..7854a6a5 100644 --- a/test/E2ETest/TestHelpers.cs +++ b/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"), - $@" - - - {libraryPath} - -"); - - return temp; - } - internal static TempDirectory CopyTestProjectDirectory(string projectName) { var temp = TempDirectory.Create(preferUserDirectoryOnMacOS: true); diff --git a/test/E2ETest/TyeAssert.cs b/test/E2ETest/TyeAssert.cs new file mode 100644 index 00000000..976f5494 --- /dev/null +++ b/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); + } + } + } + } +} diff --git a/test/E2ETest/TyeBuildTests.cs b/test/E2ETest/TyeBuildTests.cs index 7b8fcaeb..4590ab0d 100644 --- a/test/E2ETest/TyeBuildTests.cs +++ b/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); diff --git a/test/E2ETest/TyeGenerateTests.cs b/test/E2ETest/TyeGenerateTests.cs index 5ef7c72c..98d25575 100644 --- a/test/E2ETest/TyeGenerateTests.cs +++ b/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")); diff --git a/test/E2ETest/TyeInitTests.cs b/test/E2ETest/TyeInitTests.cs index 15d929ba..6e4aefb3 100644 --- a/test/E2ETest/TyeInitTests.cs +++ b/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(content); - output.WriteLine(content); + var expectedContent = File.ReadAllText("testassets/init/multi-project.yaml"); + var expected = _deserializer.Deserialize(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(content); - output.WriteLine(content); + var expectedContent = File.ReadAllText("testassets/init/project-types.yaml"); + var expected = _deserializer.Deserialize(expectedContent); - Assert.Equal(expectedContent.NormalizeNewLines(), content.NormalizeNewLines()); + TyeAssert.Equal(expected, actual); } } } diff --git a/test/E2ETest/TyePurgeTests.cs b/test/E2ETest/TyePurgeTests.cs index 85574dbd..54c93219 100644 --- a/test/E2ETest/TyePurgeTests.cs +++ b/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")); diff --git a/test/E2ETest/TyeRunTests.cs b/test/E2ETest/TyeRunTests.cs index 2ca7803b..9458f71a 100644 --- a/test/E2ETest/TyeRunTests.cs +++ b/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(), 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")); diff --git a/test/E2ETest/testassets/init/single-project.yaml b/test/E2ETest/testassets/init/single-project.yaml deleted file mode 100644 index 37163ffc..00000000 --- a/test/E2ETest/testassets/init/single-project.yaml +++ /dev/null @@ -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 diff --git a/test/E2ETest/testassets/projects/apps-with-ingress/ApplicationA/ApplicationA.csproj b/test/E2ETest/testassets/projects/apps-with-ingress/ApplicationA/ApplicationA.csproj new file mode 100644 index 00000000..92605c5a --- /dev/null +++ b/test/E2ETest/testassets/projects/apps-with-ingress/ApplicationA/ApplicationA.csproj @@ -0,0 +1,7 @@ + + + + netcoreapp3.1 + + + diff --git a/test/E2ETest/testassets/projects/apps-with-ingress/ApplicationA/Program.cs b/test/E2ETest/testassets/projects/apps-with-ingress/ApplicationA/Program.cs new file mode 100644 index 00000000..56492c75 --- /dev/null +++ b/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(); + }); + } +} diff --git a/test/E2ETest/testassets/projects/apps-with-ingress/ApplicationA/Properties/launchSettings.json b/test/E2ETest/testassets/projects/apps-with-ingress/ApplicationA/Properties/launchSettings.json new file mode 100644 index 00000000..767a1d0b --- /dev/null +++ b/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" + } + } + } +} diff --git a/test/E2ETest/testassets/projects/apps-with-ingress/ApplicationA/Startup.cs b/test/E2ETest/testassets/projects/apps-with-ingress/ApplicationA/Startup.cs new file mode 100644 index 00000000..257fd799 --- /dev/null +++ b/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")); + }); + }); + } + } +} diff --git a/samples/multi-project/backend/appsettings.Development.json b/test/E2ETest/testassets/projects/apps-with-ingress/ApplicationA/appsettings.Development.json similarity index 98% rename from samples/multi-project/backend/appsettings.Development.json rename to test/E2ETest/testassets/projects/apps-with-ingress/ApplicationA/appsettings.Development.json index dba68eb1..8983e0fc 100644 --- a/samples/multi-project/backend/appsettings.Development.json +++ b/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" } } } diff --git a/samples/multi-project/backend/appsettings.json b/test/E2ETest/testassets/projects/apps-with-ingress/ApplicationA/appsettings.json similarity index 94% rename from samples/multi-project/backend/appsettings.json rename to test/E2ETest/testassets/projects/apps-with-ingress/ApplicationA/appsettings.json index 81ff8777..d9d9a9bf 100644 --- a/samples/multi-project/backend/appsettings.json +++ b/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": "*" +} diff --git a/test/E2ETest/testassets/projects/apps-with-ingress/ApplicationB/ApplicationB.csproj b/test/E2ETest/testassets/projects/apps-with-ingress/ApplicationB/ApplicationB.csproj new file mode 100644 index 00000000..92605c5a --- /dev/null +++ b/test/E2ETest/testassets/projects/apps-with-ingress/ApplicationB/ApplicationB.csproj @@ -0,0 +1,7 @@ + + + + netcoreapp3.1 + + + diff --git a/test/E2ETest/testassets/projects/apps-with-ingress/ApplicationB/Program.cs b/test/E2ETest/testassets/projects/apps-with-ingress/ApplicationB/Program.cs new file mode 100644 index 00000000..8b3c38af --- /dev/null +++ b/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(); + }); + } +} diff --git a/test/E2ETest/testassets/projects/apps-with-ingress/ApplicationB/Properties/launchSettings.json b/test/E2ETest/testassets/projects/apps-with-ingress/ApplicationB/Properties/launchSettings.json new file mode 100644 index 00000000..2b1eba0f --- /dev/null +++ b/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" + } + } + } +} diff --git a/test/E2ETest/testassets/projects/apps-with-ingress/ApplicationB/Startup.cs b/test/E2ETest/testassets/projects/apps-with-ingress/ApplicationB/Startup.cs new file mode 100644 index 00000000..1a6b68d8 --- /dev/null +++ b/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")); + }); + }); + } + } +} diff --git a/samples/multi-project/worker/appsettings.Development.json b/test/E2ETest/testassets/projects/apps-with-ingress/ApplicationB/appsettings.Development.json similarity index 98% rename from samples/multi-project/worker/appsettings.Development.json rename to test/E2ETest/testassets/projects/apps-with-ingress/ApplicationB/appsettings.Development.json index dba68eb1..8983e0fc 100644 --- a/samples/multi-project/worker/appsettings.Development.json +++ b/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" } } } diff --git a/samples/single-project/test-project/appsettings.json b/test/E2ETest/testassets/projects/apps-with-ingress/ApplicationB/appsettings.json similarity index 94% rename from samples/single-project/test-project/appsettings.json rename to test/E2ETest/testassets/projects/apps-with-ingress/ApplicationB/appsettings.json index 81ff8777..d9d9a9bf 100644 --- a/samples/single-project/test-project/appsettings.json +++ b/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": "*" +} diff --git a/test/E2ETest/testassets/projects/apps-with-ingress/apps-with-ingress.sln b/test/E2ETest/testassets/projects/apps-with-ingress/apps-with-ingress.sln new file mode 100644 index 00000000..3dcc942e --- /dev/null +++ b/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 diff --git a/test/E2ETest/testassets/projects/apps-with-ingress/tye.yaml b/test/E2ETest/testassets/projects/apps-with-ingress/tye.yaml new file mode 100644 index 00000000..1ca6410b --- /dev/null +++ b/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 diff --git a/test/E2ETest/testassets/projects/frontend-backend/backend/Program.cs b/test/E2ETest/testassets/projects/frontend-backend/backend/Program.cs new file mode 100644 index 00000000..5659e57e --- /dev/null +++ b/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(); + }); + } +} diff --git a/test/E2ETest/testassets/projects/frontend-backend/backend/Properties/launchSettings.json b/test/E2ETest/testassets/projects/frontend-backend/backend/Properties/launchSettings.json new file mode 100644 index 00000000..479e7d6e --- /dev/null +++ b/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" + } + } + } +} diff --git a/test/E2ETest/testassets/projects/frontend-backend/backend/Startup.cs b/test/E2ETest/testassets/projects/frontend-backend/backend/Startup.cs new file mode 100644 index 00000000..2d05b339 --- /dev/null +++ b/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!; + } + } +} diff --git a/samples/single-project/test-project/appsettings.Development.json b/test/E2ETest/testassets/projects/frontend-backend/backend/appsettings.Development.json similarity index 98% rename from samples/single-project/test-project/appsettings.Development.json rename to test/E2ETest/testassets/projects/frontend-backend/backend/appsettings.Development.json index dba68eb1..8983e0fc 100644 --- a/samples/single-project/test-project/appsettings.Development.json +++ b/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" } } } diff --git a/samples/multi-project/frontend/appsettings.json b/test/E2ETest/testassets/projects/frontend-backend/backend/appsettings.json similarity index 94% rename from samples/multi-project/frontend/appsettings.json rename to test/E2ETest/testassets/projects/frontend-backend/backend/appsettings.json index 81ff8777..d9d9a9bf 100644 --- a/samples/multi-project/frontend/appsettings.json +++ b/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": "*" +} diff --git a/test/E2ETest/testassets/projects/frontend-backend/backend/backend.csproj b/test/E2ETest/testassets/projects/frontend-backend/backend/backend.csproj new file mode 100644 index 00000000..4e98f5a2 --- /dev/null +++ b/test/E2ETest/testassets/projects/frontend-backend/backend/backend.csproj @@ -0,0 +1,12 @@ + + + + netcoreapp3.1 + Backend + + + + + + + diff --git a/test/E2ETest/testassets/projects/frontend-backend/frontend-backend-production.example.yaml b/test/E2ETest/testassets/projects/frontend-backend/frontend-backend-production.example.yaml new file mode 100644 index 00000000..9c24025e --- /dev/null +++ b/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 +... diff --git a/test/E2ETest/testassets/projects/frontend-backend/frontend-backend.sln b/test/E2ETest/testassets/projects/frontend-backend/frontend-backend.sln new file mode 100644 index 00000000..fddf7bd1 --- /dev/null +++ b/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 diff --git a/test/E2ETest/testassets/projects/frontend-backend/frontend/Program.cs b/test/E2ETest/testassets/projects/frontend-backend/frontend/Program.cs new file mode 100644 index 00000000..122bc514 --- /dev/null +++ b/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(); + }); + } +} diff --git a/test/E2ETest/testassets/projects/frontend-backend/frontend/Properties/launchSettings.json b/test/E2ETest/testassets/projects/frontend-backend/frontend/Properties/launchSettings.json new file mode 100644 index 00000000..1a3cf3a6 --- /dev/null +++ b/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" + } + } + } +} diff --git a/test/E2ETest/testassets/projects/frontend-backend/frontend/Startup.cs b/test/E2ETest/testassets/projects/frontend-backend/frontend/Startup.cs new file mode 100644 index 00000000..197e7001 --- /dev/null +++ b/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 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(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!; + } + } +} diff --git a/samples/multi-project/frontend/appsettings.Development.json b/test/E2ETest/testassets/projects/frontend-backend/frontend/appsettings.Development.json similarity index 98% rename from samples/multi-project/frontend/appsettings.Development.json rename to test/E2ETest/testassets/projects/frontend-backend/frontend/appsettings.Development.json index dba68eb1..8983e0fc 100644 --- a/samples/multi-project/frontend/appsettings.Development.json +++ b/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" } } } diff --git a/samples/multi-project/worker/appsettings.json b/test/E2ETest/testassets/projects/frontend-backend/frontend/appsettings.json similarity index 85% rename from samples/multi-project/worker/appsettings.json rename to test/E2ETest/testassets/projects/frontend-backend/frontend/appsettings.json index 70734009..d9d9a9bf 100644 --- a/samples/multi-project/worker/appsettings.json +++ b/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": "*" +} diff --git a/test/E2ETest/testassets/projects/frontend-backend/frontend/frontend.csproj b/test/E2ETest/testassets/projects/frontend-backend/frontend/frontend.csproj new file mode 100644 index 00000000..0aa4abc0 --- /dev/null +++ b/test/E2ETest/testassets/projects/frontend-backend/frontend/frontend.csproj @@ -0,0 +1,12 @@ + + + + netcoreapp3.1 + Frontend + + + + + + + diff --git a/test/E2ETest/testassets/projects/frontend-backend/tye.yaml b/test/E2ETest/testassets/projects/frontend-backend/tye.yaml new file mode 100644 index 00000000..8868a09a --- /dev/null +++ b/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 diff --git a/samples/multi-project/backend/IOrderService.cs b/test/E2ETest/testassets/projects/multi-project/backend/IOrderService.cs similarity index 100% rename from samples/multi-project/backend/IOrderService.cs rename to test/E2ETest/testassets/projects/multi-project/backend/IOrderService.cs diff --git a/samples/multi-project/backend/Order.cs b/test/E2ETest/testassets/projects/multi-project/backend/Order.cs similarity index 100% rename from samples/multi-project/backend/Order.cs rename to test/E2ETest/testassets/projects/multi-project/backend/Order.cs diff --git a/samples/multi-project/backend/OrdersService.cs b/test/E2ETest/testassets/projects/multi-project/backend/OrdersService.cs similarity index 100% rename from samples/multi-project/backend/OrdersService.cs rename to test/E2ETest/testassets/projects/multi-project/backend/OrdersService.cs diff --git a/samples/multi-project/backend/Program.cs b/test/E2ETest/testassets/projects/multi-project/backend/Program.cs similarity index 96% rename from samples/multi-project/backend/Program.cs rename to test/E2ETest/testassets/projects/multi-project/backend/Program.cs index 6fc190c5..a1babb33 100644 --- a/samples/multi-project/backend/Program.cs +++ b/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() - .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() + .ConfigureKestrel(options => + { + options.ConfigureEndpointDefaults(o => o.Protocols = HttpProtocols.Http2); + }); + }); + } +} diff --git a/samples/multi-project/backend/Properties/launchSettings.json b/test/E2ETest/testassets/projects/multi-project/backend/Properties/launchSettings.json similarity index 96% rename from samples/multi-project/backend/Properties/launchSettings.json rename to test/E2ETest/testassets/projects/multi-project/backend/Properties/launchSettings.json index 99db03ba..6c33284d 100644 --- a/samples/multi-project/backend/Properties/launchSettings.json +++ b/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" + } + } + } +} diff --git a/samples/multi-project/backend/Startup.cs b/test/E2ETest/testassets/projects/multi-project/backend/Startup.cs similarity index 96% rename from samples/multi-project/backend/Startup.cs rename to test/E2ETest/testassets/projects/multi-project/backend/Startup.cs index 381a4e15..3e074e63 100644 --- a/samples/multi-project/backend/Startup.cs +++ b/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(); - }); - } - } -} +// 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(); + }); + } + } +} diff --git a/test/E2ETest/testassets/projects/multi-project/backend/appsettings.Development.json b/test/E2ETest/testassets/projects/multi-project/backend/appsettings.Development.json new file mode 100644 index 00000000..8983e0fc --- /dev/null +++ b/test/E2ETest/testassets/projects/multi-project/backend/appsettings.Development.json @@ -0,0 +1,9 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft": "Warning", + "Microsoft.Hosting.Lifetime": "Information" + } + } +} diff --git a/test/E2ETest/testassets/projects/multi-project/backend/appsettings.json b/test/E2ETest/testassets/projects/multi-project/backend/appsettings.json new file mode 100644 index 00000000..d9d9a9bf --- /dev/null +++ b/test/E2ETest/testassets/projects/multi-project/backend/appsettings.json @@ -0,0 +1,10 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft": "Warning", + "Microsoft.Hosting.Lifetime": "Information" + } + }, + "AllowedHosts": "*" +} diff --git a/samples/multi-project/backend/backend.csproj b/test/E2ETest/testassets/projects/multi-project/backend/backend.csproj similarity index 97% rename from samples/multi-project/backend/backend.csproj rename to test/E2ETest/testassets/projects/multi-project/backend/backend.csproj index 4bf76166..95596492 100644 --- a/samples/multi-project/backend/backend.csproj +++ b/test/E2ETest/testassets/projects/multi-project/backend/backend.csproj @@ -1,16 +1,16 @@ - - - - netcoreapp3.1 - Backend - - - - - - - - - - - + + + + netcoreapp3.1 + Backend + + + + + + + + + + + diff --git a/samples/multi-project/deploy/rabbitmq.yaml b/test/E2ETest/testassets/projects/multi-project/deploy/rabbitmq.yaml similarity index 100% rename from samples/multi-project/deploy/rabbitmq.yaml rename to test/E2ETest/testassets/projects/multi-project/deploy/rabbitmq.yaml diff --git a/samples/multi-project/frontend/IOrderService.cs b/test/E2ETest/testassets/projects/multi-project/frontend/IOrderService.cs similarity index 100% rename from samples/multi-project/frontend/IOrderService.cs rename to test/E2ETest/testassets/projects/multi-project/frontend/IOrderService.cs diff --git a/samples/multi-project/frontend/Order.cs b/test/E2ETest/testassets/projects/multi-project/frontend/Order.cs similarity index 100% rename from samples/multi-project/frontend/Order.cs rename to test/E2ETest/testassets/projects/multi-project/frontend/Order.cs diff --git a/samples/multi-project/frontend/Pages/Error.cshtml b/test/E2ETest/testassets/projects/multi-project/frontend/Pages/Error.cshtml similarity index 100% rename from samples/multi-project/frontend/Pages/Error.cshtml rename to test/E2ETest/testassets/projects/multi-project/frontend/Pages/Error.cshtml diff --git a/samples/multi-project/frontend/Pages/Error.cshtml.cs b/test/E2ETest/testassets/projects/multi-project/frontend/Pages/Error.cshtml.cs similarity index 100% rename from samples/multi-project/frontend/Pages/Error.cshtml.cs rename to test/E2ETest/testassets/projects/multi-project/frontend/Pages/Error.cshtml.cs diff --git a/samples/multi-project/frontend/Pages/Index.cshtml b/test/E2ETest/testassets/projects/multi-project/frontend/Pages/Index.cshtml similarity index 100% rename from samples/multi-project/frontend/Pages/Index.cshtml rename to test/E2ETest/testassets/projects/multi-project/frontend/Pages/Index.cshtml diff --git a/samples/multi-project/frontend/Pages/Index.cshtml.cs b/test/E2ETest/testassets/projects/multi-project/frontend/Pages/Index.cshtml.cs similarity index 100% rename from samples/multi-project/frontend/Pages/Index.cshtml.cs rename to test/E2ETest/testassets/projects/multi-project/frontend/Pages/Index.cshtml.cs diff --git a/samples/multi-project/frontend/Pages/Privacy.cshtml b/test/E2ETest/testassets/projects/multi-project/frontend/Pages/Privacy.cshtml similarity index 100% rename from samples/multi-project/frontend/Pages/Privacy.cshtml rename to test/E2ETest/testassets/projects/multi-project/frontend/Pages/Privacy.cshtml diff --git a/samples/multi-project/frontend/Pages/Privacy.cshtml.cs b/test/E2ETest/testassets/projects/multi-project/frontend/Pages/Privacy.cshtml.cs similarity index 100% rename from samples/multi-project/frontend/Pages/Privacy.cshtml.cs rename to test/E2ETest/testassets/projects/multi-project/frontend/Pages/Privacy.cshtml.cs diff --git a/samples/multi-project/frontend/Pages/Shared/_Layout.cshtml b/test/E2ETest/testassets/projects/multi-project/frontend/Pages/Shared/_Layout.cshtml similarity index 100% rename from samples/multi-project/frontend/Pages/Shared/_Layout.cshtml rename to test/E2ETest/testassets/projects/multi-project/frontend/Pages/Shared/_Layout.cshtml diff --git a/samples/multi-project/frontend/Pages/Shared/_ValidationScriptsPartial.cshtml b/test/E2ETest/testassets/projects/multi-project/frontend/Pages/Shared/_ValidationScriptsPartial.cshtml similarity index 100% rename from samples/multi-project/frontend/Pages/Shared/_ValidationScriptsPartial.cshtml rename to test/E2ETest/testassets/projects/multi-project/frontend/Pages/Shared/_ValidationScriptsPartial.cshtml diff --git a/samples/multi-project/frontend/Pages/_ViewImports.cshtml b/test/E2ETest/testassets/projects/multi-project/frontend/Pages/_ViewImports.cshtml similarity index 100% rename from samples/multi-project/frontend/Pages/_ViewImports.cshtml rename to test/E2ETest/testassets/projects/multi-project/frontend/Pages/_ViewImports.cshtml diff --git a/samples/multi-project/frontend/Pages/_ViewStart.cshtml b/test/E2ETest/testassets/projects/multi-project/frontend/Pages/_ViewStart.cshtml similarity index 100% rename from samples/multi-project/frontend/Pages/_ViewStart.cshtml rename to test/E2ETest/testassets/projects/multi-project/frontend/Pages/_ViewStart.cshtml diff --git a/samples/multi-project/frontend/Program.cs b/test/E2ETest/testassets/projects/multi-project/frontend/Program.cs similarity index 96% rename from samples/multi-project/frontend/Program.cs rename to test/E2ETest/testassets/projects/multi-project/frontend/Program.cs index b699c4d9..247ab2b2 100644 --- a/samples/multi-project/frontend/Program.cs +++ b/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(); - }); - } -} +// 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(); + }); + } +} diff --git a/samples/multi-project/frontend/Properties/launchSettings.json b/test/E2ETest/testassets/projects/multi-project/frontend/Properties/launchSettings.json similarity index 96% rename from samples/multi-project/frontend/Properties/launchSettings.json rename to test/E2ETest/testassets/projects/multi-project/frontend/Properties/launchSettings.json index 4df30a2d..560754b2 100644 --- a/samples/multi-project/frontend/Properties/launchSettings.json +++ b/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" + } + } + } +} diff --git a/samples/multi-project/frontend/Startup.cs b/test/E2ETest/testassets/projects/multi-project/frontend/Startup.cs similarity index 96% rename from samples/multi-project/frontend/Startup.cs rename to test/E2ETest/testassets/projects/multi-project/frontend/Startup.cs index f6f400bd..353be896 100644 --- a/samples/multi-project/frontend/Startup.cs +++ b/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(); - }); - } - - 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(); + }); + } + + public void Configure(IApplicationBuilder app, IWebHostEnvironment env) + { + if (env.IsDevelopment()) + { + app.UseDeveloperExceptionPage(); + } + + app.UseStaticFiles(); + + app.UseRouting(); + + app.UseAuthorization(); + + app.UseEndpoints(endpoints => + { + endpoints.MapRazorPages(); + }); + } + } +} diff --git a/test/E2ETest/testassets/projects/multi-project/frontend/appsettings.Development.json b/test/E2ETest/testassets/projects/multi-project/frontend/appsettings.Development.json new file mode 100644 index 00000000..8983e0fc --- /dev/null +++ b/test/E2ETest/testassets/projects/multi-project/frontend/appsettings.Development.json @@ -0,0 +1,9 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft": "Warning", + "Microsoft.Hosting.Lifetime": "Information" + } + } +} diff --git a/test/E2ETest/testassets/projects/multi-project/frontend/appsettings.json b/test/E2ETest/testassets/projects/multi-project/frontend/appsettings.json new file mode 100644 index 00000000..d9d9a9bf --- /dev/null +++ b/test/E2ETest/testassets/projects/multi-project/frontend/appsettings.json @@ -0,0 +1,10 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft": "Warning", + "Microsoft.Hosting.Lifetime": "Information" + } + }, + "AllowedHosts": "*" +} diff --git a/samples/multi-project/frontend/frontend.csproj b/test/E2ETest/testassets/projects/multi-project/frontend/frontend.csproj similarity index 96% rename from samples/multi-project/frontend/frontend.csproj rename to test/E2ETest/testassets/projects/multi-project/frontend/frontend.csproj index 106957d7..82e8a2c6 100644 --- a/samples/multi-project/frontend/frontend.csproj +++ b/test/E2ETest/testassets/projects/multi-project/frontend/frontend.csproj @@ -1,16 +1,16 @@ - - - - netcoreapp3.1 - - - - - - - - - - - - + + + + netcoreapp3.1 + + + + + + + + + + + + diff --git a/samples/multi-project/frontend/wwwroot/css/site.css b/test/E2ETest/testassets/projects/multi-project/frontend/wwwroot/css/site.css similarity index 100% rename from samples/multi-project/frontend/wwwroot/css/site.css rename to test/E2ETest/testassets/projects/multi-project/frontend/wwwroot/css/site.css diff --git a/samples/multi-project/frontend/wwwroot/favicon.ico b/test/E2ETest/testassets/projects/multi-project/frontend/wwwroot/favicon.ico similarity index 100% rename from samples/multi-project/frontend/wwwroot/favicon.ico rename to test/E2ETest/testassets/projects/multi-project/frontend/wwwroot/favicon.ico diff --git a/samples/multi-project/frontend/wwwroot/js/site.js b/test/E2ETest/testassets/projects/multi-project/frontend/wwwroot/js/site.js similarity index 100% rename from samples/multi-project/frontend/wwwroot/js/site.js rename to test/E2ETest/testassets/projects/multi-project/frontend/wwwroot/js/site.js diff --git a/samples/multi-project/frontend/wwwroot/lib/bootstrap/LICENSE b/test/E2ETest/testassets/projects/multi-project/frontend/wwwroot/lib/bootstrap/LICENSE similarity index 100% rename from samples/multi-project/frontend/wwwroot/lib/bootstrap/LICENSE rename to test/E2ETest/testassets/projects/multi-project/frontend/wwwroot/lib/bootstrap/LICENSE diff --git a/samples/multi-project/frontend/wwwroot/lib/bootstrap/dist/css/bootstrap-grid.css b/test/E2ETest/testassets/projects/multi-project/frontend/wwwroot/lib/bootstrap/dist/css/bootstrap-grid.css similarity index 100% rename from samples/multi-project/frontend/wwwroot/lib/bootstrap/dist/css/bootstrap-grid.css rename to test/E2ETest/testassets/projects/multi-project/frontend/wwwroot/lib/bootstrap/dist/css/bootstrap-grid.css diff --git a/samples/multi-project/frontend/wwwroot/lib/bootstrap/dist/css/bootstrap-grid.css.map b/test/E2ETest/testassets/projects/multi-project/frontend/wwwroot/lib/bootstrap/dist/css/bootstrap-grid.css.map similarity index 100% rename from samples/multi-project/frontend/wwwroot/lib/bootstrap/dist/css/bootstrap-grid.css.map rename to test/E2ETest/testassets/projects/multi-project/frontend/wwwroot/lib/bootstrap/dist/css/bootstrap-grid.css.map diff --git a/samples/multi-project/frontend/wwwroot/lib/bootstrap/dist/css/bootstrap-grid.min.css b/test/E2ETest/testassets/projects/multi-project/frontend/wwwroot/lib/bootstrap/dist/css/bootstrap-grid.min.css similarity index 100% rename from samples/multi-project/frontend/wwwroot/lib/bootstrap/dist/css/bootstrap-grid.min.css rename to test/E2ETest/testassets/projects/multi-project/frontend/wwwroot/lib/bootstrap/dist/css/bootstrap-grid.min.css diff --git a/samples/multi-project/frontend/wwwroot/lib/bootstrap/dist/css/bootstrap-grid.min.css.map b/test/E2ETest/testassets/projects/multi-project/frontend/wwwroot/lib/bootstrap/dist/css/bootstrap-grid.min.css.map similarity index 100% rename from samples/multi-project/frontend/wwwroot/lib/bootstrap/dist/css/bootstrap-grid.min.css.map rename to test/E2ETest/testassets/projects/multi-project/frontend/wwwroot/lib/bootstrap/dist/css/bootstrap-grid.min.css.map diff --git a/samples/multi-project/frontend/wwwroot/lib/bootstrap/dist/css/bootstrap-reboot.css b/test/E2ETest/testassets/projects/multi-project/frontend/wwwroot/lib/bootstrap/dist/css/bootstrap-reboot.css similarity index 100% rename from samples/multi-project/frontend/wwwroot/lib/bootstrap/dist/css/bootstrap-reboot.css rename to test/E2ETest/testassets/projects/multi-project/frontend/wwwroot/lib/bootstrap/dist/css/bootstrap-reboot.css diff --git a/samples/multi-project/frontend/wwwroot/lib/bootstrap/dist/css/bootstrap-reboot.css.map b/test/E2ETest/testassets/projects/multi-project/frontend/wwwroot/lib/bootstrap/dist/css/bootstrap-reboot.css.map similarity index 100% rename from samples/multi-project/frontend/wwwroot/lib/bootstrap/dist/css/bootstrap-reboot.css.map rename to test/E2ETest/testassets/projects/multi-project/frontend/wwwroot/lib/bootstrap/dist/css/bootstrap-reboot.css.map diff --git a/samples/multi-project/frontend/wwwroot/lib/bootstrap/dist/css/bootstrap-reboot.min.css b/test/E2ETest/testassets/projects/multi-project/frontend/wwwroot/lib/bootstrap/dist/css/bootstrap-reboot.min.css similarity index 100% rename from samples/multi-project/frontend/wwwroot/lib/bootstrap/dist/css/bootstrap-reboot.min.css rename to test/E2ETest/testassets/projects/multi-project/frontend/wwwroot/lib/bootstrap/dist/css/bootstrap-reboot.min.css diff --git a/samples/multi-project/frontend/wwwroot/lib/bootstrap/dist/css/bootstrap-reboot.min.css.map b/test/E2ETest/testassets/projects/multi-project/frontend/wwwroot/lib/bootstrap/dist/css/bootstrap-reboot.min.css.map similarity index 100% rename from samples/multi-project/frontend/wwwroot/lib/bootstrap/dist/css/bootstrap-reboot.min.css.map rename to test/E2ETest/testassets/projects/multi-project/frontend/wwwroot/lib/bootstrap/dist/css/bootstrap-reboot.min.css.map diff --git a/samples/multi-project/frontend/wwwroot/lib/bootstrap/dist/css/bootstrap.css b/test/E2ETest/testassets/projects/multi-project/frontend/wwwroot/lib/bootstrap/dist/css/bootstrap.css similarity index 100% rename from samples/multi-project/frontend/wwwroot/lib/bootstrap/dist/css/bootstrap.css rename to test/E2ETest/testassets/projects/multi-project/frontend/wwwroot/lib/bootstrap/dist/css/bootstrap.css diff --git a/samples/multi-project/frontend/wwwroot/lib/bootstrap/dist/css/bootstrap.css.map b/test/E2ETest/testassets/projects/multi-project/frontend/wwwroot/lib/bootstrap/dist/css/bootstrap.css.map similarity index 100% rename from samples/multi-project/frontend/wwwroot/lib/bootstrap/dist/css/bootstrap.css.map rename to test/E2ETest/testassets/projects/multi-project/frontend/wwwroot/lib/bootstrap/dist/css/bootstrap.css.map diff --git a/samples/multi-project/frontend/wwwroot/lib/bootstrap/dist/css/bootstrap.min.css b/test/E2ETest/testassets/projects/multi-project/frontend/wwwroot/lib/bootstrap/dist/css/bootstrap.min.css similarity index 100% rename from samples/multi-project/frontend/wwwroot/lib/bootstrap/dist/css/bootstrap.min.css rename to test/E2ETest/testassets/projects/multi-project/frontend/wwwroot/lib/bootstrap/dist/css/bootstrap.min.css diff --git a/samples/multi-project/frontend/wwwroot/lib/bootstrap/dist/css/bootstrap.min.css.map b/test/E2ETest/testassets/projects/multi-project/frontend/wwwroot/lib/bootstrap/dist/css/bootstrap.min.css.map similarity index 100% rename from samples/multi-project/frontend/wwwroot/lib/bootstrap/dist/css/bootstrap.min.css.map rename to test/E2ETest/testassets/projects/multi-project/frontend/wwwroot/lib/bootstrap/dist/css/bootstrap.min.css.map diff --git a/samples/multi-project/frontend/wwwroot/lib/bootstrap/dist/js/bootstrap.bundle.js b/test/E2ETest/testassets/projects/multi-project/frontend/wwwroot/lib/bootstrap/dist/js/bootstrap.bundle.js similarity index 100% rename from samples/multi-project/frontend/wwwroot/lib/bootstrap/dist/js/bootstrap.bundle.js rename to test/E2ETest/testassets/projects/multi-project/frontend/wwwroot/lib/bootstrap/dist/js/bootstrap.bundle.js diff --git a/samples/multi-project/frontend/wwwroot/lib/bootstrap/dist/js/bootstrap.bundle.js.map b/test/E2ETest/testassets/projects/multi-project/frontend/wwwroot/lib/bootstrap/dist/js/bootstrap.bundle.js.map similarity index 100% rename from samples/multi-project/frontend/wwwroot/lib/bootstrap/dist/js/bootstrap.bundle.js.map rename to test/E2ETest/testassets/projects/multi-project/frontend/wwwroot/lib/bootstrap/dist/js/bootstrap.bundle.js.map diff --git a/samples/multi-project/frontend/wwwroot/lib/bootstrap/dist/js/bootstrap.bundle.min.js b/test/E2ETest/testassets/projects/multi-project/frontend/wwwroot/lib/bootstrap/dist/js/bootstrap.bundle.min.js similarity index 100% rename from samples/multi-project/frontend/wwwroot/lib/bootstrap/dist/js/bootstrap.bundle.min.js rename to test/E2ETest/testassets/projects/multi-project/frontend/wwwroot/lib/bootstrap/dist/js/bootstrap.bundle.min.js diff --git a/samples/multi-project/frontend/wwwroot/lib/bootstrap/dist/js/bootstrap.bundle.min.js.map b/test/E2ETest/testassets/projects/multi-project/frontend/wwwroot/lib/bootstrap/dist/js/bootstrap.bundle.min.js.map similarity index 100% rename from samples/multi-project/frontend/wwwroot/lib/bootstrap/dist/js/bootstrap.bundle.min.js.map rename to test/E2ETest/testassets/projects/multi-project/frontend/wwwroot/lib/bootstrap/dist/js/bootstrap.bundle.min.js.map diff --git a/samples/multi-project/frontend/wwwroot/lib/bootstrap/dist/js/bootstrap.js b/test/E2ETest/testassets/projects/multi-project/frontend/wwwroot/lib/bootstrap/dist/js/bootstrap.js similarity index 100% rename from samples/multi-project/frontend/wwwroot/lib/bootstrap/dist/js/bootstrap.js rename to test/E2ETest/testassets/projects/multi-project/frontend/wwwroot/lib/bootstrap/dist/js/bootstrap.js diff --git a/samples/multi-project/frontend/wwwroot/lib/bootstrap/dist/js/bootstrap.js.map b/test/E2ETest/testassets/projects/multi-project/frontend/wwwroot/lib/bootstrap/dist/js/bootstrap.js.map similarity index 100% rename from samples/multi-project/frontend/wwwroot/lib/bootstrap/dist/js/bootstrap.js.map rename to test/E2ETest/testassets/projects/multi-project/frontend/wwwroot/lib/bootstrap/dist/js/bootstrap.js.map diff --git a/samples/multi-project/frontend/wwwroot/lib/bootstrap/dist/js/bootstrap.min.js b/test/E2ETest/testassets/projects/multi-project/frontend/wwwroot/lib/bootstrap/dist/js/bootstrap.min.js similarity index 100% rename from samples/multi-project/frontend/wwwroot/lib/bootstrap/dist/js/bootstrap.min.js rename to test/E2ETest/testassets/projects/multi-project/frontend/wwwroot/lib/bootstrap/dist/js/bootstrap.min.js diff --git a/samples/multi-project/frontend/wwwroot/lib/bootstrap/dist/js/bootstrap.min.js.map b/test/E2ETest/testassets/projects/multi-project/frontend/wwwroot/lib/bootstrap/dist/js/bootstrap.min.js.map similarity index 100% rename from samples/multi-project/frontend/wwwroot/lib/bootstrap/dist/js/bootstrap.min.js.map rename to test/E2ETest/testassets/projects/multi-project/frontend/wwwroot/lib/bootstrap/dist/js/bootstrap.min.js.map diff --git a/samples/multi-project/frontend/wwwroot/lib/jquery-validation-unobtrusive/LICENSE.txt b/test/E2ETest/testassets/projects/multi-project/frontend/wwwroot/lib/jquery-validation-unobtrusive/LICENSE.txt similarity index 100% rename from samples/multi-project/frontend/wwwroot/lib/jquery-validation-unobtrusive/LICENSE.txt rename to test/E2ETest/testassets/projects/multi-project/frontend/wwwroot/lib/jquery-validation-unobtrusive/LICENSE.txt diff --git a/samples/multi-project/frontend/wwwroot/lib/jquery-validation-unobtrusive/jquery.validate.unobtrusive.js b/test/E2ETest/testassets/projects/multi-project/frontend/wwwroot/lib/jquery-validation-unobtrusive/jquery.validate.unobtrusive.js similarity index 100% rename from samples/multi-project/frontend/wwwroot/lib/jquery-validation-unobtrusive/jquery.validate.unobtrusive.js rename to test/E2ETest/testassets/projects/multi-project/frontend/wwwroot/lib/jquery-validation-unobtrusive/jquery.validate.unobtrusive.js diff --git a/samples/multi-project/frontend/wwwroot/lib/jquery-validation-unobtrusive/jquery.validate.unobtrusive.min.js b/test/E2ETest/testassets/projects/multi-project/frontend/wwwroot/lib/jquery-validation-unobtrusive/jquery.validate.unobtrusive.min.js similarity index 100% rename from samples/multi-project/frontend/wwwroot/lib/jquery-validation-unobtrusive/jquery.validate.unobtrusive.min.js rename to test/E2ETest/testassets/projects/multi-project/frontend/wwwroot/lib/jquery-validation-unobtrusive/jquery.validate.unobtrusive.min.js diff --git a/samples/multi-project/frontend/wwwroot/lib/jquery-validation/LICENSE.md b/test/E2ETest/testassets/projects/multi-project/frontend/wwwroot/lib/jquery-validation/LICENSE.md similarity index 100% rename from samples/multi-project/frontend/wwwroot/lib/jquery-validation/LICENSE.md rename to test/E2ETest/testassets/projects/multi-project/frontend/wwwroot/lib/jquery-validation/LICENSE.md diff --git a/samples/multi-project/frontend/wwwroot/lib/jquery-validation/dist/additional-methods.js b/test/E2ETest/testassets/projects/multi-project/frontend/wwwroot/lib/jquery-validation/dist/additional-methods.js similarity index 100% rename from samples/multi-project/frontend/wwwroot/lib/jquery-validation/dist/additional-methods.js rename to test/E2ETest/testassets/projects/multi-project/frontend/wwwroot/lib/jquery-validation/dist/additional-methods.js diff --git a/samples/multi-project/frontend/wwwroot/lib/jquery-validation/dist/additional-methods.min.js b/test/E2ETest/testassets/projects/multi-project/frontend/wwwroot/lib/jquery-validation/dist/additional-methods.min.js similarity index 100% rename from samples/multi-project/frontend/wwwroot/lib/jquery-validation/dist/additional-methods.min.js rename to test/E2ETest/testassets/projects/multi-project/frontend/wwwroot/lib/jquery-validation/dist/additional-methods.min.js diff --git a/samples/multi-project/frontend/wwwroot/lib/jquery-validation/dist/jquery.validate.js b/test/E2ETest/testassets/projects/multi-project/frontend/wwwroot/lib/jquery-validation/dist/jquery.validate.js similarity index 100% rename from samples/multi-project/frontend/wwwroot/lib/jquery-validation/dist/jquery.validate.js rename to test/E2ETest/testassets/projects/multi-project/frontend/wwwroot/lib/jquery-validation/dist/jquery.validate.js diff --git a/samples/multi-project/frontend/wwwroot/lib/jquery-validation/dist/jquery.validate.min.js b/test/E2ETest/testassets/projects/multi-project/frontend/wwwroot/lib/jquery-validation/dist/jquery.validate.min.js similarity index 100% rename from samples/multi-project/frontend/wwwroot/lib/jquery-validation/dist/jquery.validate.min.js rename to test/E2ETest/testassets/projects/multi-project/frontend/wwwroot/lib/jquery-validation/dist/jquery.validate.min.js diff --git a/samples/multi-project/frontend/wwwroot/lib/jquery/LICENSE.txt b/test/E2ETest/testassets/projects/multi-project/frontend/wwwroot/lib/jquery/LICENSE.txt similarity index 100% rename from samples/multi-project/frontend/wwwroot/lib/jquery/LICENSE.txt rename to test/E2ETest/testassets/projects/multi-project/frontend/wwwroot/lib/jquery/LICENSE.txt diff --git a/samples/multi-project/frontend/wwwroot/lib/jquery/dist/jquery.js b/test/E2ETest/testassets/projects/multi-project/frontend/wwwroot/lib/jquery/dist/jquery.js similarity index 100% rename from samples/multi-project/frontend/wwwroot/lib/jquery/dist/jquery.js rename to test/E2ETest/testassets/projects/multi-project/frontend/wwwroot/lib/jquery/dist/jquery.js diff --git a/samples/multi-project/frontend/wwwroot/lib/jquery/dist/jquery.min.js b/test/E2ETest/testassets/projects/multi-project/frontend/wwwroot/lib/jquery/dist/jquery.min.js similarity index 100% rename from samples/multi-project/frontend/wwwroot/lib/jquery/dist/jquery.min.js rename to test/E2ETest/testassets/projects/multi-project/frontend/wwwroot/lib/jquery/dist/jquery.min.js diff --git a/samples/multi-project/frontend/wwwroot/lib/jquery/dist/jquery.min.map b/test/E2ETest/testassets/projects/multi-project/frontend/wwwroot/lib/jquery/dist/jquery.min.map similarity index 100% rename from samples/multi-project/frontend/wwwroot/lib/jquery/dist/jquery.min.map rename to test/E2ETest/testassets/projects/multi-project/frontend/wwwroot/lib/jquery/dist/jquery.min.map diff --git a/samples/multi-project/multi-project.sln b/test/E2ETest/testassets/projects/multi-project/multi-project.sln similarity index 98% rename from samples/multi-project/multi-project.sln rename to test/E2ETest/testassets/projects/multi-project/multi-project.sln index 3dc1354d..bb932662 100644 --- a/samples/multi-project/multi-project.sln +++ b/test/E2ETest/testassets/projects/multi-project/multi-project.sln @@ -1,62 +1,62 @@ - -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", "{CA427ACE-098F-4883-8A91-02F766FC2D46}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "frontend", "frontend\frontend.csproj", "{1CC48AD0-4845-4DBC-8308-F7D333E85436}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "worker", "worker\worker.csproj", "{D96428FD-1ADB-436F-B61B-04C632FBCD34}" -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 - {CA427ACE-098F-4883-8A91-02F766FC2D46}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {CA427ACE-098F-4883-8A91-02F766FC2D46}.Debug|Any CPU.Build.0 = Debug|Any CPU - {CA427ACE-098F-4883-8A91-02F766FC2D46}.Debug|x64.ActiveCfg = Debug|Any CPU - {CA427ACE-098F-4883-8A91-02F766FC2D46}.Debug|x64.Build.0 = Debug|Any CPU - {CA427ACE-098F-4883-8A91-02F766FC2D46}.Debug|x86.ActiveCfg = Debug|Any CPU - {CA427ACE-098F-4883-8A91-02F766FC2D46}.Debug|x86.Build.0 = Debug|Any CPU - {CA427ACE-098F-4883-8A91-02F766FC2D46}.Release|Any CPU.ActiveCfg = Release|Any CPU - {CA427ACE-098F-4883-8A91-02F766FC2D46}.Release|Any CPU.Build.0 = Release|Any CPU - {CA427ACE-098F-4883-8A91-02F766FC2D46}.Release|x64.ActiveCfg = Release|Any CPU - {CA427ACE-098F-4883-8A91-02F766FC2D46}.Release|x64.Build.0 = Release|Any CPU - {CA427ACE-098F-4883-8A91-02F766FC2D46}.Release|x86.ActiveCfg = Release|Any CPU - {CA427ACE-098F-4883-8A91-02F766FC2D46}.Release|x86.Build.0 = Release|Any CPU - {1CC48AD0-4845-4DBC-8308-F7D333E85436}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {1CC48AD0-4845-4DBC-8308-F7D333E85436}.Debug|Any CPU.Build.0 = Debug|Any CPU - {1CC48AD0-4845-4DBC-8308-F7D333E85436}.Debug|x64.ActiveCfg = Debug|Any CPU - {1CC48AD0-4845-4DBC-8308-F7D333E85436}.Debug|x64.Build.0 = Debug|Any CPU - {1CC48AD0-4845-4DBC-8308-F7D333E85436}.Debug|x86.ActiveCfg = Debug|Any CPU - {1CC48AD0-4845-4DBC-8308-F7D333E85436}.Debug|x86.Build.0 = Debug|Any CPU - {1CC48AD0-4845-4DBC-8308-F7D333E85436}.Release|Any CPU.ActiveCfg = Release|Any CPU - {1CC48AD0-4845-4DBC-8308-F7D333E85436}.Release|Any CPU.Build.0 = Release|Any CPU - {1CC48AD0-4845-4DBC-8308-F7D333E85436}.Release|x64.ActiveCfg = Release|Any CPU - {1CC48AD0-4845-4DBC-8308-F7D333E85436}.Release|x64.Build.0 = Release|Any CPU - {1CC48AD0-4845-4DBC-8308-F7D333E85436}.Release|x86.ActiveCfg = Release|Any CPU - {1CC48AD0-4845-4DBC-8308-F7D333E85436}.Release|x86.Build.0 = Release|Any CPU - {D96428FD-1ADB-436F-B61B-04C632FBCD34}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {D96428FD-1ADB-436F-B61B-04C632FBCD34}.Debug|Any CPU.Build.0 = Debug|Any CPU - {D96428FD-1ADB-436F-B61B-04C632FBCD34}.Debug|x64.ActiveCfg = Debug|Any CPU - {D96428FD-1ADB-436F-B61B-04C632FBCD34}.Debug|x64.Build.0 = Debug|Any CPU - {D96428FD-1ADB-436F-B61B-04C632FBCD34}.Debug|x86.ActiveCfg = Debug|Any CPU - {D96428FD-1ADB-436F-B61B-04C632FBCD34}.Debug|x86.Build.0 = Debug|Any CPU - {D96428FD-1ADB-436F-B61B-04C632FBCD34}.Release|Any CPU.ActiveCfg = Release|Any CPU - {D96428FD-1ADB-436F-B61B-04C632FBCD34}.Release|Any CPU.Build.0 = Release|Any CPU - {D96428FD-1ADB-436F-B61B-04C632FBCD34}.Release|x64.ActiveCfg = Release|Any CPU - {D96428FD-1ADB-436F-B61B-04C632FBCD34}.Release|x64.Build.0 = Release|Any CPU - {D96428FD-1ADB-436F-B61B-04C632FBCD34}.Release|x86.ActiveCfg = Release|Any CPU - {D96428FD-1ADB-436F-B61B-04C632FBCD34}.Release|x86.Build.0 = Release|Any CPU - EndGlobalSection -EndGlobal + +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", "{CA427ACE-098F-4883-8A91-02F766FC2D46}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "frontend", "frontend\frontend.csproj", "{1CC48AD0-4845-4DBC-8308-F7D333E85436}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "worker", "worker\worker.csproj", "{D96428FD-1ADB-436F-B61B-04C632FBCD34}" +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 + {CA427ACE-098F-4883-8A91-02F766FC2D46}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {CA427ACE-098F-4883-8A91-02F766FC2D46}.Debug|Any CPU.Build.0 = Debug|Any CPU + {CA427ACE-098F-4883-8A91-02F766FC2D46}.Debug|x64.ActiveCfg = Debug|Any CPU + {CA427ACE-098F-4883-8A91-02F766FC2D46}.Debug|x64.Build.0 = Debug|Any CPU + {CA427ACE-098F-4883-8A91-02F766FC2D46}.Debug|x86.ActiveCfg = Debug|Any CPU + {CA427ACE-098F-4883-8A91-02F766FC2D46}.Debug|x86.Build.0 = Debug|Any CPU + {CA427ACE-098F-4883-8A91-02F766FC2D46}.Release|Any CPU.ActiveCfg = Release|Any CPU + {CA427ACE-098F-4883-8A91-02F766FC2D46}.Release|Any CPU.Build.0 = Release|Any CPU + {CA427ACE-098F-4883-8A91-02F766FC2D46}.Release|x64.ActiveCfg = Release|Any CPU + {CA427ACE-098F-4883-8A91-02F766FC2D46}.Release|x64.Build.0 = Release|Any CPU + {CA427ACE-098F-4883-8A91-02F766FC2D46}.Release|x86.ActiveCfg = Release|Any CPU + {CA427ACE-098F-4883-8A91-02F766FC2D46}.Release|x86.Build.0 = Release|Any CPU + {1CC48AD0-4845-4DBC-8308-F7D333E85436}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {1CC48AD0-4845-4DBC-8308-F7D333E85436}.Debug|Any CPU.Build.0 = Debug|Any CPU + {1CC48AD0-4845-4DBC-8308-F7D333E85436}.Debug|x64.ActiveCfg = Debug|Any CPU + {1CC48AD0-4845-4DBC-8308-F7D333E85436}.Debug|x64.Build.0 = Debug|Any CPU + {1CC48AD0-4845-4DBC-8308-F7D333E85436}.Debug|x86.ActiveCfg = Debug|Any CPU + {1CC48AD0-4845-4DBC-8308-F7D333E85436}.Debug|x86.Build.0 = Debug|Any CPU + {1CC48AD0-4845-4DBC-8308-F7D333E85436}.Release|Any CPU.ActiveCfg = Release|Any CPU + {1CC48AD0-4845-4DBC-8308-F7D333E85436}.Release|Any CPU.Build.0 = Release|Any CPU + {1CC48AD0-4845-4DBC-8308-F7D333E85436}.Release|x64.ActiveCfg = Release|Any CPU + {1CC48AD0-4845-4DBC-8308-F7D333E85436}.Release|x64.Build.0 = Release|Any CPU + {1CC48AD0-4845-4DBC-8308-F7D333E85436}.Release|x86.ActiveCfg = Release|Any CPU + {1CC48AD0-4845-4DBC-8308-F7D333E85436}.Release|x86.Build.0 = Release|Any CPU + {D96428FD-1ADB-436F-B61B-04C632FBCD34}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D96428FD-1ADB-436F-B61B-04C632FBCD34}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D96428FD-1ADB-436F-B61B-04C632FBCD34}.Debug|x64.ActiveCfg = Debug|Any CPU + {D96428FD-1ADB-436F-B61B-04C632FBCD34}.Debug|x64.Build.0 = Debug|Any CPU + {D96428FD-1ADB-436F-B61B-04C632FBCD34}.Debug|x86.ActiveCfg = Debug|Any CPU + {D96428FD-1ADB-436F-B61B-04C632FBCD34}.Debug|x86.Build.0 = Debug|Any CPU + {D96428FD-1ADB-436F-B61B-04C632FBCD34}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D96428FD-1ADB-436F-B61B-04C632FBCD34}.Release|Any CPU.Build.0 = Release|Any CPU + {D96428FD-1ADB-436F-B61B-04C632FBCD34}.Release|x64.ActiveCfg = Release|Any CPU + {D96428FD-1ADB-436F-B61B-04C632FBCD34}.Release|x64.Build.0 = Release|Any CPU + {D96428FD-1ADB-436F-B61B-04C632FBCD34}.Release|x86.ActiveCfg = Release|Any CPU + {D96428FD-1ADB-436F-B61B-04C632FBCD34}.Release|x86.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/samples/multi-project/tye.yaml b/test/E2ETest/testassets/projects/multi-project/tye.yaml similarity index 87% rename from samples/multi-project/tye.yaml rename to test/E2ETest/testassets/projects/multi-project/tye.yaml index 1a226d89..fd56f555 100644 --- a/samples/multi-project/tye.yaml +++ b/test/E2ETest/testassets/projects/multi-project/tye.yaml @@ -1,4 +1,4 @@ -# tye application configuration file +# tye application configuration file # read all about it at https://github.com/dotnet/tye name: multi-project services: @@ -17,4 +17,4 @@ services: image: rabbitmq:3-management bindings: - protocol: amqp - port: 5672 + port: 5672 \ No newline at end of file diff --git a/samples/multi-project/worker/Program.cs b/test/E2ETest/testassets/projects/multi-project/worker/Program.cs similarity index 96% rename from samples/multi-project/worker/Program.cs rename to test/E2ETest/testassets/projects/multi-project/worker/Program.cs index 3520b936..0bbc724e 100644 --- a/samples/multi-project/worker/Program.cs +++ b/test/E2ETest/testassets/projects/multi-project/worker/Program.cs @@ -1,28 +1,28 @@ -// 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.IO; -using Microsoft.Extensions.Configuration; -using Microsoft.Extensions.Configuration.KeyPerFile; -using Microsoft.Extensions.DependencyInjection; -using Microsoft.Extensions.Hosting; - -namespace Worker -{ - public class Program - { - public static void Main(string[] args) - { - CreateHostBuilder(args).Build().Run(); - } - - public static IHostBuilder CreateHostBuilder(string[] args) => - Host.CreateDefaultBuilder(args) - .ConfigureServices((hostContext, services) => - { - services.AddHostedService(); - }); - } -} +// 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.IO; +using Microsoft.Extensions.Configuration; +using Microsoft.Extensions.Configuration.KeyPerFile; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Hosting; + +namespace Worker +{ + public class Program + { + public static void Main(string[] args) + { + CreateHostBuilder(args).Build().Run(); + } + + public static IHostBuilder CreateHostBuilder(string[] args) => + Host.CreateDefaultBuilder(args) + .ConfigureServices((hostContext, services) => + { + services.AddHostedService(); + }); + } +} diff --git a/samples/multi-project/worker/Properties/launchSettings.json b/test/E2ETest/testassets/projects/multi-project/worker/Properties/launchSettings.json similarity index 94% rename from samples/multi-project/worker/Properties/launchSettings.json rename to test/E2ETest/testassets/projects/multi-project/worker/Properties/launchSettings.json index 41696634..8525969a 100644 --- a/samples/multi-project/worker/Properties/launchSettings.json +++ b/test/E2ETest/testassets/projects/multi-project/worker/Properties/launchSettings.json @@ -1,10 +1,10 @@ -{ - "profiles": { - "worker": { - "commandName": "Project", - "environmentVariables": { - "DOTNET_ENVIRONMENT": "Development" - } - } - } -} +{ + "profiles": { + "worker": { + "commandName": "Project", + "environmentVariables": { + "DOTNET_ENVIRONMENT": "Development" + } + } + } +} diff --git a/samples/multi-project/worker/QueueWorker.cs b/test/E2ETest/testassets/projects/multi-project/worker/QueueWorker.cs similarity index 100% rename from samples/multi-project/worker/QueueWorker.cs rename to test/E2ETest/testassets/projects/multi-project/worker/QueueWorker.cs diff --git a/test/E2ETest/testassets/projects/multi-project/worker/appsettings.Development.json b/test/E2ETest/testassets/projects/multi-project/worker/appsettings.Development.json new file mode 100644 index 00000000..8983e0fc --- /dev/null +++ b/test/E2ETest/testassets/projects/multi-project/worker/appsettings.Development.json @@ -0,0 +1,9 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft": "Warning", + "Microsoft.Hosting.Lifetime": "Information" + } + } +} diff --git a/test/E2ETest/testassets/projects/multi-project/worker/appsettings.json b/test/E2ETest/testassets/projects/multi-project/worker/appsettings.json new file mode 100644 index 00000000..8983e0fc --- /dev/null +++ b/test/E2ETest/testassets/projects/multi-project/worker/appsettings.json @@ -0,0 +1,9 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft": "Warning", + "Microsoft.Hosting.Lifetime": "Information" + } + } +} diff --git a/samples/multi-project/worker/worker.csproj b/test/E2ETest/testassets/projects/multi-project/worker/worker.csproj similarity index 97% rename from samples/multi-project/worker/worker.csproj rename to test/E2ETest/testassets/projects/multi-project/worker/worker.csproj index b30b0e7a..bc8e4615 100644 --- a/samples/multi-project/worker/worker.csproj +++ b/test/E2ETest/testassets/projects/multi-project/worker/worker.csproj @@ -1,17 +1,17 @@ - - - - netcoreapp3.1 - dotnet-worker-E4419EA1-F496-4FE1-A024-7E75E40B9E10 - Worker - - - - - - - - - - - + + + + netcoreapp3.1 + dotnet-worker-E4419EA1-F496-4FE1-A024-7E75E40B9E10 + Worker + + + + + + + + + + + diff --git a/test/E2ETest/testassets/projects/nginx-ingress/ApplicationA/ApplicationA.csproj b/test/E2ETest/testassets/projects/nginx-ingress/ApplicationA/ApplicationA.csproj new file mode 100644 index 00000000..92605c5a --- /dev/null +++ b/test/E2ETest/testassets/projects/nginx-ingress/ApplicationA/ApplicationA.csproj @@ -0,0 +1,7 @@ + + + + netcoreapp3.1 + + + diff --git a/test/E2ETest/testassets/projects/nginx-ingress/ApplicationA/Program.cs b/test/E2ETest/testassets/projects/nginx-ingress/ApplicationA/Program.cs new file mode 100644 index 00000000..56492c75 --- /dev/null +++ b/test/E2ETest/testassets/projects/nginx-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(); + }); + } +} diff --git a/test/E2ETest/testassets/projects/nginx-ingress/ApplicationA/Properties/launchSettings.json b/test/E2ETest/testassets/projects/nginx-ingress/ApplicationA/Properties/launchSettings.json new file mode 100644 index 00000000..767a1d0b --- /dev/null +++ b/test/E2ETest/testassets/projects/nginx-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" + } + } + } +} diff --git a/test/E2ETest/testassets/projects/nginx-ingress/ApplicationA/Startup.cs b/test/E2ETest/testassets/projects/nginx-ingress/ApplicationA/Startup.cs new file mode 100644 index 00000000..257fd799 --- /dev/null +++ b/test/E2ETest/testassets/projects/nginx-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")); + }); + }); + } + } +} diff --git a/test/E2ETest/testassets/projects/nginx-ingress/ApplicationA/appsettings.Development.json b/test/E2ETest/testassets/projects/nginx-ingress/ApplicationA/appsettings.Development.json new file mode 100644 index 00000000..8983e0fc --- /dev/null +++ b/test/E2ETest/testassets/projects/nginx-ingress/ApplicationA/appsettings.Development.json @@ -0,0 +1,9 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft": "Warning", + "Microsoft.Hosting.Lifetime": "Information" + } + } +} diff --git a/test/E2ETest/testassets/projects/nginx-ingress/ApplicationA/appsettings.json b/test/E2ETest/testassets/projects/nginx-ingress/ApplicationA/appsettings.json new file mode 100644 index 00000000..d9d9a9bf --- /dev/null +++ b/test/E2ETest/testassets/projects/nginx-ingress/ApplicationA/appsettings.json @@ -0,0 +1,10 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft": "Warning", + "Microsoft.Hosting.Lifetime": "Information" + } + }, + "AllowedHosts": "*" +} diff --git a/test/E2ETest/testassets/projects/nginx-ingress/ApplicationB/ApplicationB.csproj b/test/E2ETest/testassets/projects/nginx-ingress/ApplicationB/ApplicationB.csproj new file mode 100644 index 00000000..92605c5a --- /dev/null +++ b/test/E2ETest/testassets/projects/nginx-ingress/ApplicationB/ApplicationB.csproj @@ -0,0 +1,7 @@ + + + + netcoreapp3.1 + + + diff --git a/test/E2ETest/testassets/projects/nginx-ingress/ApplicationB/Program.cs b/test/E2ETest/testassets/projects/nginx-ingress/ApplicationB/Program.cs new file mode 100644 index 00000000..8b3c38af --- /dev/null +++ b/test/E2ETest/testassets/projects/nginx-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(); + }); + } +} diff --git a/test/E2ETest/testassets/projects/nginx-ingress/ApplicationB/Properties/launchSettings.json b/test/E2ETest/testassets/projects/nginx-ingress/ApplicationB/Properties/launchSettings.json new file mode 100644 index 00000000..2b1eba0f --- /dev/null +++ b/test/E2ETest/testassets/projects/nginx-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" + } + } + } +} diff --git a/test/E2ETest/testassets/projects/nginx-ingress/ApplicationB/Startup.cs b/test/E2ETest/testassets/projects/nginx-ingress/ApplicationB/Startup.cs new file mode 100644 index 00000000..1a6b68d8 --- /dev/null +++ b/test/E2ETest/testassets/projects/nginx-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")); + }); + }); + } + } +} diff --git a/test/E2ETest/testassets/projects/nginx-ingress/ApplicationB/appsettings.Development.json b/test/E2ETest/testassets/projects/nginx-ingress/ApplicationB/appsettings.Development.json new file mode 100644 index 00000000..8983e0fc --- /dev/null +++ b/test/E2ETest/testassets/projects/nginx-ingress/ApplicationB/appsettings.Development.json @@ -0,0 +1,9 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft": "Warning", + "Microsoft.Hosting.Lifetime": "Information" + } + } +} diff --git a/test/E2ETest/testassets/projects/nginx-ingress/ApplicationB/appsettings.json b/test/E2ETest/testassets/projects/nginx-ingress/ApplicationB/appsettings.json new file mode 100644 index 00000000..d9d9a9bf --- /dev/null +++ b/test/E2ETest/testassets/projects/nginx-ingress/ApplicationB/appsettings.json @@ -0,0 +1,10 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft": "Warning", + "Microsoft.Hosting.Lifetime": "Information" + } + }, + "AllowedHosts": "*" +} diff --git a/test/E2ETest/testassets/projects/nginx-ingress/nginx-with-ingress.sln b/test/E2ETest/testassets/projects/nginx-ingress/nginx-with-ingress.sln new file mode 100644 index 00000000..3dcc942e --- /dev/null +++ b/test/E2ETest/testassets/projects/nginx-ingress/nginx-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 diff --git a/test/E2ETest/testassets/projects/nginx-ingress/nginx.conf b/test/E2ETest/testassets/projects/nginx-ingress/nginx.conf new file mode 100644 index 00000000..35f8f2e0 --- /dev/null +++ b/test/E2ETest/testassets/projects/nginx-ingress/nginx.conf @@ -0,0 +1,25 @@ +server { + listen 80; + + location /A { + proxy_pass http://appA/; + proxy_http_version 1.1; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection keep-alive; + proxy_set_header Host $host; + proxy_cache_bypass $http_upgrade; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + } + + location /B { + proxy_pass http://appB/; + proxy_http_version 1.1; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection keep-alive; + proxy_set_header Host $host; + proxy_cache_bypass $http_upgrade; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + } +} \ No newline at end of file diff --git a/test/E2ETest/testassets/projects/nginx-ingress/tye.yaml b/test/E2ETest/testassets/projects/nginx-ingress/tye.yaml new file mode 100644 index 00000000..eea27558 --- /dev/null +++ b/test/E2ETest/testassets/projects/nginx-ingress/tye.yaml @@ -0,0 +1,14 @@ +services: +- name: nginx + image: nginx + bindings: + - protocol: http + volumes: + - source: nginx.conf + target: /etc/nginx/conf.d/default.conf +- name: appA + project: ApplicationA/ApplicationA.csproj + replicas: 2 +- name: appB + project: ApplicationB/ApplicationB.csproj + replicas: 2 diff --git a/samples/single-project/single-project.sln b/test/E2ETest/testassets/projects/single-project/single-project.sln similarity index 98% rename from samples/single-project/single-project.sln rename to test/E2ETest/testassets/projects/single-project/single-project.sln index ca2cd174..b6c03cfb 100644 --- a/samples/single-project/single-project.sln +++ b/test/E2ETest/testassets/projects/single-project/single-project.sln @@ -1,34 +1,34 @@ - -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}") = "test-project", "test-project\test-project.csproj", "{7D3606B2-7B8E-4ABB-BE0A-E0B18285D8F5}" -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 - {7D3606B2-7B8E-4ABB-BE0A-E0B18285D8F5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {7D3606B2-7B8E-4ABB-BE0A-E0B18285D8F5}.Debug|Any CPU.Build.0 = Debug|Any CPU - {7D3606B2-7B8E-4ABB-BE0A-E0B18285D8F5}.Debug|x64.ActiveCfg = Debug|Any CPU - {7D3606B2-7B8E-4ABB-BE0A-E0B18285D8F5}.Debug|x64.Build.0 = Debug|Any CPU - {7D3606B2-7B8E-4ABB-BE0A-E0B18285D8F5}.Debug|x86.ActiveCfg = Debug|Any CPU - {7D3606B2-7B8E-4ABB-BE0A-E0B18285D8F5}.Debug|x86.Build.0 = Debug|Any CPU - {7D3606B2-7B8E-4ABB-BE0A-E0B18285D8F5}.Release|Any CPU.ActiveCfg = Release|Any CPU - {7D3606B2-7B8E-4ABB-BE0A-E0B18285D8F5}.Release|Any CPU.Build.0 = Release|Any CPU - {7D3606B2-7B8E-4ABB-BE0A-E0B18285D8F5}.Release|x64.ActiveCfg = Release|Any CPU - {7D3606B2-7B8E-4ABB-BE0A-E0B18285D8F5}.Release|x64.Build.0 = Release|Any CPU - {7D3606B2-7B8E-4ABB-BE0A-E0B18285D8F5}.Release|x86.ActiveCfg = Release|Any CPU - {7D3606B2-7B8E-4ABB-BE0A-E0B18285D8F5}.Release|x86.Build.0 = Release|Any CPU - EndGlobalSection -EndGlobal + +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}") = "test-project", "test-project\test-project.csproj", "{7D3606B2-7B8E-4ABB-BE0A-E0B18285D8F5}" +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 + {7D3606B2-7B8E-4ABB-BE0A-E0B18285D8F5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {7D3606B2-7B8E-4ABB-BE0A-E0B18285D8F5}.Debug|Any CPU.Build.0 = Debug|Any CPU + {7D3606B2-7B8E-4ABB-BE0A-E0B18285D8F5}.Debug|x64.ActiveCfg = Debug|Any CPU + {7D3606B2-7B8E-4ABB-BE0A-E0B18285D8F5}.Debug|x64.Build.0 = Debug|Any CPU + {7D3606B2-7B8E-4ABB-BE0A-E0B18285D8F5}.Debug|x86.ActiveCfg = Debug|Any CPU + {7D3606B2-7B8E-4ABB-BE0A-E0B18285D8F5}.Debug|x86.Build.0 = Debug|Any CPU + {7D3606B2-7B8E-4ABB-BE0A-E0B18285D8F5}.Release|Any CPU.ActiveCfg = Release|Any CPU + {7D3606B2-7B8E-4ABB-BE0A-E0B18285D8F5}.Release|Any CPU.Build.0 = Release|Any CPU + {7D3606B2-7B8E-4ABB-BE0A-E0B18285D8F5}.Release|x64.ActiveCfg = Release|Any CPU + {7D3606B2-7B8E-4ABB-BE0A-E0B18285D8F5}.Release|x64.Build.0 = Release|Any CPU + {7D3606B2-7B8E-4ABB-BE0A-E0B18285D8F5}.Release|x86.ActiveCfg = Release|Any CPU + {7D3606B2-7B8E-4ABB-BE0A-E0B18285D8F5}.Release|x86.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/samples/single-project/test-project/Program.cs b/test/E2ETest/testassets/projects/single-project/test-project/Program.cs similarity index 96% rename from samples/single-project/test-project/Program.cs rename to test/E2ETest/testassets/projects/single-project/test-project/Program.cs index c34efbfb..3aefed92 100644 --- a/samples/single-project/test-project/Program.cs +++ b/test/E2ETest/testassets/projects/single-project/test-project/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.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 test_project -{ - 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(); - }); - } -} +// 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.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 test_project +{ + 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(); + }); + } +} diff --git a/samples/single-project/test-project/Properties/launchSettings.json b/test/E2ETest/testassets/projects/single-project/test-project/Properties/launchSettings.json similarity index 96% rename from samples/single-project/test-project/Properties/launchSettings.json rename to test/E2ETest/testassets/projects/single-project/test-project/Properties/launchSettings.json index 94b22801..990224ac 100644 --- a/samples/single-project/test-project/Properties/launchSettings.json +++ b/test/E2ETest/testassets/projects/single-project/test-project/Properties/launchSettings.json @@ -1,27 +1,27 @@ -{ - "iisSettings": { - "windowsAuthentication": false, - "anonymousAuthentication": true, - "iisExpress": { - "applicationUrl": "http://localhost:18482", - "sslPort": 44344 - } - }, - "profiles": { - "IIS Express": { - "commandName": "IISExpress", - "launchBrowser": true, - "environmentVariables": { - "ASPNETCORE_ENVIRONMENT": "Development" - } - }, - "test_project": { - "commandName": "Project", - "launchBrowser": true, - "applicationUrl": "https://localhost:5001;http://localhost:5000", - "environmentVariables": { - "ASPNETCORE_ENVIRONMENT": "Development" - } - } - } -} +{ + "iisSettings": { + "windowsAuthentication": false, + "anonymousAuthentication": true, + "iisExpress": { + "applicationUrl": "http://localhost:18482", + "sslPort": 44344 + } + }, + "profiles": { + "IIS Express": { + "commandName": "IISExpress", + "launchBrowser": true, + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + }, + "test_project": { + "commandName": "Project", + "launchBrowser": true, + "applicationUrl": "https://localhost:5001;http://localhost:5000", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + } + } +} diff --git a/samples/single-project/test-project/Startup.cs b/test/E2ETest/testassets/projects/single-project/test-project/Startup.cs similarity index 97% rename from samples/single-project/test-project/Startup.cs rename to test/E2ETest/testassets/projects/single-project/test-project/Startup.cs index 3a77590f..2a219714 100644 --- a/samples/single-project/test-project/Startup.cs +++ b/test/E2ETest/testassets/projects/single-project/test-project/Startup.cs @@ -1,44 +1,44 @@ -// 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.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 test_project -{ - 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 World!"); - }); - }); - } - } -} +// 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.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 test_project +{ + 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 World!"); + }); + }); + } + } +} diff --git a/test/E2ETest/testassets/projects/single-project/test-project/appsettings.Development.json b/test/E2ETest/testassets/projects/single-project/test-project/appsettings.Development.json new file mode 100644 index 00000000..8983e0fc --- /dev/null +++ b/test/E2ETest/testassets/projects/single-project/test-project/appsettings.Development.json @@ -0,0 +1,9 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft": "Warning", + "Microsoft.Hosting.Lifetime": "Information" + } + } +} diff --git a/test/E2ETest/testassets/projects/single-project/test-project/appsettings.json b/test/E2ETest/testassets/projects/single-project/test-project/appsettings.json new file mode 100644 index 00000000..d9d9a9bf --- /dev/null +++ b/test/E2ETest/testassets/projects/single-project/test-project/appsettings.json @@ -0,0 +1,10 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft": "Warning", + "Microsoft.Hosting.Lifetime": "Information" + } + }, + "AllowedHosts": "*" +} diff --git a/samples/single-project/test-project/test-project.csproj b/test/E2ETest/testassets/projects/single-project/test-project/test-project.csproj similarity index 95% rename from samples/single-project/test-project/test-project.csproj rename to test/E2ETest/testassets/projects/single-project/test-project/test-project.csproj index 2edaa9cb..86df20c0 100644 --- a/samples/single-project/test-project/test-project.csproj +++ b/test/E2ETest/testassets/projects/single-project/test-project/test-project.csproj @@ -1,8 +1,8 @@ - - - - netcoreapp3.1 - test_project - - - + + + + netcoreapp3.1 + test_project + + + diff --git a/samples/single-project/tye.yaml b/test/E2ETest/testassets/projects/single-project/tye.yaml similarity index 100% rename from samples/single-project/tye.yaml rename to test/E2ETest/testassets/projects/single-project/tye.yaml diff --git a/test/UnitTests/Microsoft.Tye.UnitTests.csproj b/test/UnitTests/Microsoft.Tye.UnitTests.csproj index de1c9b8e..5373dcc8 100644 --- a/test/UnitTests/Microsoft.Tye.UnitTests.csproj +++ b/test/UnitTests/Microsoft.Tye.UnitTests.csproj @@ -21,5 +21,6 @@ + diff --git a/test/UnitTests/TyeDeserializationTests.cs b/test/UnitTests/TyeDeserializationTests.cs index 93d43d34..996dda63 100644 --- a/test/UnitTests/TyeDeserializationTests.cs +++ b/test/UnitTests/TyeDeserializationTests.cs @@ -1,5 +1,6 @@ using System.IO; using System.Linq; +using E2ETest; using Microsoft.Tye.ConfigModel; using Tye; using Tye.Serialization; @@ -101,38 +102,11 @@ ingress: replicas: 2"; using var parser = new YamlParser(input); - var app = parser.ParseConfigApplication(); + var actual = parser.ParseConfigApplication(); var expected = _deserializer.Deserialize(new StringReader(input)); - foreach (var ingress in app.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); - } - } + TyeAssert.Equal(expected, actual); } [Fact] @@ -168,74 +142,11 @@ ingress: project: ApplicationB/ApplicationB.csproj replicas: 2"; using var parser = new YamlParser(input); - var app = parser.ParseConfigApplication(); + var actual = parser.ParseConfigApplication(); var expected = _deserializer.Deserialize(new StringReader(input)); - foreach (var service in app.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); - } - } + TyeAssert.Equal(expected, actual); } [Fact]