From 63fdf16cb45ddb0ade14e273e8e8afabfb3c9edf Mon Sep 17 00:00:00 2001 From: Ben Jackson Date: Fri, 27 Oct 2023 10:15:28 +1100 Subject: [PATCH] chore: add test for autogenerated enabled, disabled by environment (#247) --- cmd/template_autogen_ingress_test.go | 19 ++++++++++++++++++ .../test25/docker-compose.yml | 20 +++++++++++++++++++ .../template-autogenerated/test25/lagoon.yml | 17 ++++++++++++++++ 3 files changed, 56 insertions(+) create mode 100644 test-resources/template-autogenerated/test25/docker-compose.yml create mode 100644 test-resources/template-autogenerated/test25/lagoon.yml diff --git a/cmd/template_autogen_ingress_test.go b/cmd/template_autogen_ingress_test.go index 1f0c550d..9d9ffab9 100644 --- a/cmd/template_autogen_ingress_test.go +++ b/cmd/template_autogen_ingress_test.go @@ -531,6 +531,25 @@ func TestAutogeneratedIngressGeneration(t *testing.T) { emptyDir: false, want: "../test-resources/template-autogenerated/test24-results", }, + { + name: "test25 autogenerated routes enabled globally but disabled by environment", + args: args{ + alertContact: "alertcontact", + statusPageID: "statuspageid", + projectName: "example-project", + environmentName: "main", + environmentType: "production", + buildType: "branch", + lagoonVersion: "v2.7.x", + branch: "main", + projectVars: `[{"name":"LAGOON_SYSTEM_ROUTER_PATTERN","value":"${service}-${project}-${environment}.example.com","scope":"internal_system"}]`, + envVars: `[]`, + lagoonYAML: "../test-resources/template-autogenerated/test25/lagoon.yml", + templatePath: "../test-resources/template-autogenerated/output", + }, + emptyDir: true, + want: "", + }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { diff --git a/test-resources/template-autogenerated/test25/docker-compose.yml b/test-resources/template-autogenerated/test25/docker-compose.yml new file mode 100644 index 00000000..85386270 --- /dev/null +++ b/test-resources/template-autogenerated/test25/docker-compose.yml @@ -0,0 +1,20 @@ +version: '2' +services: + node: + networks: + - amazeeio-network + - default + build: + context: . + dockerfile: node.dockerfile + labels: + lagoon.type: node + volumes: + - .:/app:delegated + environment: + - LAGOON_LOCALDEV_HTTP_PORT=3000 + - LAGOON_ROUTE=http://node.docker.amazee.io + +networks: + amazeeio-network: + external: true \ No newline at end of file diff --git a/test-resources/template-autogenerated/test25/lagoon.yml b/test-resources/template-autogenerated/test25/lagoon.yml new file mode 100644 index 00000000..f39f216d --- /dev/null +++ b/test-resources/template-autogenerated/test25/lagoon.yml @@ -0,0 +1,17 @@ +docker-compose-yaml: ../test-resources/template-autogenerated/test6/docker-compose.yml + +routes: + autogenerate: + enabled: true + insecure: Redirect + allowPullrequests: false + +environment_variables: + git_sha: "true" + +environments: + main: + autogenerateRoutes: false + routes: + - node: + - example.com