Skip to content

Commit

Permalink
cmd/snappr: Add integration tests
Browse files Browse the repository at this point in the history
  • Loading branch information
pgaskin committed Nov 16, 2023
1 parent 534dff9 commit 6de2d95
Show file tree
Hide file tree
Showing 14 changed files with 7,152 additions and 3 deletions.
6,976 changes: 6,976 additions & 0 deletions cmd/snappr/test/complex.txt

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions cmd/snappr/test/empty.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
-- args --
2: snappr
74 changes: 74 additions & 0 deletions cmd/snappr/test/explain.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
-- args --
snappr -sw 1@last 3@daily 2@daily:7 6@monthly 6@monthly:2 yearly
-- stdin --
1672531200
1672617600
1672704000
1672790400
1672876800
1672963200
1673049600
1673136000
1673222400
1673308800
1673395200
1673481600
1673568000
1673654400
1673740800
1673827200
1673913600
1674000000
1674086400
1674172800
1674259200
1674345600
1674432000
1674518400
1674604800
1674691200
1674777600
1674864000
1674950400
1675036800
1675123200
-- stdout --
1672617600
1672704000
1672790400
1672876800
1672963200
1673049600
1673136000
1673222400
1673308800
1673395200
1673481600
1673568000
1673654400
1673740800
1673827200
1673913600
1674000000
1674172800
1674259200
1674345600
1674432000
1674518400
1674604800
1674777600
1674864000
-- stderr --
snappr: why: keep [ 1/31] Sun 2023 Jan 1 00:00:00 :: 1 month, 2 month, 1 year
snappr: why: keep [19/31] Thu 2023 Jan 19 00:00:00 :: 7 day
snappr: why: keep [26/31] Thu 2023 Jan 26 00:00:00 :: 7 day
snappr: why: keep [29/31] Sun 2023 Jan 29 00:00:00 :: 1 day
snappr: why: keep [30/31] Mon 2023 Jan 30 00:00:00 :: 1 day
snappr: why: keep [31/31] Tue 2023 Jan 31 00:00:00 :: last, 1 day
snappr: summary: (1) last
snappr: summary: (3) 1 day
snappr: summary: (2) 7 day
snappr: summary: (6) 1 month (missing 5)
snappr: summary: (6) 2 month (missing 5)
snappr: summary: (*) 1 year
snappr: summary: pruning 25/31 snapshots
5 changes: 2 additions & 3 deletions cmd/snappr/test/help.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
-- args --
0: snappr --help

-- stderr --
snappr --help
-- stderr --
2 changes: 2 additions & 0 deletions cmd/snappr/test/invalid_argument.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
-- args --
2: snappr --dummy
2 changes: 2 additions & 0 deletions cmd/snappr/test/invalid_policy.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
-- args --
2: snappr dummy
2 changes: 2 additions & 0 deletions cmd/snappr/test/invalid_policy_none.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
-- args --
2: snappr
2 changes: 2 additions & 0 deletions cmd/snappr/test/invalid_regexp.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
-- args --
2: snappr --extract "(" monthly
2 changes: 2 additions & 0 deletions cmd/snappr/test/invalid_regexp_groups.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
-- args --
2: snappr --extract "(a)(b)" monthly
64 changes: 64 additions & 0 deletions cmd/snappr/test/simple.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
-- args --
snappr 1@last 3@daily 2@daily:7
-- stdin --
dummy
1672531200
1672617600
1672704000
1672790400
1672876800
1672963200
1673049600
1673136000
1673222400
1673308800
1673395200
1673481600
1673568000
1673654400
1673740800
1673827200
1673913600
1674000000
1674086400
1674172800
1674259200
1674345600
1674432000
1674518400
1674604800
1674691200
1674777600
1674864000
1674950400
1675036800
1675123200
-- stdout --
1672531200
1672617600
1672704000
1672790400
1672876800
1672963200
1673049600
1673136000
1673222400
1673308800
1673395200
1673481600
1673568000
1673654400
1673740800
1673827200
1673913600
1674000000
1674172800
1674259200
1674345600
1674432000
1674518400
1674604800
1674777600
1674864000
-- stderr --
snappr: warning: failed to parse unix timestamp "dummy": strconv.ParseInt: parsing "dummy": invalid syntax
6 changes: 6 additions & 0 deletions cmd/snappr/test/timezone_1.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
-- args --
snappr -wp "2006-01-02 15:04:05" -z EST5EDT -Z UTC last
-- stdin --
2023-01-02 03:04:05
-- stderr --
snappr: why: keep [1/1] Sun 2023 Jan 1 22:04:05 :: last
6 changes: 6 additions & 0 deletions cmd/snappr/test/timezone_2.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
-- args --
snappr -wp "2006-01-02 15:04:05" -Z EST5EDT last
-- stdin --
2023-01-02 03:04:05
-- stderr --
snappr: why: keep [1/1] Mon 2023 Jan 2 08:04:05 :: last
6 changes: 6 additions & 0 deletions cmd/snappr/test/timezone_3.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
-- args --
snappr -wp "2006-01-02 15:04:05" -z EST5EDT last
-- stdin --
2023-01-02 03:04:05
-- stderr --
snappr: why: keep [1/1] Mon 2023 Jan 2 03:04:05 :: last
6 changes: 6 additions & 0 deletions cmd/snappr/test/timezone_4.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
-- args --
snappr -wp "2006-01-02 15:04:05 MST" -z EST5EDT last
-- stdin --
2023-01-02 03:04:05 UTC
-- stderr --
snappr: why: keep [1/1] Sun 2023 Jan 1 22:04:05 :: last

0 comments on commit 6de2d95

Please sign in to comment.