diff --git a/vault/logical_system_test.go b/vault/logical_system_test.go index a06bdc60b..97b0a6a4d 100644 --- a/vault/logical_system_test.go +++ b/vault/logical_system_test.go @@ -3,6 +3,7 @@ package vault import ( "crypto/sha256" "reflect" + "strings" "testing" "time" @@ -876,19 +877,6 @@ func TestSystemBackend_rawRead_Protected(t *testing.T) { } } -func TestSystemBackend_rawRead(t *testing.T) { - b := testSystemBackend(t) - - req := logical.TestRequest(t, logical.ReadOperation, "raw/"+coreMountConfigPath) - resp, err := b.HandleRequest(req) - if err != nil { - t.Fatalf("err: %v", err) - } - if resp.Data["value"].(string)[0] != '{' { - t.Fatalf("bad: %v", resp) - } -} - func TestSystemBackend_rawWrite_Protected(t *testing.T) { b := testSystemBackend(t) @@ -899,7 +887,7 @@ func TestSystemBackend_rawWrite_Protected(t *testing.T) { } } -func TestSystemBackend_rawWrite(t *testing.T) { +func TestSystemBackend_rawReadWrite(t *testing.T) { c, b, _ := testCoreSystemBackend(t) req := logical.TestRequest(t, logical.UpdateOperation, "raw/sys/policy/test") @@ -912,6 +900,16 @@ func TestSystemBackend_rawWrite(t *testing.T) { t.Fatalf("bad: %v", resp) } + // Read via raw API + req = logical.TestRequest(t, logical.ReadOperation, "raw/sys/policy/test") + resp, err = b.HandleRequest(req) + if err != nil { + t.Fatalf("err: %v", err) + } + if !strings.HasPrefix(resp.Data["value"].(string), "path") { + t.Fatalf("bad: %v", resp) + } + // Read the policy! p, err := c.policyStore.GetPolicy("test") if err != nil {