Skip to content

Commit

Permalink
Also cover readLocksIntoOpaque in the tests
Browse files Browse the repository at this point in the history
  • Loading branch information
aduffeck committed Feb 4, 2022
1 parent 10fe51e commit 2837f13
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions pkg/storage/utils/decomposedfs/node/node_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
package node_test

import (
"encoding/json"
"time"

userpb "github.com/cs3org/go-cs3apis/cs3/identity/user/v1beta1"
Expand Down Expand Up @@ -208,6 +209,25 @@ var _ = Describe("Node", func() {
Expect(len(ri.Etag)).To(Equal(34))
Expect(ri.Etag).ToNot(Equal(before))
})

It("includes the lock in the Opaque", func() {
lock := &provider.Lock{
Type: provider.LockType_LOCK_TYPE_EXCL,
User: env.Owner.Id,
LockId: "foo",
}
n.SetLock(env.Ctx, lock)

perms := node.OwnerPermissions()
ri, err := n.AsResourceInfo(env.Ctx, &perms, []string{}, false)
Expect(err).ToNot(HaveOccurred())
Expect(ri.Opaque.Map["lock"]).ToNot(BeNil())

storedLock := &provider.Lock{}
err = json.Unmarshal(ri.Opaque.Map["lock"].Value, storedLock)
Expect(err).ToNot(HaveOccurred())
Expect(storedLock).To(Equal(lock))
})
})
})
})

0 comments on commit 2837f13

Please sign in to comment.