Skip to content

Commit

Permalink
add scalling spec to unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
aliotta committed Apr 25, 2024
1 parent 609d3c5 commit 5d69acf
Showing 1 changed file with 20 additions and 2 deletions.
22 changes: 20 additions & 2 deletions internal/provider/resources/resource_deployment_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,7 @@ resource "astro_deployment" "%v" {
%v
%v
%v
}
}
`,
input.Name, input.Name, utils.TestResourceDescription, input.Name, input.Name, input.Description, input.ClusterId, input.Executor, input.SchedulerAu, input.Name,
envVarsStr(input.IncludeEnvironmentVariables), wqStr, taskPodNodePoolIdStr)
Expand All @@ -468,6 +468,23 @@ func standardDeployment(input standardDeploymentInput) string {
if input.Executor == string(platform.DeploymentExecutorCELERY) {
wqStr = workerQueuesStr("")
}
var scalingSpecStr string

if input.IsDevelopmentMode == true {
scalingSpecStr = `scaling_spec = {
hibernation_spec = {
schedules = [{
hibernate_at_cron = "1 * * * *"
is_enabled = true
wake_at_cron = "59 * * * *"
}]
override = {
is_hibernating = true
override_until = "2025-04-25T12:58:00+05:30"
}
}
}`
}
return fmt.Sprintf(`
resource "astro_workspace" "%v_workspace" {
name = "%s"
Expand Down Expand Up @@ -495,10 +512,11 @@ resource "astro_deployment" "%v" {
workspace_id = astro_workspace.%v_workspace.id
%v
%v
%v
}
`,
input.Name, input.Name, utils.TestResourceDescription, input.Name, input.Name, input.Description, input.Region, input.CloudProvider, input.Executor, input.IsDevelopmentMode, input.SchedulerSize, input.Name,
envVarsStr(input.IncludeEnvironmentVariables), wqStr)
envVarsStr(input.IncludeEnvironmentVariables), wqStr, scalingSpecStr)
}

func standardDeploymentWithVariableName(input standardDeploymentInput) string {
Expand Down

0 comments on commit 5d69acf

Please sign in to comment.