-
Notifications
You must be signed in to change notification settings - Fork 152
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[K10-1255] Restic deleteData by ID (#5296)
* Add snapshotsByTag command * Add parsing snapID from snapshots * Add parsing snapID test * Address review comments * Address review comments * Combine result length checks * Export getSnapshotIDFromTag * Add BackupDelete integration_test * Renaming func and variables * Fix imports
- Loading branch information
1 parent
2fbc631
commit e220ac8
Showing
3 changed files
with
74 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package function | ||
|
||
import ( | ||
. "gopkg.in/check.v1" | ||
) | ||
|
||
type DeleteDataSuite struct { | ||
} | ||
|
||
var _ = Suite(&DeleteDataSuite{}) | ||
|
||
func (s *DeleteDataSuite) TestGetSnapshotIDFromTag(c *C) { | ||
for _, tc := range []struct { | ||
log string | ||
expected string | ||
checker Checker | ||
}{ | ||
{log: `[{"time":"2019-03-28T17:35:15.146526-07:00","hostname":"MacBook-Pro.local","username":"abc","uid":501,"gid":20,"tags":["backup123"],"id":"7c0bfeb93dd5b390a6eaf8a386ec8cb86e4631f2d96400407b529b53d979536a","short_id":"7c0bfeb9"}]`, expected: "7c0bfeb9", checker: IsNil}, | ||
{log: `[{"time":"2019-03-28T17:35:15.146526-07:00","hostname":"MacBook-Pro.local","username":"abc","uid":501,"gid":20,"tags":["backup123"],"id":"7c0bfeb93dd5b390a6eaf8a386ec8cb86e4631f2d96400407b529b53d979536a","short_id":"7c0bfeb9"},{"time":"2019-03-28T17:35:15.146526-07:00","hostname":"MacBook-Pro.local","username":"abc","uid":501,"gid":20,"tags":["backup123"],"id":"7c0bfeb93dd5b390a6eaf8a386ec8cb86e4631f2d96400407b529b53d979536a","short_id":"7c0bfeb9"}]`, expected: "", checker: NotNil}, | ||
{log: `null`, expected: "", checker: NotNil}, | ||
} { | ||
id, err := GetSnapshotIDFromLog(tc.log) | ||
c.Assert(err, tc.checker) | ||
c.Assert(id, Equals, tc.expected) | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters