Problem testing with KV v2

I’m trying to use to test code that writes to and reads from a version 2 KV secrets engine. I have read and write working but list fails when I try to access …/metadata/…; it works if I use …/data/… so I think I’m doing something wrong with enabling or configuring the version of the KV engine.

Here’s the relevant portion of my code:

    const vaultToken = "token"

    func TestX(t *testing.T) {
            cluster := vault.NewTestCluster(t, &vault.CoreConfig{
                    DevToken: vaultToken,
                    LogicalBackends: map[string]logical.Factory{
                            "my-kv": logicalKv.Factory,

            }, &vault.TestClusterOptions{
                    HandlerFunc: vaulthttp.Handler,
            defer cluster.Cleanup()

            core := cluster.Cores[0].Core
            vault.TestWaitActive(t, core)
            client := cluster.Cores[0].Client
            err := client.Sys().Mount("my-kv/", &vaultapi.MountInput{
                    Type: "kv-v2",
                    Options: map[string]string{
                            "version": "2",
            if err != nil {

            // test code is here

Later in my code, after successfully writing several secrets, when I try to do this:

data, err := client.Logical().List("my-kv/metadata")

data is nil. If I change “my-kv/metadata” to “my-kv/data” I get the results I expect.

Can anyone please show me what I’m doing wrong?