From 8f2043ddecde5d7342ed0af67fbceb04d2d7def4 Mon Sep 17 00:00:00 2001 From: Joel Andrews Date: Wed, 15 Mar 2023 16:06:41 -0700 Subject: [PATCH] Nightly backups status Adds an entry showing whether nightly backups are enabled to `borealis-pg:restore:capabilities` command output. --- CHANGELOG.md | 3 ++- src/commands/borealis-pg/restore/capabilities.test.ts | 3 +++ src/commands/borealis-pg/restore/capabilities.ts | 2 ++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5bc13db..24d8844 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/src/commands/borealis-pg/restore/capabilities.test.ts b/src/commands/borealis-pg/restore/capabilities.test.ts index 22486d3..6aca999 100644 --- a/src/commands/borealis-pg/restore/capabilities.test.ts +++ b/src/commands/borealis-pg/restore/capabilities.test.ts @@ -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()}`) @@ -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') @@ -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()}`) diff --git a/src/commands/borealis-pg/restore/capabilities.ts b/src/commands/borealis-pg/restore/capabilities.ts index a420995..8d2795c 100644 --- a/src/commands/borealis-pg/restore/capabilities.ts +++ b/src/commands/borealis-pg/restore/capabilities.ts @@ -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() : @@ -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)}`)