@@ -432,6 +432,78 @@ func TestTemplateRoutes(t *testing.T) {
432432 templatePath : "testoutput" ,
433433 want : "internal/testdata/node/ingress-templates/ingress-24" ,
434434 },
435+ {
436+ name : "active-standby-api-routes" ,
437+ args : testdata .GetSeedData (
438+ testdata.TestData {
439+ ProjectName : "example-project" ,
440+ EnvironmentName : "prod-left" ,
441+ Branch : "prod-left" ,
442+ LagoonYAML : "internal/testdata/node/lagoon.yml" ,
443+ ProjectVariables : []lagoon.EnvironmentVariable {
444+ {
445+ Name : "LAGOON_API_ROUTES" ,
446+ Value : base64 .URLEncoding .EncodeToString ([]byte (`{"routes":[
447+ {"type":"ACTIVE", "domain":"active.example.com","service":"node","alternativeNames":[],"annotations":{},"pathRoutes":[],"tlsAcme":true,"insecure":"Redirect","hstsEnabled":false,"hstsIncludeSubdomains":false,"hstsPreload":false,"hstsMaxAge":3153600,"primary":false,"source":"API"},
448+ {"domain":"other.example.com","service":"node","alternativeNames":[],"annotations":{},"pathRoutes":[],"tlsAcme":true,"insecure":"Redirect","hstsEnabled":false,"hstsIncludeSubdomains":false,"hstsPreload":false,"hstsMaxAge":3153600,"primary":false,"source":"API"},
449+ {"domain":"test.example.com","service":"node","alternativeNames":[],"annotations":{},"pathRoutes":[],"tlsAcme":true,"insecure":"Redirect","hstsEnabled":false,"hstsIncludeSubdomains":false,"hstsPreload":false,"hstsMaxAge":3153600,"primary":true,"source":"API"}
450+ ]}` )),
451+ Scope : "internal_system" ,
452+ },
453+ },
454+ }, true ),
455+ templatePath : "testoutput" ,
456+ want : "internal/testdata/node/ingress-templates/active-standby-api-routes" ,
457+ },
458+ {
459+ name : "api-defined-routes-with-lagoon-yml" ,
460+ args : testdata .GetSeedData (
461+ testdata.TestData {
462+ ProjectName : "example-project" ,
463+ EnvironmentName : "main" ,
464+ Branch : "main" ,
465+ LagoonYAML : "internal/testdata/node/lagoon.yml" ,
466+ ProjectVariables : []lagoon.EnvironmentVariable {
467+ {
468+ Name : "LAGOON_API_ROUTES" ,
469+ Value : base64 .URLEncoding .EncodeToString ([]byte (`{"routes":[
470+ {"domain":"other.example.com","service":"node","alternativeNames":[],"annotations":{},"pathRoutes":[],"tlsAcme":true,"insecure":"Redirect","hstsEnabled":false,"hstsIncludeSubdomains":false,"hstsPreload":false,"hstsMaxAge":3153600,"primary":false,"source":"API"},
471+ {"domain":"test.example.com","service":"node","alternativeNames":[],"annotations":{},"pathRoutes":[],"tlsAcme":true,"insecure":"Redirect","hstsEnabled":false,"hstsIncludeSubdomains":false,"hstsPreload":false,"hstsMaxAge":3153600,"primary":true,"source":"API"}
472+ ]}` )),
473+ Scope : "internal_system" ,
474+ },
475+ },
476+ }, true ),
477+ templatePath : "testoutput" ,
478+ want : "internal/testdata/node/ingress-templates/api-defined-routes-with-lagoon-yml" ,
479+ },
480+ {
481+ name : "api-defined-routes-with-lagoon-yml-fastly" ,
482+ args : testdata .GetSeedData (
483+ testdata.TestData {
484+ ProjectName : "example-project" ,
485+ EnvironmentName : "main" ,
486+ Branch : "main" ,
487+ LagoonYAML : "internal/testdata/node/lagoon.yml" ,
488+ ProjectVariables : []lagoon.EnvironmentVariable {
489+ {
490+ Name : "LAGOON_FASTLY_SERVICE_ID" ,
491+ Value : "service-id:true" ,
492+ Scope : "build" ,
493+ },
494+ {
495+ Name : "LAGOON_API_ROUTES" ,
496+ Value : base64 .URLEncoding .EncodeToString ([]byte (`{"routes":[
497+ {"domain":"other.example.com","service":"node","alternativeNames":[],"annotations":{},"pathRoutes":[],"tlsAcme":true,"insecure":"Redirect","hstsEnabled":false,"hstsIncludeSubdomains":false,"hstsPreload":false,"hstsMaxAge":3153600,"primary":false,"source":"API"},
498+ {"domain":"test.example.com","service":"node","alternativeNames":[],"annotations":{},"pathRoutes":[],"tlsAcme":true,"insecure":"Redirect","hstsEnabled":false,"hstsIncludeSubdomains":false,"hstsPreload":false,"hstsMaxAge":3153600,"primary":true,"source":"API"}
499+ ]}` )),
500+ Scope : "internal_system" ,
501+ },
502+ },
503+ }, true ),
504+ templatePath : "testoutput" ,
505+ want : "internal/testdata/node/ingress-templates/api-defined-routes-with-lagoon-yml-fastly" ,
506+ },
435507 }
436508 for _ , tt := range tests {
437509 t .Run (tt .name , func (t * testing.T ) {
0 commit comments