Skip to content

Commit

Permalink
Added Testing Configs + Scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
tfn18001 committed Apr 22, 2022
1 parent b76461e commit df9396b
Show file tree
Hide file tree
Showing 16 changed files with 99 additions and 13 deletions.
4 changes: 3 additions & 1 deletion CTng/ctng.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (

// A little front end. Feel free to modify to suit our needs. :)
func main() {
helpText := "Usage: ./CTng [gossiper|monitor|logger] <public_config_file_path> <private_config_file_path> <crypto_config_path>\n"
helpText := "Usage: ./CTng [gossiper|monitor|logger|ca] <public_config_file_path> <private_config_file_path> <crypto_config_path>\n"
if len(os.Args) < 3 {
fmt.Println(helpText)
os.Exit(1)
Expand Down Expand Up @@ -54,6 +54,8 @@ func main() {
server.StartMonitorServer(&ctx)
case "logger":
fakeLogger.RunLogger(os.Args[2])
case "ca":
// fakeCA.runCA(os.Args[2])
default:
fmt.Println(helpText)
}
Expand Down
6 changes: 3 additions & 3 deletions CTng/gossiperTest.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#/bin/bash

go run . gossiper \
testData/gossiperConfigs/gossiper_pub_config.json \
testData/gossiperConfigs/$1/gossiper_priv_config.json \
testData/gossiperConfigs/$1/gossiperCrypto.json
testData/gossiperNetworkTest/gossiper_pub_config.json \
testData/gossiperNetworkTest/$1/gossiper_priv_config.json \
testData/gossiperNetworkTest/$1/gossiperCrypto.json
6 changes: 6 additions & 0 deletions CTng/monitorTest.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#/bin/bash

go run . monitor \
testData/monitorNetworkTest/gossiper_pub_config.json \
testData/monitorNetworkTest/$1/gossiper_priv_config.json \
testData/gossiperNetworkTest/$1/gossiperCrypto.json
1 change: 1 addition & 0 deletions CTng/testData/fakeCA/fakeCA.go
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
package fakeCA
4 changes: 2 additions & 2 deletions CTng/testData/gossiperNetworkTest/1/gossiper_priv_config.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"Crypto_config_path": "testData/gossiperConfigs/1/gossiperCrypto.json",
"Crypto_config_path": "testData/gossiperNetworkTest/1/gossiperCrypto.json",
"Connected_Gossipers": ["localhost:8081", "localhost:8082"],
"Owner_URL": "localhost:8079",
"Owner_URL": "localhost:8180",
"Port": "8080"
}
4 changes: 2 additions & 2 deletions CTng/testData/gossiperNetworkTest/2/gossiper_priv_config.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"Crypto_config_path": "testData/gossiperConfigs/2/gossiperCrypto.json",
"Crypto_config_path": "testData/gossiperNetworkTest/2/gossiperCrypto.json",
"Connected_Gossipers": ["localhost:8082", "localhost:8083"],
"Owner_URL": "localhost:8079",
"Owner_URL": "localhost:8181",
"Port": "8081"
}
4 changes: 2 additions & 2 deletions CTng/testData/gossiperNetworkTest/3/gossiper_priv_config.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"Crypto_config_path": "testData/gossiperConfigs/3/gossiperCrypto.json",
"Crypto_config_path": "testData/gossiperNetworkTest/3/gossiperCrypto.json",
"Connected_Gossipers": ["localhost:8083", "localhost:8080"],
"Owner_URL": "localhost:8079",
"Owner_URL": "localhost:8182",
"Port": "8082"
}
4 changes: 2 additions & 2 deletions CTng/testData/gossiperNetworkTest/4/gossiper_priv_config.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"Crypto_config_path": "testData/gossiperConfigs/4/gossiperCrypto.json",
"Crypto_config_path": "testData/gossiperNetworkTest/4/gossiperCrypto.json",
"Connected_Gossipers": ["localhost:8080", "localhost:8081"],
"Owner_URL": "localhost:8079",
"Owner_URL": "localhost:8183",
"Port": "8083"
}
24 changes: 24 additions & 0 deletions CTng/testData/gossiperNetworkTest/Readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Gossiper Network Test

These folders specify a test network of four gossipers.


