Skip to content
This repository has been archived by the owner on Mar 3, 2023. It is now read-only.

Add unit tests to verify yarn launcher config construction #1460

Merged
merged 4 commits into from
Oct 3, 2016

Conversation

ashvina
Copy link
Contributor

@ashvina ashvina commented Sep 30, 2016

This PR is related to #1454 (comment)
cc @billonahill

expectedMap.put(DriverMemory.class.getSimpleName(), "100");

Config.Builder builder = new Config.Builder();
for (String s : testConfigMap.keySet()) {
Copy link
Contributor

Choose a reason for hiding this comment

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

please rename 's' to something like configKey or something descriprive

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed

@billonahill
Copy link
Contributor

Two general observations:

  1. Do you have a concept of default config settings? If so can we have two tests, one for testing defaults are as expected and one for testing non-defaults?
  2. How could we do this in a way where if someone adds a new config but forgets to update this test, it fails? Is there a way to require all config keys to be part of an enum or something like that, where adding one to the config/enum, but not a test verification for it would fail?

@ashvina
Copy link
Contributor Author

ashvina commented Sep 30, 2016

I think I can address the second observation.

Regarding observation 1, most of the configurations provided to REEF are heron configs and are not optional. For e.g. there is no default value of a topology name. These are provided to launcher by heron config loader which is independently unit tested. I am not sure if this kind of test is applicable here?

@ashvina
Copy link
Contributor Author

ashvina commented Sep 30, 2016

Updated the unit test. It will fail if unexpected config is found.
cc @billonahill

reefSpecificConfigs.remove(reefConfigNode.getName());
}
}
Assert.assertEquals(0, expectedMap.size());
Copy link
Contributor

Choose a reason for hiding this comment

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

If either of these assertions fails, the reason won't be clear to the reader of the logs. Would you please add a string reason for the failure (e.g., an unexpected config found) and output the map/set.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed

setConfigs(Keys.corePackageUri(), new File(".").getName(), HeronCorePackageName.class);

Set<String> reefSpecificConfigs = new HashSet<>();
reefSpecificConfigs.add("JobControlHandler");
Copy link
Contributor

Choose a reason for hiding this comment

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

Can these key values be static strings referenced from somewhere?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed

reefSpecificConfigs.add("DriverIdentifier");

Config.Builder builder = new Config.Builder();
for (String s : testConfigMap.keySet()) {
Copy link
Contributor

Choose a reason for hiding this comment

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

please use a more descriptive field name than s.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed


for (NamedParameterNode<?> reefConfigNode : constructedConfig.getNamedParameters()) {
String value = expectedMap.get(reefConfigNode.getName());
if (value != null) {
Copy link
Contributor

Choose a reason for hiding this comment

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

There are enough Map, Set, Config, Builder objects all referring to different expected/found/reef values that reading the test can get tricky to a reader without details of the config code implementation. Would you please add a few comments along the way helping explain things.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed

@billonahill billonahill merged commit 126c12f into apache:master Oct 3, 2016
@ashvina ashvina deleted the configurableAMSize-1446 branch October 3, 2016 22:43
@huijunw huijunw added the Yarn label Jul 23, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants