From a86453f1380632e53b802b0318ba67b112b1e8eb Mon Sep 17 00:00:00 2001 From: Abin Simon Date: Mon, 20 Feb 2023 20:20:28 +0530 Subject: [PATCH] Add owner in json output for backup list (#2575) ## Description This adds information about owner of the backup to `--json` output of backup list. Previously we were showing owner in the normal backup list command, but not when asked to as json. ## Does this PR need a docs update or release note? - [x] :white_check_mark: Yes, it's included - [ ] :clock1: Yes, but in a later PR - [ ] :no_entry: No ## Type of change - [x] :sunflower: Feature - [ ] :bug: Bugfix - [ ] :world_map: Documentation - [ ] :robot: Test - [ ] :computer: CI/Deployment - [ ] :broom: Tech Debt/Cleanup ## Issue(s) * # ## Test Plan - [ ] :muscle: Manual - [x] :zap: Unit test - [ ] :green_heart: E2E --- CHANGELOG.md | 3 +++ src/pkg/backup/backup.go | 2 ++ src/pkg/backup/backup_test.go | 1 + 3 files changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index d2b5a2c8e..602ec5c2c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] (beta) +### Added +- Show owner information when doing backup list in json format + ## [v0.4.0] (alpha) - 2023-2-20 ### Fixed diff --git a/src/pkg/backup/backup.go b/src/pkg/backup/backup.go index 36e4b16ff..0044736bc 100644 --- a/src/pkg/backup/backup.go +++ b/src/pkg/backup/backup.go @@ -108,6 +108,7 @@ type Printable struct { Version string `json:"version"` BytesRead int64 `json:"bytesRead"` BytesUploaded int64 `json:"bytesUploaded"` + Owner string `json:"owner"` } // MinimumPrintable reduces the Backup to its minimally printable details. @@ -120,6 +121,7 @@ func (b Backup) MinimumPrintable() any { Version: "0", BytesRead: b.BytesRead, BytesUploaded: b.BytesUploaded, + Owner: b.Selector.DiscreteOwner, } } diff --git a/src/pkg/backup/backup_test.go b/src/pkg/backup/backup_test.go index 8fbf8c62f..6fb4536d4 100644 --- a/src/pkg/backup/backup_test.go +++ b/src/pkg/backup/backup_test.go @@ -102,4 +102,5 @@ func (suite *BackupSuite) TestBackup_MinimumPrintable() { assert.Equal(t, b.Status, result.Status, "status") assert.Equal(t, b.BytesRead, result.BytesRead, "size") assert.Equal(t, b.BytesUploaded, result.BytesUploaded, "stored size") + assert.Equal(t, b.Selector.DiscreteOwner, result.Owner, "owner") }