summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--META.json1
-rw-r--r--cpanfile1
-rw-r--r--lib/App/BorgRestore/PathTimeTable/DB.pm6
3 files changed, 8 insertions, 0 deletions
diff --git a/META.json b/META.json
index 323c506..7abfe8a 100644
--- a/META.json
+++ b/META.json
@@ -43,6 +43,7 @@
},
"runtime" : {
"requires" : {
+ "Carp::Assert" : "0",
"DBD::SQLite" : "0",
"DBI" : "0",
"Date::Parse" : "0",
diff --git a/cpanfile b/cpanfile
index d5db169..3ed141b 100644
--- a/cpanfile
+++ b/cpanfile
@@ -1,3 +1,4 @@
+requires 'Carp::Assert';
requires 'DBD::SQLite';
requires 'DBI';
requires 'Date::Parse';
diff --git a/lib/App/BorgRestore/PathTimeTable/DB.pm b/lib/App/BorgRestore/PathTimeTable/DB.pm
index 069d991..685c7b9 100644
--- a/lib/App/BorgRestore/PathTimeTable/DB.pm
+++ b/lib/App/BorgRestore/PathTimeTable/DB.pm
@@ -1,6 +1,7 @@
package App::BorgRestore::PathTimeTable::DB;
use strictures 2;
+use Carp::Assert;
use Function::Parameters;
BEGIN {
use Log::Any qw($log);
@@ -130,6 +131,11 @@ method save_nodes() {
for my $key (keys %{$self->{stats}}) {
$log->debugf("Performance counter %s = %s", $key, $self->{stats}->{$key});
}
+
+ # +2 because:
+ # - borg list gives us `.` as the first path and we essentially skip it
+ # - we call `add_path` with `.` at the beginning of this method
+ assert($self->{stats}->{real_calls_to_db_class} + 2 == $self->{stats}->{total_paths}, "All files were actually added to the database");
}
1;