Skip to content
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

Read the Pravega ZK and BK configuration option from an input Json file for system tests. #7073

Open
wants to merge 32 commits into
base: master
Choose a base branch
from

Conversation

AJadhav29
Copy link
Contributor

Change log description
Currently, the Pravega ZK and BK configurations for system tests are read from the default config values.

Purpose of the change
Fixes #7072

What the code does
To read the pravega ZK and BK configuration option from an input jSON file for system tests.
Remove the hardcoded values and replace it to accept from json file.

How to verify it
The ZK and BK config values for system tests are read from external input json file when running system tests.

@AJadhav29 AJadhav29 marked this pull request as draft May 2, 2023 00:52
@codecov
Copy link

codecov bot commented May 2, 2023

Codecov Report

Patch and project coverage have no change.

Comparison is base (ff62002) 86.37% compared to head (cf7f5d4) 86.38%.

❗ Current head cf7f5d4 differs from pull request most recent head 0df8c62. Consider uploading reports for the commit 0df8c62 to get more accurate results

Additional details and impacted files
@@            Coverage Diff            @@
##             master    #7073   +/-   ##
=========================================
  Coverage     86.37%   86.38%           
- Complexity    16084    16085    +1     
=========================================
  Files          1031     1031           
  Lines         59890    59890           
  Branches       6094     6094           
=========================================
+ Hits          51732    51733    +1     
+ Misses         4984     4981    -3     
- Partials       3174     3176    +2     

see 16 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@AJadhav29 AJadhav29 force-pushed the karman-3462-zkbkConfig branch 3 times, most recently from 96f7382 to fa89ff7 Compare May 2, 2023 07:24
@AJadhav29 AJadhav29 marked this pull request as ready for review May 2, 2023 07:46
Copy link
Contributor

@amit-kumar59 amit-kumar59 left a comment

Choose a reason for hiding this comment

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

Its looks good for me.

@anju-c-das
Copy link
Contributor

@AJadhav29 please take care of below points:

  1. Check-in the Json file with required configuration.
  2. Please confirm on the code and include the changes in case the json file is not present, which is default values should be used in such case.
  3. Please mention the build once you run the system tests with new changes.

@anishakj anishakj requested a review from abhinb May 3, 2023 16:09
@AJadhav29
Copy link
Contributor Author

AJadhav29 commented May 5, 2023

The system test was green.

@anishakj
Copy link
Contributor

anishakj commented May 5, 2023

@AJadhav29 Could you please verify the values mentioned in the json file are getting applied correctly into the cluster where system test is ran.

@AJadhav29 AJadhav29 marked this pull request as draft May 5, 2023 07:02
@AJadhav29 AJadhav29 marked this pull request as ready for review May 23, 2023 02:19
@AJadhav29 AJadhav29 marked this pull request as draft May 24, 2023 03:23
@AJadhav29 AJadhav29 marked this pull request as ready for review May 25, 2023 22:57
Copy link
Contributor

@a6dulaleem a6dulaleem left a comment

Choose a reason for hiding this comment

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

please do have a look to the comments @AJadhav29.

