-
Notifications
You must be signed in to change notification settings - Fork 137
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
Support Cartesian products of environments in MultiEnvTestEngine #7816
Open
colan-dremio
wants to merge
40
commits into
projectnessie:main
Choose a base branch
from
colan-dremio:cartesian-multienv
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
40 commits
Select commit
Hold shift + click to select a range
7620b94
Support cartesian products of environments in MultiEnvTestEngine
colan-dremio 554dfab
Update tests to assert on entire UniqueIds
colan-dremio e0a8dd3
Merge remote-tracking branch 'upstream/main' into cartesian-multienv
colan-dremio db22c92
Merge remote-tracking branch 'upstream/main' into cartesian-multienv
colan-dremio 428728a
Remove second registry
colan-dremio e004be1
Support ordering of extensions
colan-dremio 5faf681
Clear registry between tests
colan-dremio 870d25a
Use separate registry in MultiEnvTestFilter
colan-dremio 5cb8b1b
Re-add tooManyExtensions()
colan-dremio e8131d4
Clear filter registry between tests too
colan-dremio 67bc7f2
Merge remote-tracking branch 'upstream/main' into cartesian-multienv
colan-dremio ab0fd2b
Clear registries between Nessie compat tests
colan-dremio 3df881b
Add missing assert
colan-dremio db1a3a6
spotless apply
colan-dremio 5104a20
Call clear from registry constructor
colan-dremio 732fc44
Rename getOrder to segmentPriority
colan-dremio 379935f
clarify filter logic
colan-dremio 577685a
Add environment names to test display names
colan-dremio b9c229d
update segmentPriority docs
colan-dremio f4e11e4
Reorder extensions to better exercise ordering test
colan-dremio a1abab1
Expand cartesian product test
colan-dremio a8ce700
Do calculation of partial cartesian product up front in the engine
colan-dremio d6fef14
environmentNames -> environmentIds
colan-dremio 95e8590
Remove filter's dependence on registry
colan-dremio 915fe05
Remove unnecessary field
colan-dremio 3439176
spotlessApply
colan-dremio 1d6166e
Merge remote-tracking branch 'upstream/main' into cartesian-multienv
colan-dremio fafab6d
environmentIds -> environment
colan-dremio 67106da
Add support for TestTemplateTestDescriptor
colan-dremio c32b55b
paragraph
colan-dremio 4a8af55
immutables
colan-dremio c7799d0
unused method
colan-dremio 50b3141
UniqueId selection tests
colan-dremio eea4d5d
Switch back to DiscoverySelectorResolver, add post filtering so it do…
colan-dremio 3ff67f4
Add complex nesting tests, some failing
colan-dremio 40169b4
Re-use nested find in registry
colan-dremio b695dee
fixup
colan-dremio 4a58d99
Merge remote-tracking branch 'upstream/main' into cartesian-multienv
colan-dremio 3febfbf
remove duplicate annotations
colan-dremio f0219e1
update new extension
colan-dremio 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 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 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 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 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
64 changes: 64 additions & 0 deletions
64
...env-test-engine/src/main/java/org/projectnessie/junit/engine/MultiEnvAnnotationUtils.java
This file contains 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,64 @@ | ||
/* | ||
* Copyright (C) 2024 Dremio | ||
* | ||
* Licensed 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.projectnessie.junit.engine; | ||
|
||
import java.lang.annotation.Annotation; | ||
import java.util.Arrays; | ||
import java.util.HashSet; | ||
import java.util.Set; | ||
import java.util.stream.Stream; | ||
import org.junit.jupiter.api.extension.ExtendWith; | ||
import org.junit.platform.commons.util.AnnotationUtils; | ||
|
||
public final class MultiEnvAnnotationUtils { | ||
private MultiEnvAnnotationUtils() {} | ||
|
||
public static <A extends Annotation> Set<A> findNestedRepeatableAnnotationsOn( | ||
Class<?> classToSearch, Class<A> annotationType) { | ||
Set<A> annotations = new HashSet<>(); | ||
// Find annotations following the class nesting chain | ||
for (Class<?> cl = classToSearch; cl != null; cl = cl.getDeclaringClass()) { | ||
annotations.addAll(AnnotationUtils.findRepeatableAnnotations(cl, annotationType)); | ||
} | ||
return annotations; | ||
} | ||
|
||
public static Stream<Class<? extends MultiEnvTestExtension>> findNestedMultiEnvTestExtensionsOn( | ||
Class<?> classToSearch) { | ||
//noinspection unchecked | ||
return findNestedRepeatableAnnotationsOn(classToSearch, ExtendWith.class).stream() | ||
.flatMap(extendWithAnnotation -> Arrays.stream(extendWithAnnotation.value())) | ||
.filter(MultiEnvTestExtension.class::isAssignableFrom) | ||
.map(e -> (Class<? extends MultiEnvTestExtension>) e); | ||
} | ||
|
||
public static String segmentTypeOf(Class<? extends MultiEnvTestExtension> extensionClass) { | ||
MultiEnvSegmentType segmentTypeAnnotation = | ||
extensionClass.getAnnotation(MultiEnvSegmentType.class); | ||
|
||
if (segmentTypeAnnotation == null) { | ||
throw new IllegalStateException( | ||
String.format( | ||
"%s is missing a MultiEnvSegmentType annotation.", extensionClass.getName())); | ||
} | ||
|
||
return segmentTypeAnnotation.value(); | ||
} | ||
|
||
public static String segmentTypeOf(MultiEnvTestExtension extension) { | ||
return segmentTypeOf(extension.getClass()); | ||
} | ||
} |
This file contains 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
29 changes: 29 additions & 0 deletions
29
...lti-env-test-engine/src/main/java/org/projectnessie/junit/engine/MultiEnvSegmentType.java
This file contains 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,29 @@ | ||
/* | ||
* Copyright (C) 2024 Dremio | ||
* | ||
* Licensed 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.projectnessie.junit.engine; | ||
|
||
import java.lang.annotation.ElementType; | ||
import java.lang.annotation.Inherited; | ||
import java.lang.annotation.Retention; | ||
import java.lang.annotation.RetentionPolicy; | ||
import java.lang.annotation.Target; | ||
|
||
@Target({ElementType.TYPE}) | ||
@Retention(RetentionPolicy.RUNTIME) | ||
@Inherited | ||
public @interface MultiEnvSegmentType { | ||
String value(); | ||
} |
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.
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.
stream()
(no args) is unused now.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.
Weird, my IDE seems to be confused about this one. Removed.