Skip to content

Commit

Permalink
Update database backup max size from 1 GB to 10 GB (#3437)
Browse files Browse the repository at this point in the history
  • Loading branch information
AntoineAugusti authored Sep 1, 2023
1 parent a21aac6 commit 11d3a90
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions apps/transport/lib/jobs/database_backup_replication_job.ex
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ defmodule Transport.Jobs.DatabaseBackupReplicationJob do
{size, ""} = Integer.parse(size_str)

if size > max_size_threshold() do
raise "Latest database dump is larger than 1 gigabytes #{inspect(dump)}"
raise "Latest database dump is larger than 10 gigabytes #{inspect(dump)}"
end

dump
Expand All @@ -99,7 +99,7 @@ defmodule Transport.Jobs.DatabaseBackupReplicationJob do
dump
end

def max_size_threshold, do: gigabytes(1)
def max_size_threshold, do: gigabytes(10)
def recent_enough_threshold, do: hours_in_seconds(12)

defp upload_filename(%{key: key}) do
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ defmodule Transport.Test.Transport.Jobs.DatabaseBackupReplicationJobTest do
end

test "check_dump_not_too_large!" do
assert DatabaseBackupReplicationJob.max_size_threshold() == DatabaseBackupReplicationJob.gigabytes(1)
assert DatabaseBackupReplicationJob.max_size_threshold() == DatabaseBackupReplicationJob.gigabytes(10)
DatabaseBackupReplicationJob.check_dump_not_too_large!(%{size: "1"})

oversize = DatabaseBackupReplicationJob.gigabytes(5)
oversize = DatabaseBackupReplicationJob.gigabytes(11)
assert oversize > DatabaseBackupReplicationJob.max_size_threshold()

assert_raise RuntimeError, ~r'^Latest database dump is larger than 1 gigabytes', fn ->
assert_raise RuntimeError, ~r'^Latest database dump is larger than 10 gigabytes', fn ->
DatabaseBackupReplicationJob.check_dump_not_too_large!(%{size: oversize |> round() |> to_string()})
end
end
Expand Down

0 comments on commit 11d3a90

Please sign in to comment.