.put("options", props)
.put("controllerResources", getResources(resourceWrapper.getControllerProperties().getControllerResources().getLimits().get("cpu"),
resourceWrapper.getControllerProperties().getControllerResources().getLimits().get("memory"),
resourceWrapper.getControllerProperties().getControllerResources().getRequests().get("cpu"),
Copy link
Contributor

Choose a reason for hiding this comment

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

Dont pass cpu and memory just call get resources with empty parameter and do all stuff inside the getResources() method because resource Wrapper is present there as well.

Copy link
Contributor Author

@AJadhav29 AJadhav29 May 31, 2023

Choose a reason for hiding this comment

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

I don't think so that's feasible. The getResources() method in the AbstractService class has 4 parameters passed and couldn't be passed empty.

Copy link
Contributor

Choose a reason for hiding this comment

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

we can refactor it

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't think refactoring would make any sense here. The only thing we can do then is to remove that method from AbstractService class and pass the value as we did for others.

import java.util.Map;

/**
* POJO class for bookkeeperProperties.
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you please give some more context to the comment?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The POJO class itself lists the parameters that it wants to get from the json. I believe that explains the context :)

Copy link
Contributor

@a6dulaleem a6dulaleem left a comment

Choose a reason for hiding this comment

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

please do have a look to the comments @AJadhav29.

Signed-off-by: AJadhav29 <aditi.jadhav@dell.com>

Signed-off-by: AJadhav29 <aditi.jadhav@dell.com>
Signed-off-by: AJadhav29 <aditi.jadhav@dell.com>

Signed-off-by: AJadhav29 <aditi.jadhav@dell.com>
Signed-off-by: AJadhav29 <aditi.jadhav@dell.com>

Signed-off-by: AJadhav29 <aditi.jadhav@dell.com>
Signed-off-by: AJadhav29 <aditi.jadhav@dell.com>

Signed-off-by: AJadhav29 <aditi.jadhav@dell.com>
Signed-off-by: AJadhav29 <aditi.jadhav@dell.com>
Signed-off-by: AJadhav29 <aditi.jadhav@dell.com>
Signed-off-by: AJadhav29 <aditi.jadhav@dell.com>
Signed-off-by: AJadhav29 <aditi.jadhav@dell.com>
Signed-off-by: AJadhav29 <aditi.jadhav@dell.com>
Signed-off-by: AJadhav29 <aditi.jadhav@dell.com>

Signed-off-by: AJadhav29 <aditi.jadhav@dell.com>
Signed-off-by: AJadhav29 <aditi.jadhav@dell.com>

Signed-off-by: AJadhav29 <aditi.jadhav@dell.com>
Signed-off-by: AJadhav29 <aditi.jadhav@dell.com>

Signed-off-by: AJadhav29 <aditi.jadhav@dell.com>
Signed-off-by: AJadhav29 <aditi.jadhav@dell.com>

Signed-off-by: AJadhav29 <aditi.jadhav@dell.com>
Signed-off-by: AJadhav29 <aditi.jadhav@dell.com>

Signed-off-by: AJadhav29 <aditi.jadhav@dell.com>
Signed-off-by: AJadhav29 <aditi.jadhav@dell.com>

Signed-off-by: AJadhav29 <aditi.jadhav@dell.com>
Signed-off-by: AJadhav29 <aditi.jadhav@dell.com>

Signed-off-by: AJadhav29 <aditi.jadhav@dell.com>
Signed-off-by: AJadhav29 <aditi.jadhav@dell.com>

Signed-off-by: AJadhav29 <aditi.jadhav@dell.com>
Signed-off-by: AJadhav29 <aditi.jadhav@dell.com>
Signed-off-by: AJadhav29 <aditi.jadhav@dell.com>
Signed-off-by: AJadhav29 <aditi.jadhav@dell.com>

Signed-off-by: AJadhav29 <aditi.jadhav@dell.com>
Signed-off-by: AJadhav29 <aditi.jadhav@dell.com>
Signed-off-by: AJadhav29 <aditi.jadhav@dell.com>

Signed-off-by: AJadhav29 <aditi.jadhav@dell.com>
Signed-off-by: AJadhav29 <aditi.jadhav@dell.com>

Signed-off-by: AJadhav29 <aditi.jadhav@dell.com>
Signed-off-by: AJadhav29 <aditi.jadhav@dell.com>

Signed-off-by: AJadhav29 <aditi.jadhav@dell.com>
Signed-off-by: AJadhav29 <aditi.jadhav@dell.com>

Signed-off-by: AJadhav29 <aditi.jadhav@dell.com>
Copy link
Contributor

@a6dulaleem a6dulaleem left a comment

Choose a reason for hiding this comment

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

LGTM

InputStream stream = ResourceWrapper.class.getClassLoader().getResourceAsStream(configFile);
ResourceWrapper resourceWrapper = null;
try {
resourceWrapper = objectMapper.readValue(stream, ResourceWrapper.class);
Copy link
Contributor

Choose a reason for hiding this comment

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

we might have to close the mapper or the underlying stream when done, on exception etc?

private static final String JOURNALDIRECTORIES = "/bk/journal/j0,/bk/journal/j1,/bk/journal/j2,/bk/journal/j3";
private static final String LEDGERDIRECTORIES = "/bk/ledgers/l0,/bk/ledgers/l1,/bk/ledgers/l2,/bk/ledgers/l3";

private static final String SYSTEMTESTCONFIG = "systemTestConfig.json";
Copy link
Contributor

Choose a reason for hiding this comment

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

to pass custom config now we edit this file and place it where?

Copy link
Contributor Author

@AJadhav29 AJadhav29 Jun 13, 2023

Choose a reason for hiding this comment

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

We are placing the json config file in same package in resources folder -
The repository root for the config file is - test/system/src/test/resources/systemTestConfig.json.
But we are passing the sorce root instead for the config file.

private ZookeeperProperties zookeeperProperties;
private Map<String, String> pravegaOptions;

public static ResourceWrapper getSystemTestConfig(String configFile) {
Copy link
Contributor

Choose a reason for hiding this comment

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

can this used be to pass in a custom file path now?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes. We are creating a static constant - SYSTEMTESTCONFIG in AbstractService class to pass the config file. Then we are passing that with another declared constant as - ResourceWrapper.getSystemTestConfig(SYSTEMTESTCONFIG).

.build())
.put("requests", ImmutableMap.builder()
.put("cpu", requestsCpu)
.put("memory", requestsMem)
.put("cpu", resources.getRequests().get("cpu"))
Copy link
Contributor

Choose a reason for hiding this comment

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

can choose to introduce static constants here and at other places.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There are not more than 2 instances of resources.getRequests or resourceWrapper.getControllerProperties or any of the other properties. So, even then do we need to instroduce static constants for each of them?

Signed-off-by: AJadhav29 <aditi.jadhav@dell.com>

Signed-off-by: AJadhav29 <aditi.jadhav@dell.com>
* POJO class for bookkeeperProperties.
*/
@Getter
@Setter
Copy link
Member

Choose a reason for hiding this comment

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

* POJO class for controllerProperties.
*/
@Getter
@Setter
Copy link
Member

Choose a reason for hiding this comment

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

Same here

* POJO class for bookkeeper probes.
*/
@Getter
@Setter
Copy link
Member

Choose a reason for hiding this comment

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

Same here

*/
@Slf4j
@Getter
@Setter
Copy link
Member

Choose a reason for hiding this comment

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

Same here

* POJO class for getting resources for controller, segmentStore, zookeeper and bookkeeper.
*/
@Getter
@Setter
Copy link
Member

Choose a reason for hiding this comment

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

Same here

* POJO class for segmentStoreProperties.
*/
@Getter
@Setter
Copy link
Member

Choose a reason for hiding this comment

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

Same here

* POJO class for getting storage values for bookkeeperStorage.
*/
@Getter
@Setter
Copy link
Member

Choose a reason for hiding this comment

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

Same here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Read the Pravega ZK and BK configuration option from an input Json file for system tests
8 participants