[#99999] nns: Fix CM compatibility

Signed-off-by: Alexander Chuprov <a.chuprov@yadro.com>
This commit is contained in:
Alexander Chuprov 2024-11-05 13:56:18 +03:00
parent 48f06df25a
commit 16fd3243ab
Signed by: achuprov
GPG key ID: 2D916FFD803B0EDD
2 changed files with 4 additions and 0 deletions

View file

@ -239,6 +239,9 @@ func IsAvailable(name string) bool {
ctx := storage.GetReadOnlyContext() ctx := storage.GetReadOnlyContext()
l := len(fragments) l := len(fragments)
if storage.Get(ctx, append([]byte{prefixRoot}, []byte(fragments[l-1])...)) == nil { if storage.Get(ctx, append([]byte{prefixRoot}, []byte(fragments[l-1])...)) == nil {
if l != 1 {
panic("panic should not happen")
}
return true return true
} }

View file

@ -588,6 +588,7 @@ func TestNNSIsAvailable(t *testing.T) {
c := newNNSInvoker(t, false) c := newNNSInvoker(t, false)
c.Invoke(t, true, "isAvailable", "com") c.Invoke(t, true, "isAvailable", "com")
c.InvokeFail(t, "panic should not happen", "isAvailable", "aa.domain.zk")
refresh, retry, expire, ttl := int64(101), int64(102), int64(103), int64(104) refresh, retry, expire, ttl := int64(101), int64(102), int64(103), int64(104)
c.Invoke(t, true, "register", c.Invoke(t, true, "register",