Esempio n. 1
0
 def test_check_ord(self, mock_get_pod, mock_sleep):
     mock_pod_ex = mock.Mock()
     mock_pod_ex.logs.side_effect = [
         'Not yet started', 'Not yet started\nStarting orderer'
     ]
     mock_get_pod.side_effect = [mock_pod_ex]
     check_ord('a-namespace', 'a-release')
     assert mock_pod_ex.logs.call_count == 2
     mock_sleep.assert_called_once_with(15)
Esempio n. 2
0
 def test_check_ord_again(self, mock_get_pod, mock_sleep):
     mock_pod_ex = Mock()
     mock_pod_ex.logs.side_effect = [
         "Not yet started\nStarting orderer\nOrderer fetching metadata for all topics from broker"
     ]
     mock_get_pod.side_effect = [mock_pod_ex]
     check_ord("a-namespace", "a-release", verbose=True)
     assert mock_pod_ex.logs.call_count == 1
     mock_sleep.assert_not_called()
Esempio n. 3
0
 def test_check_ord(self, mock_get_pod, mock_sleep):
     mock_pod_ex = Mock()
     mock_pod_ex.logs.side_effect = [
         "Not yet started",
         "Not yet started\nStarting orderer",
     ]
     mock_get_pod.side_effect = [mock_pod_ex]
     check_ord("a-namespace", "a-release")
     assert mock_pod_ex.logs.call_count == 2
     mock_sleep.assert_called_once_with(15)
Esempio n. 4
0
def upgrade_charts(opts, node_type, verbose=False):
    # Get chart type
    chart = NODE_MAPPER[node_type]
    node_namespace = get_namespace(opts, opts[node_type + 's']['msp'])
    for release in opts[node_type + 's']['names']:
        pod_ex = get_pod(node_namespace, release, chart)
        res = pod_ex.execute('ls /var/hyperledger/msp_old')
        if not res:
            pod_ex.execute('mv /var/hyperledger/msp /var/hyperledger/msp_old')
        else:
            print('/var/hyperledger/msp_old already exists')
        config_yaml = '{dir}/{chart}/{name}.yaml'.format(
                         dir=opts['core']['dir_values'], chart=chart, name=release)
        helm_upgrade(opts['core']['chart_repo'], chart, release, node_namespace,
                     config_yaml=config_yaml,
                     verbose=verbose)
        if node_type == 'orderer':
            check_ord(node_namespace, release, verbose=verbose)
        elif node_type == 'peer':
            check_peer(node_namespace, release, verbose=verbose)