You are viewing a plain text version of this content. The canonical link for it is here.
Posted to yarn-issues@hadoop.apache.org by "ASF GitHub Bot (Jira)" <ji...@apache.org> on 2023/06/12 09:17:00 UTC
[jira] [Updated] (YARN-11429) Improve updateTestDataAutomatically in TestRMWebServicesCapacitySched
[ https://issues.apache.org/jira/browse/YARN-11429?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
ASF GitHub Bot updated YARN-11429:
----------------------------------
Labels: pull-request-available (was: )
> Improve updateTestDataAutomatically in TestRMWebServicesCapacitySched
> ---------------------------------------------------------------------
>
> Key: YARN-11429
> URL: https://issues.apache.org/jira/browse/YARN-11429
> Project: Hadoop YARN
> Issue Type: Improvement
> Components: yarn
> Reporter: Tamas Domok
> Assignee: Tamas Domok
> Priority: Major
> Labels: pull-request-available
>
> The [updateTestDataAutomatically|https://github.com/apache/hadoop/blob/bfce21ee08f2faef795354ac3615eb2a393bd158/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/TestRMWebServicesCapacitySched.java#L340] helper function should have a fix json format to be useful.
> {code:java}
> String actual = json.toString(2);
> updateTestDataAutomatically(expectedResourceFilename, actual);
> assertEquals(
> prettyPrintJson(getResourceAsString(expectedResourceFilename)),
> prettyPrintJson(actual));
> {code}
> The comparison is working with different json formats which is all right, but updating the test data should be easy, and the git diff should be easily readable by humans.
> Something like this could work:
> {code}
> String actual = prettyPrintJson(json.toString(2));
> updateTestDataAutomatically(expectedResourceFilename, actual);
> assertEquals(
> getResourceAsString(expectedResourceFilename),
> actual);
> {code}
> The json's must be updated unfortunately with the new format.
> The defaults shouldn't change here. Maybe we should be even more explicit with the format options:
> {code}
> private static String prettyPrintJson(String in) throws JsonProcessingException {
> ObjectMapper objectMapper = new ObjectMapper();
> return objectMapper
> .writerWithDefaultPrettyPrinter()
> .writeValueAsString(objectMapper.readTree(in));
> }
> {code}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: yarn-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: yarn-issues-help@hadoop.apache.org