Skip to content

Commit

Permalink
test: add polysite cronjob tests (#404)
Browse files Browse the repository at this point in the history
  • Loading branch information
shreddedbacon authored Dec 22, 2024
1 parent e9f8dc4 commit 9b3412b
Show file tree
Hide file tree
Showing 2 changed files with 104 additions and 0 deletions.
76 changes: 76 additions & 0 deletions internal/lagoon/lagoon_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -441,6 +441,82 @@ func TestUnmarshalLagoonYAML(t *testing.T) {
},
},
},
{
name: "test-polysite with project environment cronjobs",
args: args{
file: "test-resources/lagoon-yaml/test9/lagoon.yml",
l: &YAML{},
project: "multiproject2",
},
want: &YAML{
DockerComposeYAML: "docker-compose.yml",
Environments: Environments{
"main": Environment{
Routes: []map[string][]Route{
{
"nginx": {
{
Name: "a.example.com",
},
},
},
},
Cronjobs: []Cronjob{
{
Name: "notdrush cron",
Command: "notdrush cron",
Service: "cli",
Schedule: "*/15 * * * *",
},
{
Name: "drush cron",
Command: "drush cron",
Service: "cli",
Schedule: "*/5 * * * *",
},
{
Name: "some other drush cron",
Command: "drush cron",
Service: "cli",
Schedule: "*/5 * * * *",
},
},
},
},
},
},
{
name: "test-polysite with project environment cronjobs no non-polysite",
args: args{
file: "test-resources/lagoon-yaml/test9/polysite-only-lagoon.yml",
l: &YAML{},
project: "multiproject2",
},
want: &YAML{
DockerComposeYAML: "docker-compose.yml",
Environments: Environments{
"main": Environment{
Routes: []map[string][]Route{
{
"nginx": {
{
Name: "a.example.com",
},
},
},
},
Cronjobs: []Cronjob{
{
Name: "notdrush cron",
Command: "notdrush cron",
Service: "cli",
Schedule: "*/15 * * * *",
},
},
},
},
},
},
{
name: "test-cronjobs-inpod-only",
args: args{
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
---
docker-compose-yaml: docker-compose.yml

project: content-example-com

multiproject1:
environments:
main:
cronjobs:
- name: drush cron
schedule: "*/15 * * * *"
command: 'drush cron'
service: cli
routes:
- nginx:
- a.example.com

multiproject2:
environments:
main:
cronjobs:
- name: notdrush cron
schedule: "*/15 * * * *"
command: 'notdrush cron'
service: cli
routes:
- nginx:
- a.example.com

0 comments on commit 9b3412b

Please sign in to comment.