[#136] container/test: Move container domain to constant
All checks were successful
DCO action / DCO (pull_request) Successful in 1m24s
Code generation / Generate wrappers (pull_request) Successful in 2m52s
Tests / Tests (pull_request) Successful in 2m58s

Signed-off-by: Alexander Chuprov <a.chuprov@yadro.com>
This commit is contained in:
Alexander Chuprov 2024-12-12 13:18:44 +03:00
parent 780b48cedf
commit 3c7a9cb743
Signed by: achuprov
GPG key ID: 2D916FFD803B0EDD

View file

@ -28,13 +28,17 @@ const (
containerAliasFee = 0o_0050_0000 containerAliasFee = 0o_0050_0000
) )
const (
containerRootDomain = "frostfs"
)
func deployContainerContract(t *testing.T, e *neotest.Executor, addrNetmap, addrBalance, addrNNS util.Uint160) util.Uint160 { func deployContainerContract(t *testing.T, e *neotest.Executor, addrNetmap, addrBalance, addrNNS util.Uint160) util.Uint160 {
args := make([]any, 5) args := make([]any, 5)
args[0] = addrNetmap args[0] = addrNetmap
args[1] = addrBalance args[1] = addrBalance
args[2] = util.Uint160{} // not needed for now args[2] = util.Uint160{} // not needed for now
args[3] = addrNNS args[3] = addrNNS
args[4] = "frostfs" args[4] = containerRootDomain
c := neotest.CompileFile(t, e.CommitteeHash, containerPath, path.Join(containerPath, "config.yml")) c := neotest.CompileFile(t, e.CommitteeHash, containerPath, path.Join(containerPath, "config.yml"))
e.DeployContract(t, c, args) e.DeployContract(t, c, args)
@ -207,14 +211,14 @@ func TestContainerPut(t *testing.T) {
stackitem.NewByteArray([]byte(base58.Encode(cnt.id[:]))), stackitem.NewByteArray([]byte(base58.Encode(cnt.id[:]))),
}) })
cNNS := c.CommitteeInvoker(nnsHash) cNNS := c.CommitteeInvoker(nnsHash)
cNNS.Invoke(t, expected, "resolve", "mycnt.frostfs", int64(nns.TXT)) cNNS.Invoke(t, expected, "resolve", "mycnt."+containerRootDomain, int64(nns.TXT))
t.Run("name is already taken", func(t *testing.T) { t.Run("name is already taken", func(t *testing.T) {
c.InvokeFail(t, "name is already taken", "putNamed", putArgs...) c.InvokeFail(t, "name is already taken", "putNamed", putArgs...)
}) })
c.Invoke(t, stackitem.Null{}, "delete", cnt.id[:], cnt.sig, cnt.pub, cnt.token) c.Invoke(t, stackitem.Null{}, "delete", cnt.id[:], cnt.sig, cnt.pub, cnt.token)
cNNS.Invoke(t, stackitem.Null{}, "resolve", "mycnt.frostfs", int64(nns.TXT)) cNNS.Invoke(t, stackitem.Null{}, "resolve", "mycnt."+containerRootDomain, int64(nns.TXT))
t.Run("register in advance", func(t *testing.T) { t.Run("register in advance", func(t *testing.T) {
cnt.value[len(cnt.value)-1] = 10 cnt.value[len(cnt.value)-1] = 10
@ -246,9 +250,9 @@ func TestContainerPut(t *testing.T) {
nnsInv := c.NewInvoker(ctrNNS.Hash, acc) nnsInv := c.NewInvoker(ctrNNS.Hash, acc)
containerInv := c.WithSigners(c.Committee, acc) containerInv := c.WithSigners(c.Committee, acc)
nnsInv.InvokeFail(t, "not witnessed by admin", "addRecord", "frostfs", int64(nns.TXT), nns.Cnametgt+"=animals") nnsInv.InvokeFail(t, "not witnessed by admin", "addRecord", containerRootDomain, int64(nns.TXT), nns.Cnametgt+"=animals")
containerInv.Invoke(t, stackitem.Null{}, "setAdmin", acc.ScriptHash()) containerInv.Invoke(t, stackitem.Null{}, "setAdmin", acc.ScriptHash())
nnsInv.Invoke(t, stackitem.Null{}, "addRecord", "frostfs", int64(nns.TXT), nns.Cnametgt+"=animals") nnsInv.Invoke(t, stackitem.Null{}, "addRecord", containerRootDomain, int64(nns.TXT), nns.Cnametgt+"=animals")
}) })
t.Run("create global domain", func(t *testing.T) { t.Run("create global domain", func(t *testing.T) {