From bda6a6da78f513e328d03119b60cde1afcb78dff Mon Sep 17 00:00:00 2001 From: Lars Lehtonen Date: Mon, 4 Nov 2019 01:36:07 -0800 Subject: [PATCH] core/policy & core/token: Remove Dead Test Code (#7774) * vault: remove dead test helper function testMakeBatchTokenViaCore() * vault: remove dead test helper function testMakeBatchTokenViaBackend() * vault: remove dead test helper function mockPolicyStoreNoCache() * vault: remove dead test helper function mockPolicyStore() * vault: remove unused test imports --- vault/policy_store_test.go | 25 ------------------------- vault/token_store_test.go | 8 -------- 2 files changed, 33 deletions(-) diff --git a/vault/policy_store_test.go b/vault/policy_store_test.go index 337e45a46..1342d8391 100644 --- a/vault/policy_store_test.go +++ b/vault/policy_store_test.go @@ -5,34 +5,9 @@ import ( "reflect" "testing" - log "github.com/hashicorp/go-hclog" "github.com/hashicorp/vault/helper/namespace" - "github.com/hashicorp/vault/sdk/helper/logging" - "github.com/hashicorp/vault/sdk/logical" ) -func mockPolicyStore(t *testing.T) *PolicyStore { - _, barrier, _ := mockBarrier(t) - view := NewBarrierView(barrier, "foo/") - p, err := NewPolicyStore(context.Background(), nil, view, logical.TestSystemView(), logging.NewVaultLogger(log.Trace)) - if err != nil { - t.Fatal(err) - } - return p -} - -func mockPolicyStoreNoCache(t *testing.T) *PolicyStore { - sysView := logical.TestSystemView() - sysView.CachingDisabledVal = true - _, barrier, _ := mockBarrier(t) - view := NewBarrierView(barrier, "foo/") - p, err := NewPolicyStore(context.Background(), nil, view, sysView, logging.NewVaultLogger(log.Trace)) - if err != nil { - t.Fatal(err) - } - return p -} - func mockPolicyWithCore(t *testing.T, disableCache bool) (*Core, *PolicyStore) { conf := &CoreConfig{ DisableCache: disableCache, diff --git a/vault/token_store_test.go b/vault/token_store_test.go index 4b16409eb..a2dc29728 100644 --- a/vault/token_store_test.go +++ b/vault/token_store_test.go @@ -540,10 +540,6 @@ func getBackendConfig(c *Core) *logical.BackendConfig { } } -func testMakeBatchTokenViaBackend(t testing.TB, ts *TokenStore, root, client, ttl string, policy []string) { - testMakeTokenViaBackend(t, ts, root, client, ttl, policy, true) -} - func testMakeServiceTokenViaBackend(t testing.TB, ts *TokenStore, root, client, ttl string, policy []string) { testMakeTokenViaBackend(t, ts, root, client, ttl, policy, false) } @@ -647,10 +643,6 @@ func testMakeServiceTokenViaCore(t testing.TB, c *Core, root, client, ttl string testMakeTokenViaCore(t, c, root, client, ttl, policy, false, nil) } -func testMakeBatchTokenViaCore(t testing.TB, c *Core, root, client, ttl string, policy []string) { - testMakeTokenViaCore(t, c, root, client, ttl, policy, true, nil) -} - func testMakeTokenViaCore(t testing.TB, c *Core, root, client, ttl string, policy []string, batch bool, outAuth *logical.Auth) { req := logical.TestRequest(t, logical.UpdateOperation, "auth/token/create") req.ClientToken = root