Skip to content

Commit

Permalink
Nightly backups status
Browse files Browse the repository at this point in the history
Adds an entry showing whether nightly backups are enabled to `borealis-pg:restore:capabilities` command output.
  • Loading branch information
OldSneerJaw committed Mar 15, 2023
1 parent 5dd3977 commit 8f2043d
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
This project adheres to [Semantic Versioning](http://semver.org/). All notable changes will be documented in this file.

## [Unreleased](https://github.com/OldSneerJaw/borealis-pg-cli/compare/v1.4.0...HEAD)
- Shows times in the user's local time zone
- Outputs all times in the user's local time zone
- Shows whether nightly backups are enabled in `borealis-pg:restore:capabilities` command output

## [1.4.0](https://github.com/OldSneerJaw/borealis-pg-cli/compare/v1.3.0...v1.4.0)
- Adds the `borealis-pg:restore:capabilities` command to retrieve an add-on's database restore capabilities
Expand Down
3 changes: 3 additions & 0 deletions src/commands/borealis-pg/restore/capabilities.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ describe('database restore capabilities command', () => {
}))
.command(['borealis-pg:restore:capabilities', '--app', fakeHerokuAppName])
.it('displays restore capabilities of a single tenant add-on', ctx => {
expect(ctx.stdout).to.containIgnoreSpaces('Nightly Backups Status: Enabled')
expect(ctx.stdout).to.containIgnoreSpaces('Restore/Clone Supported: Yes')
expect(ctx.stdout).to.containIgnoreSpaces(
`Earliest Restorable Time: ${DateTime.fromISO(fakeEarliestRestorableTime).toISO()}`)
Expand All @@ -78,6 +79,7 @@ describe('database restore capabilities command', () => {
{earliestRestorableTime: null, latestRestorableTime: null, restoreSupported: false}))
.command(['borealis-pg:restore:capabilities', '-a', fakeHerokuAppName])
.it('displays restore capabilities of a multi-tenant add-on', ctx => {
expect(ctx.stdout).to.containIgnoreSpaces('Nightly Backups Status: Enabled')
expect(ctx.stdout).to.containIgnoreSpaces('Restore/Clone Supported: No')
expect(ctx.stdout).to.containIgnoreSpaces('Earliest Restorable Time: N/A')
expect(ctx.stdout).to.containIgnoreSpaces('Latest Restorable Time: N/A')
Expand All @@ -97,6 +99,7 @@ describe('database restore capabilities command', () => {
}))
.command(['borealis-pg:restore:info', '-a', fakeHerokuAppName])
.it('displays restore capabilities via the borealis-pg:restore:info alias', ctx => {
expect(ctx.stdout).to.containIgnoreSpaces('Nightly Backups Status: Enabled')
expect(ctx.stdout).to.containIgnoreSpaces('Restore/Clone Supported: Yes')
expect(ctx.stdout).to.containIgnoreSpaces(
`Earliest Restorable Time: ${DateTime.fromISO(fakeEarliestRestorableTime).toISO()}`)
Expand Down
2 changes: 2 additions & 0 deletions src/commands/borealis-pg/restore/capabilities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ See the ${cliCmdColour('borealis-pg:restore:execute')} command to perform a rest
}

private async printDbRestoreInfo(dbRestoreInfo: DbRestoreInfo) {
const nightlyBackupsStatus = 'Enabled'
const restoreSupportedDisplay = dbRestoreInfo.restoreSupported ? 'Yes' : 'No'
const earliestRestoreTimeDisplay = dbRestoreInfo.earliestRestorableTime ?
DateTime.fromISO(dbRestoreInfo.earliestRestorableTime).toISO() :
Expand All @@ -67,6 +68,7 @@ See the ${cliCmdColour('borealis-pg:restore:execute')} command to perform a rest
'N/A'

this.log()
this.log(` ${keyColour('Nightly Backups Status')}: ${valueColour(nightlyBackupsStatus)}`)
this.log(` ${keyColour('Restore/Clone Supported')}: ${valueColour(restoreSupportedDisplay)}`)
this.log(` ${keyColour('Earliest Restorable Time')}: ${valueColour(earliestRestoreTimeDisplay)}`)
this.log(` ${keyColour('Latest Restorable Time')}: ${valueColour(latestRestoreTimeDisplay)}`)
Expand Down

0 comments on commit 8f2043d

Please sign in to comment.