Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add mainnet to environements #42

Merged
merged 3 commits into from
Nov 25, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions tests/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,19 @@ def test_command_start_init_testnet(runner, tmn):
_clean(tmn)


def test_command_start_init_mainnet(runner, tmn):
result = runner.invoke(tmn.main, [
'start', '--name', 'test1', '--net',
'mainnet', '--pkey',
'0123456789012345678901234567890123456789012345678901234567890123'
])
lines = result.output.splitlines()
assert 'Starting masternode test1:' in lines
for line in lines:
assert '✗' not in line
_clean(tmn)


def test_command_start_init_invalid_name(runner, tmn):
result = runner.invoke(tmn.main, [
'start', '--name', 'tes', '--net', 'devnet', '--pkey', '1234'])
Expand Down Expand Up @@ -238,3 +251,17 @@ def test_command_update(runner, tmn):
for line in lines:
assert '✗' not in line
_clean(tmn)


def test_command_remove(runner, tmn):
runner.invoke(tmn.main, [
'start', '--name', 'test1', '--net',
'devnet', '--pkey',
'0123456789012345678901234567890123456789012345678901234567890123'
])
result = runner.invoke(tmn.main, ['remove', '--confirm'])
lines = result.output.splitlines()
assert 'Removing masternode test1:' in lines
for line in lines:
assert '✗' not in line
_clean(tmn)
7 changes: 6 additions & 1 deletion tmn/configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,12 @@ def _compose(self) -> None:
name='{}_chaindata'.format(self.name),
client=self.client
)
tag = 'testnet' if self.net == 'testnet' else 'latest'
if self.net == 'mainnet':
tag = 'stable'
elif self.net == 'testnet':
tag = 'testnet'
else:
tag = 'latest'
self.services['metrics'] = Service(
name='{}_metrics'.format(self.name),
hostname='{}'.format(self.id),
Expand Down
23 changes: 23 additions & 0 deletions tmn/environments.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,27 @@
environments = {
'mainnet': {
'tomochain': {
'BOOTNODES': (
'enode://97f0ca95a653e3c44d5df2674e19e9324ea4bf4d47a46b1d8560f'
'3ed4ea328f725acec3fcfcb37eb11706cf07da669e9688b091f1543f89b24'
'25700a68bc8876@104.248.98.78:30301,enode://b72927f349f3a27b78'
'9d0ca615ffe3526f361665b496c80e7cc19dace78bd94785fdadc270054ab'
'727dbb172d9e3113694600dd31b2558dd77ad85a869032dea@188.166.207'
'.189:30301,enode://c8f2f0643527d4efffb8cb10ef9b6da4310c5ac9f2'
'e988a7f85363e81d42f1793f64a9aa127dbaff56b1e8011f90fe9ff57fa02'
'a36f73220da5ff81d8b8df351@104.248.98.60:30301'
),
'NETSTATS_HOST': 'stats.tomochain.com',
'NETSTATS_PORT': '443',
'NETWORK_ID': '88',
'WS_SECRET': (
'getty-site-pablo-auger-room-sos-blair-shin-whiz-delhi'
)
},
'metrics': {
'METRICS_ENDPOINT': 'https://metrics.tomochain.com'
}
},
'testnet': {
'tomochain': {
'BOOTNODES': (
Expand Down
2 changes: 1 addition & 1 deletion tmn/tmn.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def docs() -> None:

@click.command(help='Start your TomoChain masternode')
@click.option('--name', metavar='NAME', help='Your masternode\'s name')
@click.option('--net', type=click.Choice(['testnet', 'devnet']),
@click.option('--net', type=click.Choice(['mainnet', 'testnet', 'devnet']),
help='The environment your masternode will connect to')
@click.option('--pkey', metavar='KEY', help=('Private key of the account your '
'masternode will collect rewards '
Expand Down