Skip to content

Commit cb84fa5

Browse files
author
Akash Goyal
authored
Merge pull request #2800 from itsmeakashgoyal/akgoyal/adding_example_demo
Added osexample python script and apollo test to run in CI
2 parents 9f834e6 + 107275a commit cb84fa5

File tree

7 files changed

+499
-31
lines changed

7 files changed

+499
-31
lines changed

examples/CMakeLists.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,9 @@ add_custom_command(TARGET copy_tran_sign_keys_script
1919
add_custom_target(copy_msgConfig_dir ALL COMMENT "Copying msg-configs directory")
2020
add_custom_command(TARGET copy_msgConfig_dir
2121
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/msg-configs ${CMAKE_CURRENT_BINARY_DIR}/msg-configs)
22+
23+
# Fill in CMAKE variables in the python wrapper
24+
configure_file (
25+
"${CMAKE_CURRENT_SOURCE_DIR}/scripts/test_osexample.py.in"
26+
"${CMAKE_CURRENT_BINARY_DIR}/scripts/test_osexample.py"
27+
)

examples/README.md

Lines changed: 8 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -58,48 +58,29 @@ make
5858

5959
## Run Example/Demo
6060
This simple example can be run from the script [test_osexample.sh](scripts/test_osexample.sh) under `example/script` directory.
61+
Or, it can be directly run from python script [test_osexample.py](scripts/test_osexample.py.in).
6162

6263

6364
### Simple scenario (4 replicas and 1 client)
6465
This demo can be run from inside the container once the build is finished.
6566

66-
Run the [test_osexample.sh](scripts/test_osexample.sh) script from the container's `build/example/scripts` directory.
67+
* Run the [test_osexample.sh](scripts/test_osexample.sh) script from the container's `build/example/scripts` directory.
6768
```sh
6869
./test_osexample.sh
6970
```
71+
* Run the [test_osexample.py](scripts/test_osexample.py.in) script from the container's `build/example/scripts` directory with default commandline arguments `-bft n=4,cl=1`, where n is number of replicas and cl is number of client.
72+
It is a configurable script which can be configured according to the need.
73+
```sh
74+
./test_osexample.py -bft n=4,cl=1
75+
```
7076

7177

7278
#### Explanation of the [test_osexample.sh](scripts/test_osexample.sh)
73-
On our example, we will use the script [test_osexample.sh](scripts/test_osexample.sh) and this script is used for following things,
79+
On our example, we will use the script [test_osexample.py](scripts/test_osexample.py.in) and this script is used for following things,
7480
* It is used to generate the keys for replica's. For more [refer](../tools/README.md)
75-
```
76-
$scriptdir/../../tools/GenerateConcordKeys -f 1 -n 4 -o replica_keys_
77-
```
78-
7981
* It is used to generate TLS certificates used in for TLSTCP communication which we are using as a default mode of communication. For more [refer](../scripts/linux/create_tls_certs.sh)
80-
```
81-
# Generate TLS certificates
82-
$scriptdir/create_tls_certs.sh 10
83-
```
84-
8582
* Running multiple replica's. Here we are running 4 replica's.
86-
```
87-
# run 4 replica's with unique replica id's
88-
echo "Running replica 1..."
89-
$scriptdir/../replica/test_replica -i 0 -a $scriptdir/replica_conf &
90-
echo "Running replica 2..."
91-
$scriptdir/../replica/test_replica -i 1 -a $scriptdir/replica_conf &
92-
echo "Running replica 3..."
93-
$scriptdir/../replica/test_replica -i 2 -a $scriptdir/replica_conf &
94-
echo "Running replica 4..."
95-
$scriptdir/../replica/test_replica -i 3 -a $scriptdir/replica_conf &
96-
```
97-
9883
* Running client
99-
```
100-
time $scriptdir/../client/test_client -f 1 -c 0 -i 4 -r 4 -e 0 -m $scriptdir/../msg-configs/msg-1
101-
```
102-
10384
* For resources cleanup.
10485

10586

examples/client/src/MessageSender.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ void MessageSender::sendWriteRequest(bft::client::Msg& msg) {
147147
msgConsumer_->deserialize(rep, false);
148148

149149
} catch (std::exception& e) {
150-
LOG_WARN(getLogger(), "error while initiating bft request " << e.what());
150+
LOG_WARN(getLogger(), "error while initiating bft write request " << e.what());
151151
}
152152
}
153153

@@ -170,6 +170,6 @@ void MessageSender::sendReadRequest(bft::client::Msg& msg) {
170170
msgConsumer_->deserialize(rep, true);
171171

172172
} catch (std::exception& e) {
173-
LOG_WARN(getLogger(), "error while initiating bft request " << e.what());
173+
LOG_WARN(getLogger(), "error while initiating bft read request " << e.what());
174174
}
175175
}

0 commit comments

Comments
 (0)