Skip to content

Commit

Permalink
Updated with MR changes
Browse files Browse the repository at this point in the history
  • Loading branch information
vvoluom committed Jun 19, 2020
1 parent 9505af5 commit a817c7a
Show file tree
Hide file tree
Showing 14 changed files with 98 additions and 100 deletions.
4 changes: 2 additions & 2 deletions docs/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
## 1.0.3
Released on June 2020
Released on 19th June 2020

### Added

Expand All @@ -23,7 +23,7 @@ Released on June 2020
#### Staking

* GetAccounts at /api/staking/accounts has been changed to GetAddresses at /api/staking/addresses
* GetAccountInfo at /api/staking/accountinfo has been changed to GetAccount at /api/staking/account and "ownerKey" query parameter has been changed to "address"
* GetAccountInfo at /api/staking/accountinfo has been changed to GetAccount at /api/staking/account, and "ownerKey" query parameter has been changed to "address"
* GetDelegations "ownerKey" query parameter has been changed to "address"
* GetDebondingDelegations "ownerKey" query parameter has been changed to "address"

Expand Down
2 changes: 1 addition & 1 deletion setup/setup_user_config_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def reset_section(section: str, cp: ConfigParser) -> None:
def setup_api_server(cp: ConfigParser) -> None:
print('==== API Server')
print('The API server makes the retrieval of Oasis nodes data possible. '
'Apart from the API server, Node Exporter also used to query '
'Apart from the API server, Node Exporter is also used to query '
'system data. During this setup process you will configure both.')

