-
Notifications
You must be signed in to change notification settings - Fork 136
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: add
overrides
attribute to @LeakyHapiTest
, remove `propert…
…yPreservingHapiSpec()` (#14222) Signed-off-by: Michael Tinker <[email protected]>
- Loading branch information
1 parent
0b139b2
commit 2e9034b
Showing
72 changed files
with
6,634 additions
and
7,706 deletions.
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
49 changes: 49 additions & 0 deletions
49
hedera-node/test-clients/src/main/java/com/hedera/services/bdd/junit/EmbeddedHapiTest.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,49 @@ | ||
/* | ||
* Copyright (C) 2024 Hedera Hashgraph, LLC | ||
* | ||
* 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 com.hedera.services.bdd.junit; | ||
|
||
import static com.hedera.services.bdd.junit.TestTags.EMBEDDED; | ||
import static org.junit.jupiter.api.parallel.ResourceAccessMode.READ; | ||
|
||
import com.hedera.services.bdd.junit.extensions.NetworkTargetingExtension; | ||
import com.hedera.services.bdd.junit.extensions.SpecNamingExtension; | ||
import java.lang.annotation.ElementType; | ||
import java.lang.annotation.Retention; | ||
import java.lang.annotation.RetentionPolicy; | ||
import java.lang.annotation.Target; | ||
import org.junit.jupiter.api.Tag; | ||
import org.junit.jupiter.api.TestFactory; | ||
import org.junit.jupiter.api.extension.ExtendWith; | ||
import org.junit.jupiter.api.parallel.ResourceLock; | ||
|
||
/** | ||
* Annotation for a {@link HapiTest} that can only be run in embedded mode. The {@link EmbeddedReason} annotation | ||
* enumerates common reasons a test has to run in embedded mode. | ||
*/ | ||
@Target({ElementType.METHOD}) | ||
@Retention(RetentionPolicy.RUNTIME) | ||
@TestFactory | ||
@ExtendWith({NetworkTargetingExtension.class, SpecNamingExtension.class}) | ||
@ResourceLock(value = "NETWORK", mode = READ) | ||
@Tag(EMBEDDED) | ||
public @interface EmbeddedHapiTest { | ||
/** | ||
* The reasons the test has to run in embedded mode. | ||
* @return the reasons the test has to run in embedded mode | ||
*/ | ||
EmbeddedReason[] value(); | ||
} |
36 changes: 36 additions & 0 deletions
36
hedera-node/test-clients/src/main/java/com/hedera/services/bdd/junit/EmbeddedReason.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,36 @@ | ||
/* | ||
* Copyright (C) 2024 Hedera Hashgraph, LLC | ||
* | ||
* 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 com.hedera.services.bdd.junit; | ||
|
||
/** | ||
* Enumerates reasons a {@link LeakyHapiTest} cannot be run concurrently with other tests. | ||
*/ | ||
public enum EmbeddedReason { | ||
/** | ||
* The test must skip the ingest workflow to submit its transactions, as they would always be rejected by | ||
* a node in normal operations. | ||
*/ | ||
MUST_SKIP_INGEST, | ||
/** | ||
* The test must directly access state to assert expectations that cannot be verified through the gRPC API. | ||
*/ | ||
NEEDS_STATE_ACCESS, | ||
/** | ||
* The test manipulates the software version of the simulated consensus event for a transaction. | ||
*/ | ||
MANIPULATES_EVENT_VERSION, | ||
} |
55 changes: 55 additions & 0 deletions
55
...-node/test-clients/src/main/java/com/hedera/services/bdd/junit/LeakyEmbeddedHapiTest.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,55 @@ | ||
/* | ||
* Copyright (C) 2024 Hedera Hashgraph, LLC | ||
* | ||
* 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 com.hedera.services.bdd.junit; | ||
|
||
import static com.hedera.services.bdd.junit.TestTags.EMBEDDED; | ||
import static org.junit.jupiter.api.parallel.ResourceAccessMode.READ_WRITE; | ||
|
||
import com.hedera.services.bdd.junit.extensions.NetworkTargetingExtension; | ||
import com.hedera.services.bdd.junit.extensions.SpecNamingExtension; | ||
import java.lang.annotation.ElementType; | ||
import java.lang.annotation.Retention; | ||
import java.lang.annotation.RetentionPolicy; | ||
import java.lang.annotation.Target; | ||
import org.junit.jupiter.api.Tag; | ||
import org.junit.jupiter.api.TestFactory; | ||
import org.junit.jupiter.api.extension.ExtendWith; | ||
import org.junit.jupiter.api.parallel.ResourceLock; | ||
|
||
/** | ||
* Annotation for a {@link HapiTest} that can only be run in embedded mode, and not concurrently with other embedded | ||
* tests. The {@link EmbeddedReason} attribute gives the reasons the test has to run in embedded mode. The | ||
* {@link ContextRequirement} attribute gives the reasons the test cannot run concurrently. | ||
*/ | ||
@Target({ElementType.METHOD}) | ||
@Retention(RetentionPolicy.RUNTIME) | ||
@TestFactory | ||
@ExtendWith({NetworkTargetingExtension.class, SpecNamingExtension.class}) | ||
@ResourceLock(value = "NETWORK", mode = READ_WRITE) | ||
@Tag(EMBEDDED) | ||
public @interface LeakyEmbeddedHapiTest { | ||
/** | ||
* The reasons the test has to run in embedded mode. | ||
* @return the reasons the test has to run in embedded mode | ||
*/ | ||
EmbeddedReason[] reason(); | ||
/** | ||
* The requirements preventing the test from running concurrently with other tests. | ||
* @return the reasons the test cannot run concurrently with other tests | ||
*/ | ||
ContextRequirement[] requirement() default {}; | ||
} |
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
Oops, something went wrong.