def test_setup_ca_upgrade( self, mock_ca_chart, mock_ca_enroll, mock_check_ca, mock_get_pod, mock_ingress_read, ): mock_get_pod.side_effect = [self.root_executer, self.int_executer] mock_ingress_read.side_effect = [ApiException, ["an-ingress"]] setup_ca(self.OPTS, upgrade=True) mock_ca_chart.assert_has_calls([ call(opts=self.OPTS, release="root-ca", upgrade=True), call(opts=self.OPTS, release="int-ca", upgrade=True), ]) mock_get_pod.assert_has_calls([ call(namespace="root-namespace", release="root-ca", app="hlf-ca"), call(namespace="int-namespace", release="int-ca", app="hlf-ca"), ]) mock_ca_enroll.assert_has_calls( [call(self.root_executer), call(self.int_executer)]) mock_ingress_read.assert_has_calls([ call("root-ca-hlf-ca", namespace="root-namespace"), call("int-ca-hlf-ca", namespace="int-namespace"), ]) mock_check_ca.assert_called_once_with(ingress_host="an-ingress", cacert="./ca_cert.pem")
def runner_ca(opts, upgrade=False): """Deploy CAs. Args: opts (dict): Nephos options dict. upgrade (bool): Do we upgrade the deployment? False by default. """ if opts["cas"]: setup_ca(opts, upgrade=upgrade) else: logging.warning("No CAs defined in Nephos settings, ignoring CA setup")
def runner_ca(opts, upgrade=False, verbose=False): """Deploy CAs. Args: opts (dict): Nephos options dict. upgrade (bool): Do we upgrade the deployment? False by default. verbose (bool): Verbosity. False by default. """ if opts["cas"]: setup_ca(opts, upgrade=upgrade, verbose=verbose) else: print("No CAs defined in Nephos settings, ignoring CA setup")
def fabric(ctx): # pragma: no cover opts = load_config(ctx.obj['settings_file']) # Setup CA setup_ca(opts, upgrade=ctx.obj['upgrade'], verbose=ctx.obj['verbose']) # Crypto material admin_msp(opts, opts['orderers']['msp'], verbose=ctx.obj['verbose']) admin_msp(opts, opts['peers']['msp'], verbose=ctx.obj['verbose']) genesis_block(opts, verbose=ctx.obj['verbose']) channel_tx(opts, verbose=ctx.obj['verbose']) setup_nodes(opts, 'orderer', verbose=ctx.obj['verbose']) setup_nodes(opts, 'peer', verbose=ctx.obj['verbose']) # Orderers setup_ord(opts, upgrade=ctx.obj['upgrade'], verbose=ctx.obj['verbose']) # Peers setup_peer(opts, upgrade=ctx.obj['upgrade'], verbose=ctx.obj['verbose']) setup_channel(opts, verbose=ctx.obj['verbose'])
def test_setup_ca_upgrade(self, mock_ca_chart, mock_ca_enroll, mock_check_ca, mock_get_pod, mock_ingress_read): mock_get_pod.side_effect = [self.root_executer, self.int_executer] mock_ingress_read.side_effect =[ApiException, ['an-ingress']] setup_ca(self.OPTS, upgrade=True, verbose=True) mock_ca_chart.assert_has_calls([ call(opts=self.OPTS, release='root-ca', upgrade=True, verbose=True), call(opts=self.OPTS, release='int-ca', upgrade=True, verbose=True), ]) mock_get_pod.assert_has_calls([ call(namespace='root-namespace', release='root-ca', app='hlf-ca', verbose=True), call(namespace='int-namespace', release='int-ca', app='hlf-ca', verbose=True) ]) mock_ca_enroll.assert_has_calls([ call(self.root_executer), call(self.int_executer) ]) mock_ingress_read.assert_has_calls([ call('root-ca-hlf-ca', namespace='root-namespace', verbose=True), call('int-ca-hlf-ca', namespace='int-namespace', verbose=True) ]) mock_check_ca.assert_called_once_with(ingress_host='an-ingress', verbose=True)
def ca(ctx): # pragma: no cover opts = load_config(ctx.obj['settings_file']) setup_ca(opts, upgrade=ctx.obj['upgrade'], verbose=ctx.obj['verbose'])