From e73b7466b2b8047933f7853775ca4a5f5880b598 Mon Sep 17 00:00:00 2001 From: georgi-l95 Date: Thu, 12 Sep 2024 14:49:32 +0300 Subject: [PATCH] apply spotless Signed-off-by: georgi-l95 --- .github/workflows/e2e-tests.yaml | 67 +++++++++++++++++++ suites/build.gradle.kts | 3 +- .../com/hedera/block/suites/BaseSuite.java | 19 +++--- .../block/suites/stream/StreamTestSuites.java | 5 +- .../negative/NegativeBlockStreamTests.java | 14 +++- .../positive/PositiveBlockStreamTests.java | 5 +- 6 files changed, 94 insertions(+), 19 deletions(-) create mode 100644 .github/workflows/e2e-tests.yaml diff --git a/.github/workflows/e2e-tests.yaml b/.github/workflows/e2e-tests.yaml new file mode 100644 index 00000000..71f8418a --- /dev/null +++ b/.github/workflows/e2e-tests.yaml @@ -0,0 +1,67 @@ +## +# 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. +## +name: "E2E Test Suites" +on: + push: + branches: + - main + - release/* + pull_request: + branches: + - "*" + +defaults: + run: + shell: bash + +env: + GRADLE_EXEC: ./gradlew + +jobs: + e2e-tests: + runs-on: block-node-linux-medium + steps: + - name: Harden Runner + uses: step-security/harden-runner@17d0e2bd7d51742c71671bd19fa12bdc9d40a3d6 # v2.8.1 + with: + egress-policy: audit + + - name: Checkout code + uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + with: + fetch-depth: 0 + + - name: Expand Shallow Clone for Spotless + run: | + if [ -f .git/shallow ]; then + git fetch --unshallow --no-recurse-submodules + else + echo "Repository is not shallow, no need to unshallow." + fi + + - name: Set up JDK 21 + uses: actions/setup-java@99b8673ff64fbf99d8d325f52d9a5bdedb8483e9 # v4.2.1 + with: + distribution: 'temurin' + java-version: '21' + + - name: Build application + run: ${{ env.GRADLE_EXEC }} build + + - name: Run Acceptance Tests + id: acceptance-tests + run: ${GRADLE_EXEC} acceptanceTest + diff --git a/suites/build.gradle.kts b/suites/build.gradle.kts index c953f7ba..3a44ae15 100644 --- a/suites/build.gradle.kts +++ b/suites/build.gradle.kts @@ -32,7 +32,6 @@ mainModuleInfo { runtimeOnly("org.junit.jupiter.engine") } - tasks.register("runSuites") { description = "Runs E2E Test Suites" group = "suites" @@ -40,4 +39,4 @@ tasks.register("runSuites") { useJUnitPlatform() testClassesDirs = sourceSets["main"].output.classesDirs classpath = sourceSets["main"].runtimeClasspath -} \ No newline at end of file +} diff --git a/suites/src/main/java/com/hedera/block/suites/BaseSuite.java b/suites/src/main/java/com/hedera/block/suites/BaseSuite.java index 7f073968..875b63b4 100644 --- a/suites/src/main/java/com/hedera/block/suites/BaseSuite.java +++ b/suites/src/main/java/com/hedera/block/suites/BaseSuite.java @@ -16,17 +16,20 @@ package com.hedera.block.suites; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.BeforeAll; public abstract class BaseSuite { - @BeforeEach - public void setup() { - + @BeforeAll + public static void setup() { + // initilize simulator + // initilize block node application + // start both applications } - @AfterEach - public void teardown() { - + @AfterAll + public static void teardown() { + // tear down and stop simulator + // tear down and stop block node app } } diff --git a/suites/src/main/java/com/hedera/block/suites/stream/StreamTestSuites.java b/suites/src/main/java/com/hedera/block/suites/stream/StreamTestSuites.java index ffbf0c35..18c3353b 100644 --- a/suites/src/main/java/com/hedera/block/suites/stream/StreamTestSuites.java +++ b/suites/src/main/java/com/hedera/block/suites/stream/StreamTestSuites.java @@ -22,10 +22,7 @@ import org.junit.platform.suite.api.Suite; @Suite -@SelectClasses({ - PositiveBlockStreamTests.class, - NegativeBlockStreamTests.class -}) +@SelectClasses({PositiveBlockStreamTests.class, NegativeBlockStreamTests.class}) public class StreamTestSuites { // This class only serves as a suite entry point; no need to add any logic here. } diff --git a/suites/src/main/java/com/hedera/block/suites/stream/negative/NegativeBlockStreamTests.java b/suites/src/main/java/com/hedera/block/suites/stream/negative/NegativeBlockStreamTests.java index add62274..3aeb3cce 100644 --- a/suites/src/main/java/com/hedera/block/suites/stream/negative/NegativeBlockStreamTests.java +++ b/suites/src/main/java/com/hedera/block/suites/stream/negative/NegativeBlockStreamTests.java @@ -16,14 +16,22 @@ package com.hedera.block.suites.stream.negative; +import static org.junit.jupiter.api.Assertions.assertFalse; + import com.hedera.block.suites.BaseSuite; +import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; -@DisplayName("Positive Block Stream Tests") +@DisplayName("Negative Block Stream Tests") public class NegativeBlockStreamTests extends BaseSuite { + @BeforeEach + public void prepare() { + System.out.println("NegativeBlockStreamTests Prepare"); + } + @Test - public void testValidBlockStreamProcessing() { - System.out.println("testValidBlockStreamProcessing"); + public void testInvalidBlockStreamProcessing() { + assertFalse(false); } } diff --git a/suites/src/main/java/com/hedera/block/suites/stream/positive/PositiveBlockStreamTests.java b/suites/src/main/java/com/hedera/block/suites/stream/positive/PositiveBlockStreamTests.java index 348f67f8..3c1bbc66 100644 --- a/suites/src/main/java/com/hedera/block/suites/stream/positive/PositiveBlockStreamTests.java +++ b/suites/src/main/java/com/hedera/block/suites/stream/positive/PositiveBlockStreamTests.java @@ -16,15 +16,16 @@ package com.hedera.block.suites.stream.positive; +import static org.junit.jupiter.api.Assertions.assertTrue; + import com.hedera.block.suites.BaseSuite; import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; @DisplayName("Positive Block Stream Tests") public class PositiveBlockStreamTests extends BaseSuite { - @Test public void testValidBlockStreamProcessing() { - System.out.println("testValidBlockStreamProcessing"); + assertTrue(true); } }