diff --git a/sphinx/source/quickstart/index.rst b/sphinx/source/quickstart/index.rst index 6f87cb30a4..6f895873b5 100644 --- a/sphinx/source/quickstart/index.rst +++ b/sphinx/source/quickstart/index.rst @@ -8,7 +8,7 @@ Once this is done, you can quickly spin up a CCF network and start :ref:`issuing .. code-block:: bash $ cd CCF/build - $ ../start_test_network.sh ./liblogging.enclave.so.signed + $ ../start_test_network.sh --package ./liblogging.enclave.so.signed Setting up Python environment... Python environment successfully setup [2019-10-29 14:47:41.562] Starting 3 CCF nodes... diff --git a/sphinx/source/users/deploy_app.rst b/sphinx/source/users/deploy_app.rst index 35520d3600..dffd81fe2e 100644 --- a/sphinx/source/users/deploy_app.rst +++ b/sphinx/source/users/deploy_app.rst @@ -10,7 +10,7 @@ For example, deploying the ``liblogging`` example application: .. code-block:: bash $ cd CCF/build - $ ../start_test_network.sh ./liblogging.enclave.so.signed + $ ../start_test_network.sh --package ./liblogging.enclave.so.signed Setting up Python environment... Python environment successfully setup [2019-10-29 14:47:41.562] Starting 3 CCF nodes... @@ -22,7 +22,7 @@ For example, deploying the ``liblogging`` example application: [2019-10-29 14:48:12.138] See https://microsoft.github.io/CCF/users/issue_commands.html for more information. [2019-10-29 14:48:12.138] Press Ctrl+C to shutdown the network. -.. note:: To use CCF `virtual` mode, the same command can be run with ``TEST_ENCLAVE=virtual`` set as environment variable and the virtual version of the enclave application passed to the script. For example ``$ TEST_ENCLAVE=virtual ../start_test_network.sh ./liblogging.virtual.so``. +.. note:: To use CCF `virtual` mode, the same command can be run with ``TEST_ENCLAVE=virtual`` set as environment variable and the virtual version of the enclave application passed to the script. For example ``$ TEST_ENCLAVE=virtual ../start_test_network.sh --package ./liblogging.virtual.so``. The log files (``out`` and ``err``) and ledger (``.ledger``) for each CCF node can be found under ``CCF/build/workspace/test_network_``. diff --git a/start_test_network.sh b/start_test_network.sh index 375cb6ba99..a09425cfe8 100755 --- a/start_test_network.sh +++ b/start_test_network.sh @@ -4,14 +4,6 @@ set -e -if [ -z "$1" ]; then - echo "The application enclave file should be specified (e.g. liblogging)" - exit 1 -fi - -PACKAGE="$1" -shift - echo "Setting up Python environment..." if [ ! -f "env/bin/activate" ] then @@ -24,4 +16,8 @@ PATH_HERE=$(dirname "$(realpath -s "$0")") pip install -q -U -r "${PATH_HERE}"/tests/requirements.txt echo "Python environment successfully setup" -CURL_CLIENT=ON python "${PATH_HERE}"/tests/start_network.py --package "${PACKAGE}" --label test_network "$@" \ No newline at end of file +CURL_CLIENT=ON \ + python "${PATH_HERE}"/tests/start_network.py \ + --gov-script "${PATH_HERE}"/src/runtime_config/gov.lua \ + --label test_network \ + "$@" \ No newline at end of file diff --git a/tests/K6.md b/tests/K6.md index 9d52544c2f..ab08e052a0 100644 --- a/tests/K6.md +++ b/tests/K6.md @@ -9,7 +9,7 @@ Running K6 against CCF 1. Start CCF, eg. ``` -$ ../start_test_network.sh liblogging.enclave.so.signed +$ ../start_test_network.sh --package ./liblogging.enclave.so.signed ... [2020-02-14 11:26:46.525] Started CCF network with the following nodes: [2020-02-14 11:26:46.525] Node [ 0] = 127.37.160.46:40523 diff --git a/tests/infra/ccf.py b/tests/infra/ccf.py index d43b024d15..ffd73f5044 100644 --- a/tests/infra/ccf.py +++ b/tests/infra/ccf.py @@ -210,21 +210,26 @@ class Network: return primary - def _setup_common_folder(self): + def _setup_common_folder(self, gov_script): LOG.info(f"Creating common folder: {self.common_dir}") cmd = ["rm", "-rf", self.common_dir] - infra.proc.ccall(*cmd) + assert ( + infra.proc.ccall(*cmd).returncode == 0 + ), f"Could not remove {self.common_dir} directory" cmd = ["mkdir", "-p", self.common_dir] - infra.proc.ccall(*cmd) + assert ( + infra.proc.ccall(*cmd).returncode == 0 + ), f"Could not create {self.common_dir} directory" + cmd = ["cp", gov_script, self.common_dir] + assert ( + infra.proc.ccall(*cmd).returncode == 0 + ), f"Could not copy governance {gov_script} to {self.common_dir}" # It is more convenient to create a symlink in the common directory than generate # certs and keys in the top directory and move them across - cmd = [ - "ln", - "-s", - os.path.join(os.getcwd(), self.KEY_GEN), - os.path.join(self.common_dir, self.KEY_GEN), - ] - infra.proc.ccall(*cmd) + cmd = ["ln", "-s", os.path.join(os.getcwd(), self.KEY_GEN), self.common_dir] + assert ( + infra.proc.ccall(*cmd).returncode == 0 + ), f"Could not symlink {self.KEY_GEN} to {self.common_dir}" def start_and_join(self, args): """ @@ -233,7 +238,7 @@ class Network: :param open_network: If false, only the nodes are started. """ self.common_dir = get_common_folder_name(args.workspace, args.label) - self._setup_common_folder() + self._setup_common_folder(args.gov_script) initial_members = list(range(max(1, args.initial_member_count))) self.consortium = infra.consortium.Consortium( diff --git a/tests/infra/remote.py b/tests/infra/remote.py index f8aa4ccc00..0f7c893605 100644 --- a/tests/infra/remote.py +++ b/tests/infra/remote.py @@ -625,7 +625,7 @@ class CCFRemote(object): cmd += [f"--member-info={mc},{mk}"] data_files.append(mc) data_files.append(mk) - data_files += [gov_script] + data_files += [os.path.basename(gov_script)] elif start_type == StartType.join: cmd += [ "join",