using neo-go directly instead of docker-exec in container
This commit is contained in:
commit
1e1c1e70a4
3 changed files with 60 additions and 44 deletions
17
README.md
17
README.md
|
@ -16,7 +16,14 @@
|
||||||
- `sudo cp bin/cdn-authmate /usr/local/bin/cdn-authmate`, add alias path to
|
- `sudo cp bin/cdn-authmate /usr/local/bin/cdn-authmate`, add alias path to
|
||||||
bin/cdn-authmate or run `export CDNAUTH_EXEC=<path_to_binary>`
|
bin/cdn-authmate or run `export CDNAUTH_EXEC=<path_to_binary>`
|
||||||
|
|
||||||
3. Install Testcases dependencies
|
3. Install neo-go
|
||||||
|
- `git clone git@github.com:nspcc-dev/neo-go.git`
|
||||||
|
- `cd neo-go`
|
||||||
|
- `make`
|
||||||
|
- `sudo cp bin/neo-go /usr/local/bin/neo-go`, add alias path to bin/neo-go
|
||||||
|
or run `export NEOGO_CLI_EXEC=<path_to_binary>`
|
||||||
|
|
||||||
|
4. Install Testcases dependencies
|
||||||
- `pip3 install -r requirements.txt`
|
- `pip3 install -r requirements.txt`
|
||||||
|
|
||||||
(replace pip3 with the appropriate python package manager on the system).
|
(replace pip3 with the appropriate python package manager on the system).
|
||||||
|
@ -68,13 +75,7 @@ export ROBOT_PROFILE=selectel_smoke
|
||||||
|
|
||||||
Dev-env is not needed. But you need to install neo-go.
|
Dev-env is not needed. But you need to install neo-go.
|
||||||
|
|
||||||
2. Install neo-go
|
2. To run smoke test: `robot --outputdir artifacts/ robot/testsuites/smoke/selectelcdn_smoke.robot`
|
||||||
- `git clone git@github.com:nspcc-dev/neo-go.git`
|
|
||||||
- `cd neo-go`
|
|
||||||
- `make`
|
|
||||||
- `sudo cp bin/neo-go /usr/local/bin/neo-go` or add alias path to bin/neo-go
|
|
||||||
|
|
||||||
3. To run smoke test: `robot --outputdir artifacts/ robot/testsuites/smoke/selectelcdn_smoke.robot`
|
|
||||||
|
|
||||||
|
|
||||||
## Generation of documentation
|
## Generation of documentation
|
||||||
|
|
|
@ -8,6 +8,7 @@ import logging
|
||||||
import requests
|
import requests
|
||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
|
import tarfile
|
||||||
|
|
||||||
from robot.api.deco import keyword
|
from robot.api.deco import keyword
|
||||||
from robot.api import logger
|
from robot.api import logger
|
||||||
|
@ -18,32 +19,28 @@ ROBOT_AUTO_KEYWORDS = False
|
||||||
|
|
||||||
|
|
||||||
if os.getenv('ROBOT_PROFILE') == 'selectel_smoke':
|
if os.getenv('ROBOT_PROFILE') == 'selectel_smoke':
|
||||||
from selectelcdn_smoke_vars import (NEOGO_CLI_PREFIX, NEO_MAINNET_ENDPOINT,
|
from selectelcdn_smoke_vars import (NEO_MAINNET_ENDPOINT,
|
||||||
NEOFS_NEO_API_ENDPOINT, NEOFS_ENDPOINT, GAS_HASH, NEOFS_CONTRACT)
|
NEOFS_NEO_API_ENDPOINT, NEOFS_ENDPOINT, GAS_HASH, NEOFS_CONTRACT)
|
||||||
else:
|
else:
|
||||||
from neofs_int_vars import (NEOGO_CLI_PREFIX, NEO_MAINNET_ENDPOINT,
|
from neofs_int_vars import (NEO_MAINNET_ENDPOINT,
|
||||||
NEOFS_NEO_API_ENDPOINT, NEOFS_ENDPOINT, GAS_HASH, NEOFS_CONTRACT)
|
NEOFS_NEO_API_ENDPOINT, NEOFS_ENDPOINT, GAS_HASH, NEOFS_CONTRACT)
|
||||||
|
|
||||||
# path to neofs-cli executable
|
# path to neofs-cli executable
|
||||||
NEOFS_CLI_EXEC = os.getenv('NEOFS_CLI_EXEC', 'neofs-cli')
|
NEOFS_CLI_EXEC = os.getenv('NEOFS_CLI_EXEC', 'neofs-cli')
|
||||||
|
NEOGO_CLI_EXEC = os.getenv('NEOGO_CLI_EXEC', 'neo-go')
|
||||||
|
|
||||||
@keyword('Init wallet')
|
@keyword('Init wallet')
|
||||||
def init_wallet():
|
def init_wallet():
|
||||||
|
filename = os.getcwd() + '/' + str(uuid.uuid4()) + ".json"
|
||||||
filename = "wallets/" + str(uuid.uuid4()) + ".json"
|
cmd = f"{NEOGO_CLI_EXEC} wallet init -w {filename}"
|
||||||
cmd = ( f"{NEOGO_CLI_PREFIX} wallet init -w {filename}" )
|
logger.info(f"Executing command: {cmd}")
|
||||||
|
stdout = _run_sh(cmd)
|
||||||
logger.info(f"Executing shell command: {cmd}")
|
logger.info(f"wallet init succeeded with output: {stdout}")
|
||||||
out = _run_sh(cmd)
|
|
||||||
logger.info(f"Command completed with output: {out}")
|
|
||||||
return filename
|
return filename
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@keyword('Generate wallet from WIF')
|
@keyword('Generate wallet from WIF')
|
||||||
def generate_wallet_from_wif(wallet: str, wif: str):
|
def generate_wallet_from_wif(wallet: str, wif: str):
|
||||||
cmd = ( f"{NEOGO_CLI_PREFIX} wallet import --wallet {wallet} --wif {wif}" )
|
cmd = f"{NEOGO_CLI_EXEC} wallet import --wallet {wallet} --wif {wif}"
|
||||||
|
|
||||||
logger.info(f"Executing command: {cmd}")
|
logger.info(f"Executing command: {cmd}")
|
||||||
p = pexpect.spawn(cmd)
|
p = pexpect.spawn(cmd)
|
||||||
p.expect(".*")
|
p.expect(".*")
|
||||||
|
@ -55,11 +52,9 @@ def generate_wallet_from_wif(wallet: str, wif: str):
|
||||||
|
|
||||||
logger.info(f"Command completed with output: {out}")
|
logger.info(f"Command completed with output: {out}")
|
||||||
|
|
||||||
|
|
||||||
@keyword('Generate wallet')
|
@keyword('Generate wallet')
|
||||||
def generate_wallet(wallet: str):
|
def generate_wallet(wallet: str):
|
||||||
cmd = ( f"{NEOGO_CLI_PREFIX} wallet create -w {wallet}" )
|
cmd = f"{NEOGO_CLI_EXEC} wallet create -w {wallet}"
|
||||||
|
|
||||||
logger.info(f"Executing command: {cmd}")
|
logger.info(f"Executing command: {cmd}")
|
||||||
p = pexpect.spawn(cmd)
|
p = pexpect.spawn(cmd)
|
||||||
p.expect(".*")
|
p.expect(".*")
|
||||||
|
@ -73,35 +68,25 @@ def generate_wallet(wallet: str):
|
||||||
|
|
||||||
@keyword('Dump Address')
|
@keyword('Dump Address')
|
||||||
def dump_address(wallet: str):
|
def dump_address(wallet: str):
|
||||||
address = ""
|
with open(wallet) as json_file:
|
||||||
cmd = ( f"{NEOGO_CLI_PREFIX} wallet dump -w {wallet}" )
|
data = json.load(json_file)
|
||||||
|
if len(data['accounts']) != 0:
|
||||||
logger.info(f"Executing command: {cmd}")
|
return data['accounts'][0]['address']
|
||||||
out = _run_sh(cmd)
|
|
||||||
logger.info(f"Command completed with output: {out}")
|
|
||||||
|
|
||||||
m = re.search(r'"address": "(\w+)"', out)
|
|
||||||
if m.start() != m.end():
|
|
||||||
address = m.group(1)
|
|
||||||
else:
|
else:
|
||||||
raise Exception("Can not get address.")
|
raise Exception("Can not get address.")
|
||||||
|
|
||||||
return address
|
|
||||||
|
|
||||||
@keyword('Dump PrivKey')
|
@keyword('Dump PrivKey')
|
||||||
def dump_privkey(wallet: str, address: str):
|
def dump_privkey(wallet: str, address: str):
|
||||||
cmd = ( f"{NEOGO_CLI_PREFIX} wallet export -w {wallet} --decrypt {address}" )
|
cmd = f"{NEOGO_CLI_EXEC} wallet export -w {wallet} --decrypt {address}"
|
||||||
|
|
||||||
logger.info(f"Executing command: {cmd}")
|
logger.info(f"Executing command: {cmd}")
|
||||||
out = _run_sh_with_passwd('', cmd)
|
out = _run_sh_with_passwd('', cmd)
|
||||||
logger.info(f"Command completed with output: {out}")
|
logger.info(f"Command completed with output: {out}")
|
||||||
|
|
||||||
return out
|
return out
|
||||||
|
|
||||||
@keyword('Transfer Mainnet Gas')
|
@keyword('Transfer Mainnet Gas')
|
||||||
def transfer_mainnet_gas(wallet: str, address: str, address_to: str, amount: int, wallet_pass:str=''):
|
def transfer_mainnet_gas(wallet: str, address: str, address_to: str, amount: int, wallet_pass:str=''):
|
||||||
cmd = (
|
cmd = (
|
||||||
f"{NEOGO_CLI_PREFIX} wallet nep17 transfer -w {wallet} "
|
f"{NEOGO_CLI_EXEC} wallet nep17 transfer -w {wallet} "
|
||||||
f"-r {NEO_MAINNET_ENDPOINT} --from {address} --to {address_to} "
|
f"-r {NEO_MAINNET_ENDPOINT} --from {address} --to {address_to} "
|
||||||
f"--token GAS --amount {amount}"
|
f"--token GAS --amount {amount}"
|
||||||
)
|
)
|
||||||
|
@ -118,7 +103,7 @@ def transfer_mainnet_gas(wallet: str, address: str, address_to: str, amount: int
|
||||||
@keyword('Withdraw Mainnet Gas')
|
@keyword('Withdraw Mainnet Gas')
|
||||||
def withdraw_mainnet_gas(wallet: str, address: str, scripthash: str, amount: int):
|
def withdraw_mainnet_gas(wallet: str, address: str, scripthash: str, amount: int):
|
||||||
cmd = (
|
cmd = (
|
||||||
f"{NEOGO_CLI_PREFIX} contract invokefunction -w {wallet} -a {address} "
|
f"{NEOGO_CLI_EXEC} contract invokefunction -w {wallet} -a {address} "
|
||||||
f"-r {NEO_MAINNET_ENDPOINT} {NEOFS_CONTRACT} withdraw {scripthash} "
|
f"-r {NEO_MAINNET_ENDPOINT} {NEOFS_CONTRACT} withdraw {scripthash} "
|
||||||
f"int:{amount} -- {scripthash}"
|
f"int:{amount} -- {scripthash}"
|
||||||
)
|
)
|
||||||
|
@ -163,7 +148,7 @@ def expected_mainnet_balance(address: str, expected: float):
|
||||||
|
|
||||||
@keyword('NeoFS Deposit')
|
@keyword('NeoFS Deposit')
|
||||||
def neofs_deposit(wallet: str, address: str, scripthash: str, amount: int, wallet_pass:str=''):
|
def neofs_deposit(wallet: str, address: str, scripthash: str, amount: int, wallet_pass:str=''):
|
||||||
cmd = ( f"{NEOGO_CLI_PREFIX} contract invokefunction -w {wallet} -a {address} "
|
cmd = ( f"{NEOGO_CLI_EXEC} contract invokefunction -w {wallet} -a {address} "
|
||||||
f"-r {NEO_MAINNET_ENDPOINT} {NEOFS_CONTRACT} "
|
f"-r {NEO_MAINNET_ENDPOINT} {NEOFS_CONTRACT} "
|
||||||
f"deposit {scripthash} int:{amount} bytes: -- {scripthash}")
|
f"deposit {scripthash} int:{amount} bytes: -- {scripthash}")
|
||||||
|
|
||||||
|
|
30
wallets/wallet.json
Normal file
30
wallets/wallet.json
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
{
|
||||||
|
"version": "3.0",
|
||||||
|
"accounts": [
|
||||||
|
{
|
||||||
|
"address": "NTrezR3C4X8aMLVg7vozt5wguyNfFhwuFx",
|
||||||
|
"key": "6PYWrvsPU47vJTeoLUht12pHUQunPBgaR7JEbx7MpuAuNP8CHHyH9hbqqk",
|
||||||
|
"label": "",
|
||||||
|
"contract": {
|
||||||
|
"script": "DCEDGmxvu98CyjUXRfqGubpalFLXhaxPf8K3VIyipGxPz0oLQZVEDXg=",
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"name": "parameter0",
|
||||||
|
"type": "Signature"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"deployed": false
|
||||||
|
},
|
||||||
|
"lock": false,
|
||||||
|
"isdefault": false
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"scrypt": {
|
||||||
|
"n": 16384,
|
||||||
|
"r": 8,
|
||||||
|
"p": 8
|
||||||
|
},
|
||||||
|
"extra": {
|
||||||
|
"Tokens": null
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue