Skip to content

Commit

Permalink
test: add test for no autogenrated routes
Browse files Browse the repository at this point in the history
  • Loading branch information
shreddedbacon committed May 23, 2022
1 parent 57c1cce commit 26f3c5e
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 0 deletions.
22 changes: 22 additions & 0 deletions cmd/identify_ingress_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,28 @@ func TestIdentifyRoute(t *testing.T) {
},
wantJSON: `{"primary":"https://node-example-project-no-ingress.example.com","secondary":["https://node-example-project-no-ingress.example.com","https://www.node-example-project-no-ingress.example.com","https://en.node-example-project-no-ingress.example.com","https://de.node-example-project-no-ingress.example.com","https://fi.node-example-project-no-ingress.example.com"],"autogenerated":["https://node-example-project-no-ingress.example.com","https://www.node-example-project-no-ingress.example.com","https://en.node-example-project-no-ingress.example.com","https://de.node-example-project-no-ingress.example.com","https://fi.node-example-project-no-ingress.example.com"]}`,
},
{
name: "test12 no autogenerated routes",
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: `[]`,
secretPrefix: "fastly-api-",
lagoonYAML: "test-resources/template-ingress/single-lagoon-noautogen.yml",
templatePath: "test-resources/template-ingress/output",
},
want: "https://example.com",
wantRemain: []string{"https://example.com"},
wantautoGen: []string{},
wantJSON: `{"primary":"https://example.com","secondary":["https://example.com"],"autogenerated":[]}`,
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
Expand Down
14 changes: 14 additions & 0 deletions cmd/test-resources/template-ingress/single-lagoon-noautogen.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
docker-compose-yaml: test-resources/template-ingress/docker-compose.yml

routes:
autogenerate:
enabled: false

environment_variables:
git_sha: "true"

environments:
main:
routes:
- node:
- example.com

0 comments on commit 26f3c5e

Please sign in to comment.