### Connections
Gossiper Connections are as follows:
* 1 - 2,3
* 2 - 3,4
* 3 - 4,1
* 4 - 1,2

Each Gossiper connects to the corresponding monitor number in
monitorNetworkTest:
* 1-1
* 2-2
* 3-3
* 4-4

These servers are intended to provide a local test of all running components. The gossiper network can also be tested without monitors, although data must be sent manually + appropriately utilizing `client_test.go` to push data into gossiper 3.


### Running a gossiper
To run a gossiper, go to the root of this project and run `sh ./gossiperTest N` where N is the number of the gossiper you want to run. This runs ctng.go with the parameters from these test files.
4 changes: 3 additions & 1 deletion CTng/testData/gossiperNetworkTest/gossiper_pub_config.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,7 @@
"Expiration_time": 86400,
"Port": "22",
"Gossiper_URLs": ["localhost:8080","localhost:8081", "localhost:8082", "localhost:8083"],
"Signer_URLs": ["localhost:8080","localhost:8081", "localhost:8082","localhost:8083"]
"Signer_URLs": ["localhost:8080","localhost:8081", "localhost:8082","localhost:8083",
"localhost:9000","localhost:9001","localhost:9002","localhost:9003",
"localhost:9100","localhost:9101","localhost:9102","localhost:9103"]
}
7 changes: 7 additions & 0 deletions CTng/testData/monitorNetworkTest/1/monitor_priv_config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"Crypto_config_path": "testData/monitorNetworkTest/1/monitorCrypto.json",
"CA_URLs": ["192.168.1.1", "1.1.1.1", "255.255.255.255"],
"Logger_URLs": ["192.168.1.1", "1.1.1.1", "255.255.255.255"],
"Gossiper_URL": "localhost:8080",
"Port": "8180"
}
7 changes: 7 additions & 0 deletions CTng/testData/monitorNetworkTest/2/monitor_priv_config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"Crypto_config_path": "testData/monitorNetworkTest/2/monitorCrypto.json",
"CA_URLs": ["localhost:9101", "localhost:9102"],
"Logger_URLs": ["localhost:9001", "localhost:9002"],
"Gossiper_URL": "localhost:8081",
"Port": "8181"
}
7 changes: 7 additions & 0 deletions CTng/testData/monitorNetworkTest/3/monitor_priv_config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"Crypto_config_path": "testData/monitorNetworkTest/3/monitorCrypto.json",
"CA_URLs": ["localhost:9102", "localhost:9103"],
"Logger_URLs": ["localhost:9002", "localhost:9003"],
"Gossiper_URL": "localhost:8082",
"Port": "8182"
}
7 changes: 7 additions & 0 deletions CTng/testData/monitorNetworkTest/4/monitor_priv_config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"Crypto_config_path": "testData/monitorNetworkTest/4/monitorCrypto.json",
"CA_URLs": ["localhost:9100", "localhost:9101"],
"Logger_URLs": ["localhost:9001"],
"Gossiper_URL": "localhost:8083",
"Port": "8183"
}
15 changes: 15 additions & 0 deletions CTng/testData/monitorNetworkTest/Readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Monitor Network Configuration

Each monitor number is connected to its corresponding gossiper number

Monitors are responsible for the "FakeCAs" and "FakeLoggers" (see those folders for info) as follows:

* 1 - logger1,logger2,CA1
* 2 - logger2, logger3, CA2
* 3 - logger1, logger3, CA1, CA3
* 4 - logger2, CA2, CA3

### Running a monitor
Go to the root of this project and run `sh ./monitorTest.sh N` where N is the number of the monitor you want to run. This runs ctng.go with the parameters from these test files.

Then, in a seperate window, run `sh ./monitorTest.sh N` with the same N to launch the corresponding Monitor.
8 changes: 8 additions & 0 deletions CTng/testData/monitorNetworkTest/monitor_pub_config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"All_CA_URLs": ["localhost:9100", "localhost:9101", "localhost:9102"],
"All_Logger_URLs": ["localhost:9000", "localhost:9001", "localhost:9002"],
"Gossip_wait_time": 3,
"MMD": 15,
"MRD": 15,
"Http_vers": ["2","1","3"]
}

0 comments on commit df9396b

Please sign in to comment.