command repo stat: add human flag tests to t0080-repo.sh
License: MIT Signed-off-by: Georgij Tolstov <tolstov.georgij@gmail.com>
tg committed
Mar 21, 2019 at 18:27 UTC
8b98cbe0e3b016da22ec181f3c3dcc69ccbe319f
1 file changed
+14
test/sharness/t0080-repo.sh
+14
@@ -237,6 +237,7 @@ get_field_num() {
237
test_expect_success "'ipfs repo stat' succeeds" '
238
ipfs repo stat > repo-stats
239
'
240
+
241
test_expect_success "repo stats came out correct" '
242
grep "RepoPath" repo-stats &&
243
grep "RepoSize" repo-stats &&
@@ -245,6 +246,19 @@ test_expect_success "repo stats came out correct" '
246
grep "StorageMax" repo-stats
247
'
248
249
+test_expect_success "'ipfs repo stat --human' succeeds" '
250
+ ipfs repo stat --human > repo-stats-human
251
+'
252
+
253
+test_expect_success "repo stats --human came out correct" '
254
+ grep "RepoPath" repo-stats-human &&
255
+ grep -P "RepoSize:\s*([0-9]*[.])?[0-9]+\s+?(B|kB|MB|GB|TB|PB|EB)" repo-stats-human &&
256
+ grep "NumObjects" repo-stats-human &&
257
+ grep "Version" repo-stats-human &&
258
+ grep -P "StorageMax:\s*([0-9]*[.])?[0-9]+\s+?(B|kB|MB|GB|TB|PB|EB)" repo-stats-human ||
259
+ test_fsh cat repo-stats-human
260
+'
261
+
262
test_expect_success "'ipfs repo stat' after adding a file" '
263
ipfs add repo-stats &&
264
ipfs repo stat > repo-stats-2