Correct the post-unseal meaning of the seal status type (#23022)

* Correct the post-unseal meaning of the seal status type

And at the same time add a RecoverySealType to the response which preserves the old meaning.
Updated the CLI to display both when relevant.

* changelog

* no longer needed

* Don't need this field either, which fixes unit tests

* fix unit tests
This commit is contained in:
Scott Miller
2023-10-09 12:53:13 -05:00
committed by GitHub
parent 61f8aff24b
commit 42a484c6ce
5 changed files with 67 additions and 47 deletions

View File

@@ -108,6 +108,7 @@ func TestStatusFormat(t *testing.T) {
expectedOutputString := `Key Value
--- -----
Seal Type type
Recovery Seal Type type
Initialized true
Sealed true
@@ -140,6 +141,7 @@ Warnings [warning]`
expectedOutputString = `Key Value
--- -----
Seal Type type
Recovery Seal Type type
Initialized true
Sealed true
@@ -167,21 +169,22 @@ func getMockStatusData(emptyFields bool) SealStatusOutput {
var sealStatusResponseMock api.SealStatusResponse
if !emptyFields {
sealStatusResponseMock = api.SealStatusResponse{
Type: "type",
Initialized: true,
Sealed: true,
T: 1,
N: 2,
Progress: 3,
Nonce: "nonce",
Version: "version",
BuildDate: "build date",
Migration: true,
ClusterName: "cluster name",
ClusterID: "cluster id",
RecoverySeal: true,
StorageType: "storage type",
Warnings: []string{"warning"},
Type: "type",
Initialized: true,
Sealed: true,
T: 1,
N: 2,
Progress: 3,
Nonce: "nonce",
Version: "version",
BuildDate: "build date",
Migration: true,
ClusterName: "cluster name",
ClusterID: "cluster id",
RecoverySeal: true,
RecoverySealType: "type",
StorageType: "storage type",
Warnings: []string{"warning"},
}
// must initialize this struct without explicit field names due to embedding
@@ -200,20 +203,21 @@ func getMockStatusData(emptyFields bool) SealStatusOutput {
}
} else {
sealStatusResponseMock = api.SealStatusResponse{
Type: "type",
Initialized: true,
Sealed: true,
T: 1,
N: 2,
Progress: 3,
Nonce: "nonce",
Version: "version",
BuildDate: "build date",
Migration: true,
ClusterName: "",
ClusterID: "",
RecoverySeal: true,
StorageType: "",
Type: "type",
Initialized: true,
Sealed: true,
T: 1,
N: 2,
Progress: 3,
Nonce: "nonce",
Version: "version",
BuildDate: "build date",
Migration: true,
ClusterName: "",
ClusterID: "",
RecoverySeal: true,
StorageType: "",
RecoverySealType: "type",
}
// must initialize this struct without explicit field names due to embedding