@@ -58,32 +58,80 @@ def test_date_matching(archivers, request):
5858
5959 shutil .rmtree (archiver .repository_path )
6060 cmd (archiver , "repo-create" , RK_ENCRYPTION )
61- earliest_ts = "2022-11-20T23:59:59"
62- ts_in_between = "2022-12-18T23:59:59"
63- create_src_archive (archiver , "archive1" , ts = earliest_ts )
64- create_src_archive (archiver , "archive2" , ts = ts_in_between )
65- create_src_archive (archiver , "archive3" )
61+ create_src_archive (archiver , "archive-2022-11-20" , ts = "2022-11-20T23:59:59" )
62+ create_src_archive (archiver , "archive-2022-12-18" , ts = "2022-12-18T23:59:59" )
63+ create_src_archive (archiver , "archive-now" )
6664 cmd (archiver , "check" , "-v" , "--archives-only" , "--oldest=23e" , exit_code = 2 )
6765
66+ output = cmd (archiver , "check" , "-v" , "--archives-only" , "--oldest=1y" , exit_code = 0 )
67+ assert "archive-2022-11-20" in output
68+ assert "archive-2022-12-18" in output
69+ assert "archive-now" not in output
70+
71+ output = cmd (archiver , "check" , "-v" , "--archives-only" , "--newest=1y" , exit_code = 0 )
72+ assert "archive-2022-11-20" not in output
73+ assert "archive-2022-12-18" not in output
74+ assert "archive-now" in output
75+
6876 output = cmd (archiver , "check" , "-v" , "--archives-only" , "--oldest=1m" , exit_code = 0 )
69- assert "archive1 " in output
70- assert "archive2 " in output
71- assert "archive3 " not in output
77+ assert "archive-2022-11-20 " in output
78+ assert "archive-2022-12-18 " in output
79+ assert "archive-now " not in output
7280
7381 output = cmd (archiver , "check" , "-v" , "--archives-only" , "--newest=1m" , exit_code = 0 )
74- assert "archive3" in output
75- assert "archive2" not in output
76- assert "archive1" not in output
82+ assert "archive-2022-11-20" not in output
83+ assert "archive-2022-12-18" not in output
84+ assert "archive-now" in output
85+
86+ output = cmd (archiver , "check" , "-v" , "--archives-only" , "--oldest=4w" , exit_code = 0 )
87+ assert "archive-2022-11-20" in output
88+ assert "archive-2022-12-18" in output
89+ assert "archive-now" not in output
90+
91+ output = cmd (archiver , "check" , "-v" , "--archives-only" , "--newest=4w" , exit_code = 0 )
92+ assert "archive-2022-11-20" not in output
93+ assert "archive-2022-12-18" not in output
94+ assert "archive-now" in output
7795
7896 output = cmd (archiver , "check" , "-v" , "--archives-only" , "--newer=1d" , exit_code = 0 )
79- assert "archive3" in output
80- assert "archive1 " not in output
81- assert "archive2" not in output
97+ assert "archive-2022-11-20" not in output
98+ assert "archive-2022-12-18 " not in output
99+ assert "archive-now" in output
82100
83101 output = cmd (archiver , "check" , "-v" , "--archives-only" , "--older=1d" , exit_code = 0 )
84- assert "archive1" in output
85- assert "archive2" in output
86- assert "archive3" not in output
102+ assert "archive-2022-11-20" in output
103+ assert "archive-2022-12-18" in output
104+ assert "archive-now" not in output
105+
106+ output = cmd (archiver , "check" , "-v" , "--archives-only" , "--newer=24H" , exit_code = 0 )
107+ assert "archive-2022-11-20" not in output
108+ assert "archive-2022-12-18" not in output
109+ assert "archive-now" in output
110+
111+ output = cmd (archiver , "check" , "-v" , "--archives-only" , "--older=24H" , exit_code = 0 )
112+ assert "archive-2022-11-20" in output
113+ assert "archive-2022-12-18" in output
114+ assert "archive-now" not in output
115+
116+ output = cmd (archiver , "check" , "-v" , "--archives-only" , "--newer=1440M" , exit_code = 0 )
117+ assert "archive-2022-11-20" not in output
118+ assert "archive-2022-12-18" not in output
119+ assert "archive-now" in output
120+
121+ output = cmd (archiver , "check" , "-v" , "--archives-only" , "--older=1440M" , exit_code = 0 )
122+ assert "archive-2022-11-20" in output
123+ assert "archive-2022-12-18" in output
124+ assert "archive-now" not in output
125+
126+ output = cmd (archiver , "check" , "-v" , "--archives-only" , "--newer=86400S" , exit_code = 0 )
127+ assert "archive-2022-11-20" not in output
128+ assert "archive-2022-12-18" not in output
129+ assert "archive-now" in output
130+
131+ output = cmd (archiver , "check" , "-v" , "--archives-only" , "--older=86400S" , exit_code = 0 )
132+ assert "archive-2022-11-20" in output
133+ assert "archive-2022-12-18" in output
134+ assert "archive-now" not in output
87135
88136 # check for output when timespan older than the earliest archive is given. Issue #1711
89137 output = cmd (archiver , "check" , "-v" , "--archives-only" , "--older=9999m" , exit_code = 0 )
0 commit comments