-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove old workaround for a rollback error (#4206)
It can now cause problems in other situations
- Loading branch information
Showing
3 changed files
with
99 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
package vault_test | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/hashicorp/vault/api" | ||
"github.com/hashicorp/vault/builtin/credential/userpass" | ||
vaulthttp "github.com/hashicorp/vault/http" | ||
"github.com/hashicorp/vault/logical" | ||
"github.com/hashicorp/vault/vault" | ||
) | ||
|
||
func TestRouter_MountSubpath_Checks(t *testing.T) { | ||
testRouter_MountSubpath(t, []string{"auth/abcd/123", "abcd/123"}) | ||
testRouter_MountSubpath(t, []string{"abcd/123", "auth/abcd/123"}) | ||
testRouter_MountSubpath(t, []string{"auth/abcd/123", "abcd/123"}) | ||
} | ||
|
||
func testRouter_MountSubpath(t *testing.T, mountPoints []string) { | ||
coreConfig := &vault.CoreConfig{ | ||
CredentialBackends: map[string]logical.Factory{ | ||
"userpass": userpass.Factory, | ||
}, | ||
} | ||
cluster := vault.NewTestCluster(t, coreConfig, &vault.TestClusterOptions{ | ||
HandlerFunc: vaulthttp.Handler, | ||
}) | ||
cluster.Start() | ||
defer cluster.Cleanup() | ||
|
||
vault.TestWaitActive(t, cluster.Cores[0].Core) | ||
client := cluster.Cores[0].Client | ||
|
||
authInput := &api.EnableAuthOptions{ | ||
Type: "userpass", | ||
} | ||
|
||
for _, mp := range mountPoints { | ||
t.Logf("mounting %s", mp) | ||
var err error | ||
err = client.Sys().EnableAuthWithOptions(mp, authInput) | ||
if err != nil { | ||
t.Fatalf("err: %v", err) | ||
} | ||
} | ||
|
||
cluster.EnsureCoresSealed(t) | ||
|
||
cluster.UnsealCores(t) | ||
|
||
t.Logf("Done: %#v", mountPoints) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters