Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added automated-perf-test.exe
Binary file not shown.
16 changes: 10 additions & 6 deletions uiServices/src/testCaseServices.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,15 @@ import (
"encoding/json"
"encoding/xml"
"fmt"
"github.com/Sirupsen/logrus"
"github.com/go-chi/chi"
"github.com/xtracdev/automated-perf-test/testStrategies"
"io/ioutil"
"net/http"
"os"
"path/filepath"
"strings"

"github.com/Sirupsen/logrus"
"github.com/go-chi/chi"
"github.com/xtracdev/automated-perf-test/testStrategies"
)

const testCaseSchema string = "testCase_schema.json"
Expand Down Expand Up @@ -150,19 +151,22 @@ func getAllTestCases(rw http.ResponseWriter, req *http.Request) {

file, err := os.Open(fmt.Sprintf("%s%s", testCasePathDir, filename))
if err != nil {
logrus.Error("Cannot Open File: " + filename)
logrus.Error("File not found: " + filename)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it not be better to say something like:
logrus.Error("Error opening the file: ", err )
I would also add the error as in example.

rw.WriteHeader(http.StatusNotFound)
continue
}

byteValue, err := ioutil.ReadAll(file)
if err != nil {
logrus.Error("Cannot Read File: " + filename)
logrus.Error("An error has occured : " + filename)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

log the error. this will help with debugging the issue.

rw.WriteHeader(http.StatusInternalServerError)
continue
}

err = xml.Unmarshal(byteValue, testCase)
if err != nil {
logrus.Error("Cannot Unmarshall File: " + filename)
logrus.Error("Bad request: " + filename)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

log the error. this will help with debugging the issue.

rw.WriteHeader(http.StatusBadRequest)
continue
}

Expand Down
9 changes: 6 additions & 3 deletions uiServices/src/testSuiteServices.go
Original file line number Diff line number Diff line change
Expand Up @@ -245,17 +245,20 @@ func getAllTestSuites(rw http.ResponseWriter, req *http.Request) {

file, err := os.Open(fmt.Sprintf("%s%s", testSuitePathDir, filename))
if err != nil {
logrus.Error("Cannot open file: ", filename)
logrus.Error("File not found: ", filename)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

log the error. this will help with debugging the issue.

rw.WriteHeader(http.StatusNotFound)
}

byteValue, err := ioutil.ReadAll(file)
if err != nil {
logrus.Error("Cannot Read File: ", filename)
logrus.Error("An error has occured: ", filename)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

log the error. this will help with debugging the issue.

rw.WriteHeader(http.StatusInternalServerError)
}

err = xml.Unmarshal(byteValue, testSuite)
if err != nil {
logrus.Error("Cannot Unmarshall: ", filename)
logrus.Error("Bad request: ", filename)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

log the error. this will help with debugging the issue.

rw.WriteHeader(http.StatusBadRequest)

}

Expand Down