-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: send graphql request to update report with coverage data #176
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: Akash Kumar <[email protected]>
@@ -552,6 +551,11 @@ public static void runTests(String jarPath, RunOptions runOptions) { | |||
if (appErr != null) { | |||
throw new AssertionError("error stopping user application: " + appErr); | |||
} | |||
|
|||
Boolean updateReportResult = udpateReportWithCoverage(testRunId, testSet); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [checkstyle] <com.puppycrawl.tools.checkstyle.checks.sizes.LineLengthCheck> reported by reviewdog 🐶
Line is longer than 80 characters (found 90).
|
||
Boolean updateReportResult = udpateReportWithCoverage(testRunId, testSet); | ||
if (!updateReportResult) { | ||
throw new AssertionError("error updating report with coverage data"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [checkstyle] <com.puppycrawl.tools.checkstyle.checks.sizes.LineLengthCheck> reported by reviewdog 🐶
Line is longer than 80 characters (found 89).
@@ -805,6 +809,48 @@ public static RunTestSetResult runTestSet(String testRunId, String testSetId, St | |||
} | |||
} | |||
|
|||
public static Boolean udpateReportWithCoverage(String testRunId, String testSetId) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [checkstyle] <com.puppycrawl.tools.checkstyle.checks.sizes.LineLengthCheck> reported by reviewdog 🐶
Line is longer than 80 characters (found 88).
@@ -805,6 +809,48 @@ public static RunTestSetResult runTestSet(String testRunId, String testSetId, St | |||
} | |||
} | |||
|
|||
public static Boolean udpateReportWithCoverage(String testRunId, String testSetId) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [checkstyle] <com.puppycrawl.tools.checkstyle.checks.javadoc.MissingJavadocMethodCheck> reported by reviewdog 🐶
Missing a Javadoc comment.
@@ -805,6 +809,48 @@ public static RunTestSetResult runTestSet(String testRunId, String testSetId, St | |||
} | |||
} | |||
|
|||
public static Boolean udpateReportWithCoverage(String testRunId, String testSetId) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [checkstyle] <com.puppycrawl.tools.checkstyle.checks.FinalParametersCheck> reported by reviewdog 🐶
Parameter testRunId should be final.
int responseCode = conn.getResponseCode(); | ||
logger.debug("Status code received: " + responseCode); | ||
|
||
if (responseCode >= 200 && responseCode < 300) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [checkstyle] <com.puppycrawl.tools.checkstyle.checks.coding.MagicNumberCheck> reported by reviewdog 🐶
'200' is a magic number.
int responseCode = conn.getResponseCode(); | ||
logger.debug("Status code received: " + responseCode); | ||
|
||
if (responseCode >= 200 && responseCode < 300) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [checkstyle] <com.puppycrawl.tools.checkstyle.checks.coding.MagicNumberCheck> reported by reviewdog 🐶
'300' is a magic number.
|
||
// Parse the response body using Gson | ||
Gson gson = new Gson(); | ||
GraphQLResponse response = gson.fromJson(resBody, GraphQLResponse.class); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [checkstyle] <com.puppycrawl.tools.checkstyle.checks.sizes.LineLengthCheck> reported by reviewdog 🐶
Line is longer than 80 characters (found 89).
|
||
return true; | ||
} else { | ||
logger.error("Failed to update report with coverage data. Status code: " + responseCode); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [checkstyle] <com.puppycrawl.tools.checkstyle.checks.sizes.LineLengthCheck> reported by reviewdog 🐶
Line is longer than 80 characters (found 105).
return false; | ||
} | ||
} catch (Exception e) { | ||
logger.error("Error updating report with coverage data: " + e.getMessage(), e); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [checkstyle] <com.puppycrawl.tools.checkstyle.checks.sizes.LineLengthCheck> reported by reviewdog 🐶
Line is longer than 80 characters (found 91).
Signed-off-by: Akash Kumar <[email protected]>
} | ||
|
||
String payload = String.format( | ||
"{\"query\": \"mutation updateReportWithCov{ updateReportWithCov(testRunId: \\\"%s\\\", testSetId: \\\"%s\\\", language: \\\"java\\\") }\"}", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [checkstyle] <com.puppycrawl.tools.checkstyle.checks.sizes.LineLengthCheck> reported by reviewdog 🐶
Line is longer than 80 characters (found 157).
Related Issue
Closes: keploy/keploy#1735
Describe the changes you've made
A clear and concise description of what you have done to successfully close your assigned issue. Any new files? or anything you feel to let us know!
Type of change
How did you test your code changes?
Please describe the tests(if any). Provide instructions how its affecting the coverage.
Describe if there is any unusual behaviour of your code(Write
NA
if there isn't)A clear and concise description of it.
Checklist:
Screenshots (if any)