From 0f1d75db6f509938e3361c0b5b02e9b8e8e33d0c Mon Sep 17 00:00:00 2001 From: shreddedbacon Date: Sat, 12 Oct 2024 20:46:13 +1100 Subject: [PATCH] test: fix autogenroutes after modifying service label checks --- cmd/template_autogen_ingress_test.go | 32 +++++++++++++++++-- .../node.yaml | 2 +- 2 files changed, 31 insertions(+), 3 deletions(-) rename internal/testdata/node/autogen-templates/{ingress-11 => test-development-service-type-override}/node.yaml (96%) diff --git a/cmd/template_autogen_ingress_test.go b/cmd/template_autogen_ingress_test.go index f75bea5a..2f1e646e 100644 --- a/cmd/template_autogen_ingress_test.go +++ b/cmd/template_autogen_ingress_test.go @@ -213,7 +213,10 @@ func TestAutogeneratedIngressGeneration(t *testing.T) { want: "internal/testdata/node/autogen-templates/ingress-10", }, { - name: "test13 autogenerated route development service type override", + name: "test-development-service-type-override-a", + description: `this test should fail because the replacement type has no persistent label in the associated docker-compose file + realistically, this is not something that should be done on an already deployed service due to changing + service types not being properly supported`, args: testdata.GetSeedData( testdata.TestData{ ProjectName: "example-project", @@ -230,7 +233,32 @@ func TestAutogeneratedIngressGeneration(t *testing.T) { }, }, true), templatePath: "testoutput", - want: "internal/testdata/node/autogen-templates/ingress-11", + emptyDir: true, + want: "", + wantErr: true, + }, + { + name: "test-development-service-type-override-b", + description: `this test should pass because the replacement service type is just a basic type + realistically, this is not something that should be done on an already deployed service due to changing + service types not being properly supported`, + args: testdata.GetSeedData( + testdata.TestData{ + ProjectName: "example-project", + EnvironmentName: "main", + Branch: "main", + EnvironmentType: "development", + LagoonYAML: "internal/testdata/node/lagoon.yml", + ProjectVariables: []lagoon.EnvironmentVariable{ + { + Name: "LAGOON_SERVICE_TYPES", + Value: "node:basic", + Scope: "build", + }, + }, + }, true), + templatePath: "testoutput", + want: "internal/testdata/node/autogen-templates/test-development-service-type-override", }, { name: "test14 autogenerated route development no service type override", diff --git a/internal/testdata/node/autogen-templates/ingress-11/node.yaml b/internal/testdata/node/autogen-templates/test-development-service-type-override/node.yaml similarity index 96% rename from internal/testdata/node/autogen-templates/ingress-11/node.yaml rename to internal/testdata/node/autogen-templates/test-development-service-type-override/node.yaml index 2ed1318f..34cf6fe4 100644 --- a/internal/testdata/node/autogen-templates/ingress-11/node.yaml +++ b/internal/testdata/node/autogen-templates/test-development-service-type-override/node.yaml @@ -23,7 +23,7 @@ metadata: lagoon.sh/environmentType: development lagoon.sh/project: example-project lagoon.sh/service: node - lagoon.sh/service-type: node-persistent + lagoon.sh/service-type: basic lagoon.sh/template: autogenerated-ingress-0.1.0 name: node spec: