Merge pull request #15751 from owayss/auth_store_unit_test_coverage

tests: increases unit test coverage for etcd/server/auth isRangeOpPermitted
storage-doc
Benjamin Wang 2023-04-21 07:29:35 +08:00 committed by GitHub
commit 63c9fe1d00
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 10 additions and 0 deletions

View File

@ -450,6 +450,16 @@ func TestIsOpPermitted(t *testing.T) {
if err != nil {
t.Fatal(err)
}
// Drop the user's permission from cache and expect a permission denied
// error.
as.rangePermCacheMu.Lock()
delete(as.rangePermCache, "foo")
as.rangePermCacheMu.Unlock()
if err := as.isOpPermitted("foo", as.Revision(), perm.Key, perm.RangeEnd, perm.PermType); err != ErrPermissionDenied {
t.Fatal(err)
}
}
func TestGetUser(t *testing.T) {