Skip to content

Commit

Permalink
Seal and cleanup cluster before test teardown for TestRaftHA_Recover_…
Browse files Browse the repository at this point in the history
…Cluster (#29057)

* Seal and cleanup cluster before test teardown for TestRaftHA_Recover_Cluster

* Remove old cleanup
  • Loading branch information
VioletHynes authored Nov 28, 2024
1 parent 93ca099 commit e7d0165
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions vault/external_tests/raftha/raft_ha_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -177,9 +177,6 @@ func testRaftHARecoverCluster(t *testing.T, physBundle *vault.PhysicalBackendBun
_, err = leaderClient.Logical().Write("kv/data/test_known_data", kvData)
require.NoError(t, err)

// We delete the current cluster. We keep the storage backend so we can recover the cluster
cluster.Cleanup()

// We now have a raft HA cluster with a KVv2 backend enabled and a test data.
// We're now going to delete the cluster and create a new raft HA cluster with the same backend storage
// and ensure we can recover to a working vault cluster and don't lose the data from the backend storage.
Expand Down Expand Up @@ -219,6 +216,11 @@ func testRaftHARecoverCluster(t *testing.T, physBundle *vault.PhysicalBackendBun
dataAsMap := data.(map[string]interface{})
require.NotNil(t, dataAsMap)
require.Equal(t, "awesome", dataAsMap["kittens"])

// Ensure no writes are happening before we try to clean it up, to prevent
// issues deleting the files.
clusterRestored.EnsureCoresSealed(t)
clusterRestored.Cleanup()
}

func TestRaft_HA_ExistingCluster(t *testing.T) {
Expand Down

0 comments on commit e7d0165

Please sign in to comment.