-
Notifications
You must be signed in to change notification settings - Fork 587
HDDS-13473. Amend validation for OZONE_OM_SNAPSHOT_DB_MAX_OPEN_FILES #8829
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
Merged
Merged
Changes from 4 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
b66fbba
HDDS-13473. Amend validation for OZONE_OM_SNAPSHOT_DB_MAX_OPEN_FILES
smengcl 7e57e98
Adjust test case.
smengcl f5ba134
Enable junit parallel execution, for this test case only.
smengcl 8d49465
license header
smengcl 724bcb9
Update JUnit parallel execution mode in test config
smengcl File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
67 changes: 67 additions & 0 deletions
67
...e/ozone-manager/src/test/java/org/apache/hadoop/ozone/om/TestOmSnapshotManagerConfig.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,67 @@ | ||
| /* | ||
| * Licensed to the Apache Software Foundation (ASF) under one or more | ||
| * contributor license agreements. See the NOTICE file distributed with | ||
| * this work for additional information regarding copyright ownership. | ||
| * The ASF licenses this file to You under the Apache License, Version 2.0 | ||
| * (the "License"); you may not use this file except in compliance with | ||
| * the License. You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
|
|
||
| package org.apache.hadoop.ozone.om; | ||
|
|
||
| import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; | ||
| import static org.junit.jupiter.api.Assertions.assertThrows; | ||
|
|
||
| import java.io.File; | ||
| import org.apache.hadoop.hdds.HddsConfigKeys; | ||
| import org.apache.hadoop.hdds.conf.OzoneConfiguration; | ||
| import org.junit.jupiter.api.io.TempDir; | ||
| import org.junit.jupiter.api.parallel.Execution; | ||
| import org.junit.jupiter.api.parallel.ExecutionMode; | ||
| import org.junit.jupiter.params.ParameterizedTest; | ||
| import org.junit.jupiter.params.provider.CsvSource; | ||
|
|
||
| /** | ||
| * Unit test for OmSnapshotManager configuration validation. | ||
| */ | ||
| class TestOmSnapshotManagerConfig { | ||
|
|
||
| @ParameterizedTest | ||
| @CsvSource({ | ||
| "-2, true, 'Invalid value: -2 should throw IllegalArgumentException'", | ||
| "-1, false, 'Valid value: -1 should not throw exception'", | ||
| "0, false, 'Valid value: 0 should not throw exception'", | ||
| "1, false, 'Valid value: 1 should not throw exception'", | ||
| }) | ||
| @Execution(ExecutionMode.CONCURRENT) | ||
| void testMaxOpenFilesConfig(int maxOpenFiles, boolean shouldThrowException, | ||
| String description, @TempDir File tempDir) { | ||
| OzoneConfiguration conf = new OzoneConfiguration(); | ||
|
|
||
| conf.set(HddsConfigKeys.OZONE_METADATA_DIRS, tempDir.getAbsolutePath()); | ||
| conf.setBoolean(OMConfigKeys.OZONE_FILESYSTEM_SNAPSHOT_ENABLED_KEY, true); | ||
| conf.setInt(OMConfigKeys.OZONE_OM_SNAPSHOT_DB_MAX_OPEN_FILES, maxOpenFiles); | ||
|
|
||
| // Configure dynamic ports to avoid conflicts during parallel execution | ||
| conf.set(OMConfigKeys.OZONE_OM_ADDRESS_KEY, "127.0.0.1:0"); | ||
| conf.set(OMConfigKeys.OZONE_OM_HTTP_ADDRESS_KEY, "127.0.0.1:0"); | ||
| conf.set(OMConfigKeys.OZONE_OM_HTTPS_ADDRESS_KEY, "127.0.0.1:0"); | ||
| conf.set(OMConfigKeys.OZONE_OM_RATIS_PORT_KEY, "0"); | ||
| conf.set(OMConfigKeys.OZONE_OM_GRPC_PORT_KEY, "0"); | ||
|
|
||
| if (shouldThrowException) { | ||
| assertThrows(IllegalArgumentException.class, () -> new OmTestManagers(conf), description); | ||
| } else { | ||
| OmTestManagers testManagers = assertDoesNotThrow(() -> new OmTestManagers(conf), description); | ||
| testManagers.stop(); | ||
| } | ||
| } | ||
| } |
28 changes: 28 additions & 0 deletions
28
hadoop-ozone/ozone-manager/src/test/resources/junit-platform.properties
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| # Licensed to the Apache Software Foundation (ASF) under one | ||
| # or more contributor license agreements. See the NOTICE file | ||
| # distributed with this work for additional information | ||
| # regarding copyright ownership. The ASF licenses this file | ||
| # to you under the Apache License, Version 2.0 (the | ||
| # "License"); you may not use this file except in compliance | ||
| # with the License. You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, | ||
| # software distributed under the License is distributed on an | ||
| # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| # KIND, either express or implied. See the License for the | ||
| # specific language governing permissions and limitations | ||
| # under the License. | ||
|
|
||
| # Enable parallel execution | ||
| junit.jupiter.execution.parallel.enabled=true | ||
| junit.jupiter.execution.parallel.mode.default=concurrent | ||
|
|
||
| # Still, run test classes sequentially by default | ||
| junit.jupiter.execution.parallel.mode.classes.default=same_thread | ||
|
|
||
| # Configure the parallelism strategy | ||
| junit.jupiter.execution.parallel.config.strategy=dynamic | ||
| # See https://docs.junit.org/snapshot/user-guide/#writing-tests-parallel-execution-config | ||
| junit.jupiter.execution.parallel.config.dynamic.factor=1 | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.