Skip to content

Commit

Permalink
Debug un reported test case
Browse files Browse the repository at this point in the history
  • Loading branch information
anupama2501 committed Dec 26, 2024
1 parent 7aeea53 commit e9145e1
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -479,13 +479,13 @@ node {
} catch(err) {
echo "Post upgrade $it had failures: " + err
}
sh "./${qaseRun} --startRun=false"
}

parallel jobs
} catch(err){
echo "Post upgrade tests had failures: " + err
}
sh "./${qaseRun} --startRun=false"
}
stage('Delete Rancher and resources') {
if (cleanup.toBoolean()) {
Expand Down
21 changes: 20 additions & 1 deletion tests/v2/validation/pipeline/qase/reporter/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,9 @@ func main() {
}

err = reportTestQases(client, runID)

if err != nil {
logrus.Info("Error getting the test case report.")
logrus.Error("error reporting: ", err)
}
}
Expand Down Expand Up @@ -91,6 +93,8 @@ func getAllAutomationTestCases(client *qase.APIClient) (map[string]qase.TestCase

func readTestCase() ([]testcase.GoTestOutput, error) {
file, err := os.Open(testResultsJSON)

logrus.Info("Printing the testResultsJson", file)
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -157,6 +161,8 @@ func parseCorrectTestCases(testCases []testcase.GoTestOutput) map[string]*testca

func reportTestQases(client *qase.APIClient, testRunID int64) error {
tempTestCases, err := readTestCase()

logrus.Info("Printing the tempTestCases", tempTestCases)
if err != nil {
return nil
}
Expand All @@ -173,28 +179,35 @@ func reportTestQases(client *qase.APIClient, testRunID int64) error {
if testQase, ok := qaseTestCases[goTestCase.Name]; ok {
// update test status
err = updateTestInRun(client, *goTestCase, testQase.Id, testRunID)

if err != nil {
logrus.Info("Test case not found in test run")
return err
}

if goTestCase.Status == failStatus {
resultTestMap = append(resultTestMap, goTestCase)
}
logrus.Info("Updated test in run")
} else {
// write test case
caseID, err := writeTestCaseToQase(client, *goTestCase)
logrus.Info(" Updated test run step1 ")

if err != nil {
return err
}

err = updateTestInRun(client, *goTestCase, caseID.Result.Id, testRunID)
logrus.Info(" Updated test run")
if err != nil {
return err
}

if goTestCase.Status == failStatus {
resultTestMap = append(resultTestMap, goTestCase)
}

}
}
resp, _, err := client.RunsApi.GetRun(context.TODO(), qasedefaults.RancherManagerProjectID, int32(testRunID))
Expand Down Expand Up @@ -277,6 +290,7 @@ func updateTestInRun(client *qase.APIClient, testCase testcase.GoTestCase, qaseT
var err error
elapsedTime, err = strconv.ParseFloat(testCase.Elapsed, 64)
if err != nil {
logrus.Info("elapsedtime error", err)
return err
}
}
Expand All @@ -288,8 +302,13 @@ func updateTestInRun(client *qase.APIClient, testCase testcase.GoTestCase, qaseT
Time: int64(elapsedTime),
}

_, _, err := client.ResultsApi.CreateResult(context.TODO(), resultBody, qasedefaults.RancherManagerProjectID, testRunID)
inlineResponse, httpResponse, err := client.ResultsApi.CreateResult(context.TODO(), resultBody, qasedefaults.RancherManagerProjectID, testRunID)
logrus.Info("This the result body", resultBody)
logrus.Info("Inline response", inlineResponse)
logrus.Info("http response", httpResponse)

if err != nil {
logrus.Info("Error creating result", err)
return err
}

Expand Down

0 comments on commit e9145e1

Please sign in to comment.