already_set_up = is_already_set_up(cp, 'api_server')
Expand Down
36 changes: 17 additions & 19 deletions src/handlers/consensus_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ func GetConsensusStateToGenesis(w http.ResponseWriter, r *http.Request) {
// Retrieving name of node from query request
nodeName := r.URL.Query().Get("name")
confirmation, socket := checkNodeName(nodeName)
if confirmation == false {
if !confirmation {

// Stop code here no need to establish connection and reply
json.NewEncoder(w).Encode(responses.ErrorResponse{
Expand All @@ -57,7 +57,7 @@ func GetConsensusStateToGenesis(w http.ResponseWriter, r *http.Request) {
// Stop code here no need to establish connection and reply
json.NewEncoder(w).Encode(responses.ErrorResponse{
Error: "Unexpected value found, height needs to be " +
"string of int!"})
"a string representing an int!"})
return
}

Expand Down Expand Up @@ -104,7 +104,7 @@ func GetEpoch(w http.ResponseWriter, r *http.Request) {
// Retrieving name of node from query request
nodeName := r.URL.Query().Get("name")
confirmation, socket := checkNodeName(nodeName)
if confirmation == false {
if !confirmation {

// Stop code here no need to establish connection and reply
json.NewEncoder(w).Encode(responses.ErrorResponse{
Expand All @@ -120,7 +120,7 @@ func GetEpoch(w http.ResponseWriter, r *http.Request) {
// Stop code here no need to establish connection and reply
json.NewEncoder(w).Encode(responses.ErrorResponse{
Error: "Unexpected value found, height needs to be " +
"string of int!"})
"a string representing an int!"})
return
}

Expand Down Expand Up @@ -167,7 +167,7 @@ func PingNode(w http.ResponseWriter, r *http.Request) {
// Retrieving name of node from query request
nodeName := r.URL.Query().Get("name")
confirmation, socket := checkNodeName(nodeName)
if confirmation == false {
if !confirmation {
lgr.Info.Println("Node name requested doesn't exist")
// Stop code here no need to establish connection and reply
json.NewEncoder(w).Encode(responses.ErrorResponse{
Expand Down Expand Up @@ -221,7 +221,7 @@ func GetBlock(w http.ResponseWriter, r *http.Request) {
// Retrieving name of node from query request
nodeName := r.URL.Query().Get("name")
confirmation, socket := checkNodeName(nodeName)
if confirmation == false {
if !confirmation {

// Stop code here no need to establish connection and reply
json.NewEncoder(w).Encode(responses.ErrorResponse{
Expand All @@ -237,7 +237,7 @@ func GetBlock(w http.ResponseWriter, r *http.Request) {
// Stop code here no need to establish connection and reply
json.NewEncoder(w).Encode(responses.ErrorResponse{
Error: "Unexpected value found, height needs to be " +
"string of int!"})
"a string representing an int!"})
return
}

Expand Down Expand Up @@ -269,8 +269,7 @@ func GetBlock(w http.ResponseWriter, r *http.Request) {
}

// Responding with retrieved block
lgr.Info.Println(
"Request at /api/consensus/block responding with Block!")
lgr.Info.Println("Request at /api/consensus/block responding with Block!")
json.NewEncoder(w).Encode(responses.BlockResponse{Blk: blk})
}

Expand All @@ -283,7 +282,7 @@ func GetStatus(w http.ResponseWriter, r *http.Request) {
// Retrieving name of node from query request
nodeName := r.URL.Query().Get("name")
confirmation, socket := checkNodeName(nodeName)
if confirmation == false {
if !confirmation {

// Stop code here no need to establish connection and reply
json.NewEncoder(w).Encode(responses.ErrorResponse{
Expand Down Expand Up @@ -319,8 +318,7 @@ func GetStatus(w http.ResponseWriter, r *http.Request) {
}

// Responding with retrieved block
lgr.Info.Println(
"Request at /api/consensus/status responding with Status!")
lgr.Info.Println("Request at /api/consensus/status responding with Status!")
json.NewEncoder(w).Encode(responses.StatusResponse{Status: status})
}

Expand All @@ -334,7 +332,7 @@ func GetGenesisDocument(w http.ResponseWriter, r *http.Request) {
// Retrieving name of node from query request
nodeName := r.URL.Query().Get("name")
confirmation, socket := checkNodeName(nodeName)
if confirmation == false {
if !confirmation {

// Stop code here no need to establish connection and reply
json.NewEncoder(w).Encode(responses.ErrorResponse{
Expand Down Expand Up @@ -386,7 +384,7 @@ func GetBlockHeader(w http.ResponseWriter, r *http.Request) {
// Retrieving name of node from query request
nodeName := r.URL.Query().Get("name")
confirmation, socket := checkNodeName(nodeName)
if confirmation == false {
if !confirmation {

// Stop code here no need to establish connection and reply
json.NewEncoder(w).Encode(responses.ErrorResponse{
Expand All @@ -402,7 +400,7 @@ func GetBlockHeader(w http.ResponseWriter, r *http.Request) {
// Stop code here no need to establish connection and reply
json.NewEncoder(w).Encode(responses.ErrorResponse{
Error: "Unexpected value found, height needs to be " +
"string of int!"})
"a string representing an int!"})
return
}

Expand Down Expand Up @@ -460,7 +458,7 @@ func GetBlockLastCommit(w http.ResponseWriter, r *http.Request) {
// Retrieving name of node from query request
nodeName := r.URL.Query().Get("name")
confirmation, socket := checkNodeName(nodeName)
if confirmation == false {
if !confirmation {

// Stop code here no need to establish connection and reply
json.NewEncoder(w).Encode(responses.ErrorResponse{
Expand All @@ -476,7 +474,7 @@ func GetBlockLastCommit(w http.ResponseWriter, r *http.Request) {
// Stop code here no need to establish connection and reply
json.NewEncoder(w).Encode(responses.ErrorResponse{
Error: "Unexpected value found, height needs to be " +
"string of int!"})
"a string representing an int!"})
return
}

Expand Down Expand Up @@ -568,7 +566,7 @@ func GetTransactions(w http.ResponseWriter, r *http.Request) {
// Retrieving name of node from query request
nodeName := r.URL.Query().Get("name")
confirmation, socket := checkNodeName(nodeName)
if confirmation == false {
if !confirmation {

// Stop code here no need to establish connection and reply
json.NewEncoder(w).Encode(responses.ErrorResponse{
Expand All @@ -584,7 +582,7 @@ func GetTransactions(w http.ResponseWriter, r *http.Request) {
// Stop code here no need to establish connection and reply
json.NewEncoder(w).Encode(responses.ErrorResponse{
Error: "Unexpected value found, height needs to be " +
"string of int!"})
"a string representing an int!"})
return
}

Expand Down
12 changes: 6 additions & 6 deletions src/handlers/consensus_handler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ func Test_GetConsensusStateToGenesis_InvalidHeight(t *testing.T) {
status, http.StatusOK)
}

expected := `{"error":"Unexpected value found, height needs to be string of int!"}`
expected := `{"error":"Unexpected value found, height needs to be a string representing an int!"}`

if strings.TrimSpace(rr.Body.String()) != strings.TrimSpace(expected) {
t.Errorf("handler returned unexpected body: got %v want %v",
Expand Down Expand Up @@ -180,7 +180,7 @@ func Test_GetEpoch_InvalidHeight(t *testing.T) {
status, http.StatusOK)
}

expected := `{"error":"Unexpected value found, height needs to be string of int!"}`
expected := `{"error":"Unexpected value found, height needs to be a string representing an int!"}`

if strings.TrimSpace(rr.Body.String()) != strings.TrimSpace(expected) {
t.Errorf("handler returned unexpected body: got %v want %v",
Expand Down Expand Up @@ -257,7 +257,7 @@ func Test_GetBlock_InvalidHeight(t *testing.T) {
status, http.StatusOK)
}

expected := `{"error":"Unexpected value found, height needs to be string of int!"}`
expected := `{"error":"Unexpected value found, height needs to be a string representing an int!"}`

if strings.TrimSpace(rr.Body.String()) != strings.TrimSpace(expected) {
t.Errorf("handler returned unexpected body: got %v want %v",
Expand Down Expand Up @@ -336,7 +336,7 @@ func Test_GetBlockHeader_InvalidHeight(t *testing.T) {
status, http.StatusOK)
}

expected := `{"error":"Unexpected value found, height needs to be string of int!"}`
expected := `{"error":"Unexpected value found, height needs to be a string representing an int!"}`

if strings.TrimSpace(rr.Body.String()) != strings.TrimSpace(expected) {
t.Errorf("handler returned unexpected body: got %v want %v",
Expand Down Expand Up @@ -415,7 +415,7 @@ func Test_GetBlockLastCommit_InvalidHeight(t *testing.T) {
status, http.StatusOK)
}

expected := `{"error":"Unexpected value found, height needs to be string of int!"}`
expected := `{"error":"Unexpected value found, height needs to be a string representing an int!"}`

if strings.TrimSpace(rr.Body.String()) != strings.TrimSpace(expected) {
t.Errorf("handler returned unexpected body: got %v want %v",
Expand Down Expand Up @@ -494,7 +494,7 @@ func Test_GetTransactions_InvalidHeight(t *testing.T) {
status, http.StatusOK)
}

expected := `{"error":"Unexpected value found, height needs to be string of int!"}`
expected := `{"error":"Unexpected value found, height needs to be a string representing an int!"}`

if strings.TrimSpace(rr.Body.String()) != strings.TrimSpace(expected) {
t.Errorf("handler returned unexpected body: got %v want %v",
Expand Down
2 changes: 1 addition & 1 deletion src/handlers/node_controller_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ func GetIsSynced(w http.ResponseWriter, r *http.Request) {
// Retrieving name of node from query request
nodeName := r.URL.Query().Get("name")
confirmation, socket := checkNodeName(nodeName)
if confirmation == false {
if !confirmation {

// Stop code here no need to establish connection and reply
json.NewEncoder(w).Encode(responses.ErrorResponse{
Expand Down
4 changes: 2 additions & 2 deletions src/handlers/node_exporter_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ func NodeExporterQueryGauge(w http.ResponseWriter, r *http.Request) {

//Get Node Exporter Metrics URl
confirmation, exporterConfig := getNodeExporter()
if confirmation == false {
if !confirmation {

// Stop the code here no need to establish connection and reply
json.NewEncoder(w).Encode(responses.ErrorResponse{
Expand Down Expand Up @@ -101,7 +101,7 @@ func NodeExporterQueryCounter(w http.ResponseWriter, r *http.Request) {

//Get Node Exporter Metrics URl
confirmation, exporterConfig := getNodeExporter()
if confirmation == false {
if !confirmation {

// Stop the code here no need to establish connection and reply
json.NewEncoder(w).Encode(responses.ErrorResponse{
Expand Down
4 changes: 2 additions & 2 deletions src/handlers/prometheus_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ func PrometheusQueryGauge(w http.ResponseWriter, r *http.Request) {
// Retrieving name of node from query request
nodeName := r.URL.Query().Get("name")
confirmation, prometheusConfig := checkNodeNamePrometheus(nodeName)
if confirmation == false {
if !confirmation {

// Stop code here no need to establish connection and reply
json.NewEncoder(w).Encode(responses.ErrorResponse{
Expand Down Expand Up @@ -105,7 +105,7 @@ func PrometheusQueryCounter(w http.ResponseWriter, r *http.Request) {
// Retrieving name of node from query request
nodeName := r.URL.Query().Get("name")
confirmation, prometheusConfig := checkNodeNamePrometheus(nodeName)
if confirmation == false {
if !confirmation {

// Stop code here no need to establish connection and reply
json.NewEncoder(w).Encode(responses.ErrorResponse{
Expand Down
Loading

0 comments on commit a817c7a

Please sign in to comment.