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

Subscription IT: intro extensive regression tests from test group #13065

Merged
merged 65 commits into from
Aug 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
65 commits
Select commit Hold shift + click to select a range
ae6d5ab
copy origin
VGalaxies Jul 30, 2024
9d0d342
adapt
VGalaxies Jul 30, 2024
a6885a1
spotless
VGalaxies Jul 30, 2024
ada02cd
add license header
VGalaxies Jul 30, 2024
c962230
fixup
VGalaxies Jul 30, 2024
e9cd44c
Merge branch 'master' into more-ci
VGalaxies Aug 2, 2024
66c1102
add auto_create_db and topic package
VGalaxies Aug 5, 2024
5be7366
add pullconsumer package
VGalaxies Aug 5, 2024
3c73876
fixup
VGalaxies Aug 5, 2024
4f37db6
Merge branch 'master' into more-ci
VGalaxies Aug 5, 2024
fcb381f
debug
VGalaxies Aug 5, 2024
bfc9e7f
abstract?
VGalaxies Aug 5, 2024
6018eb0
test
VGalaxies Aug 5, 2024
facc02a
fixup
VGalaxies Aug 5, 2024
3afc7ee
fixup
VGalaxies Aug 5, 2024
e61991c
add pushconsumer package
VGalaxies Aug 5, 2024
ad873c9
rename
VGalaxies Aug 5, 2024
98999bb
add annotations
VGalaxies Aug 5, 2024
69d1da4
fixup
VGalaxies Aug 5, 2024
7ea94ae
reset
VGalaxies Aug 5, 2024
7800889
add comments
VGalaxies Aug 5, 2024
9b72ec6
reset
VGalaxies Aug 5, 2024
4ff14bd
improve SkipOnSetUpAndTearDownFailure
VGalaxies Aug 6, 2024
94fe30e
add flush for data insertion
VGalaxies Aug 6, 2024
6100fe1
narrow timeout
VGalaxies Aug 6, 2024
08a567b
remove sleep for MultiGroupVsMultiConsumer
VGalaxies Aug 6, 2024
eafb06f
fix zone id...
VGalaxies Aug 7, 2024
d0fe03c
fix zone in topic time
VGalaxies Aug 7, 2024
28f6e1d
Revert "add flush for data insertion"
VGalaxies Aug 7, 2024
79ce412
rm IoTDBFilePushConsumeTsfileIT
VGalaxies Aug 7, 2024
a41a94a
sync
VGalaxies Aug 7, 2024
bdc76de
Revert "debug"
VGalaxies Aug 7, 2024
de661ab
Merge branch 'master' into more-ci
VGalaxies Aug 7, 2024
f8f5815
sync
VGalaxies Aug 9, 2024
59a5e8b
Merge branch 'master' into more-ci
VGalaxies Aug 9, 2024
cda5d65
replace MeasurementSchema with IMeasurementSchema
VGalaxies Aug 9, 2024
fc5c55b
almost finished
VGalaxies Aug 13, 2024
a6ab4f2
non-strict assertions
VGalaxies Aug 13, 2024
8098770
Merge branch 'master' into more-ci
VGalaxies Aug 13, 2024
d920337
improve tests related to snapshot mode
VGalaxies Aug 13, 2024
299baed
reset
VGalaxies Aug 13, 2024
2504d3d
reset
VGalaxies Aug 13, 2024
1aaff8d
fix OneConsumerMultiTopicsTsfile
VGalaxies Aug 13, 2024
befe2c2
1. Remove comments from session_src.executeNonQueryStatement("flush;");
VGalaxies Aug 14, 2024
4758676
debug
VGalaxies Aug 14, 2024
c062244
fix MultiGroupVsMultiConsumer
VGalaxies Aug 14, 2024
d15d211
remove HighPerformanceMode
VGalaxies Aug 14, 2024
d3abd6b
fixup! fix MultiGroupVsMultiConsumer
VGalaxies Aug 14, 2024
ea21bd9
minor improve
VGalaxies Aug 14, 2024
09e8d01
improve MultiGroupVsMultiConsumer
VGalaxies Aug 14, 2024
95b1c55
add -ntp
VGalaxies Aug 14, 2024
0a95e93
improve assertGte
VGalaxies Aug 14, 2024
85857a2
improve PathLooseDeviceTsfilePushConsumer, Consumer2With1TopicSharePr…
VGalaxies Aug 14, 2024
d560cc8
fixup! add -ntp
VGalaxies Aug 14, 2024
ae6c956
Revert "debug"
VGalaxies Aug 14, 2024
c97ff43
rename subscription to subscription-arch-verification
VGalaxies Aug 14, 2024
05799e1
Merge branch 'master' into more-ci
VGalaxies Aug 14, 2024
b26f560
reset timeout
VGalaxies Aug 14, 2024
4c8b2e8
fixup! rename subscription to subscription-arch-verification
VGalaxies Aug 14, 2024
c197ca6
fix drop db for auto_create_db
VGalaxies Aug 15, 2024
ec9c014
multi group for restart IT
VGalaxies Aug 16, 2024
6014df2
Merge branch 'master' into more-ci
VGalaxies Aug 16, 2024
69770e5
add comment
VGalaxies Aug 16, 2024
3db3d29
sync
VGalaxies Aug 19, 2024
d6d05f3
Merge branch 'master' into more-ci
VGalaxies Aug 19, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 45 additions & 4 deletions .github/workflows/pipe-it-2cluster.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ jobs:
-DintegrationTest.forkCount=1 -DConfigNodeMaxHeapSize=256 -DDataNodeMaxHeapSize=1024 -DDataNodeMaxDirectMemorySize=768 \
-DClusterConfigurations=${{ matrix.cluster }},${{ matrix.cluster }} \
-pl integration-test \
-am -PMultiClusterIT2AutoCreateSchema
-am -PMultiClusterIT2AutoCreateSchema \
-ntp
- name: Upload Artifact
if: failure()
uses: actions/upload-artifact@v4
Expand Down Expand Up @@ -95,15 +96,16 @@ jobs:
-DintegrationTest.forkCount=1 -DConfigNodeMaxHeapSize=256 -DDataNodeMaxHeapSize=1024 -DDataNodeMaxDirectMemorySize=768 \
-DClusterConfigurations=${{ matrix.cluster1 }},${{ matrix.cluster2 }} \
-pl integration-test \
-am -PMultiClusterIT2ManualCreateSchema
-am -PMultiClusterIT2ManualCreateSchema \
-ntp
- name: Upload Artifact
if: failure()
uses: actions/upload-artifact@v4
with:
name: cluster-log-manual-create-schema-java${{ matrix.java }}-${{ runner.os }}-${{ matrix.cluster1 }}-${{ matrix.cluster2 }}
path: integration-test/target/cluster-logs
retention-days: 30
subscription:
subscription-arch-verification:
strategy:
fail-fast: false
max-parallel: 15
Expand Down Expand Up @@ -132,11 +134,50 @@ jobs:
-DintegrationTest.forkCount=1 -DConfigNodeMaxHeapSize=256 -DDataNodeMaxHeapSize=1024 -DDataNodeMaxDirectMemorySize=768 \
-DClusterConfigurations=${{ matrix.cluster1 }},${{ matrix.cluster2 }} \
-pl integration-test \
-am -PMultiClusterIT2Subscription
-am -PMultiClusterIT2SubscriptionArchVerification \
-ntp
- name: Upload Artifact
if: failure()
uses: actions/upload-artifact@v4
with:
name: cluster-log-subscription-java${{ matrix.java }}-${{ runner.os }}-${{ matrix.cluster1 }}-${{ matrix.cluster2 }}
path: integration-test/target/cluster-logs
retention-days: 30
subscription-regression:
strategy:
fail-fast: false
max-parallel: 15
matrix:
java: [ 17 ]
# do not use HighPerformanceMode here, otherwise some tests will cause the GH runner to receive a shutdown signal
cluster1: [ ScalableSingleNodeMode ]
cluster2: [ ScalableSingleNodeMode ]
os: [ ubuntu-latest ]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Set up JDK ${{ matrix.java }}
uses: actions/setup-java@v4
with:
distribution: liberica
java-version: ${{ matrix.java }}
- name: IT Test
shell: bash
# we do not compile client-cpp for saving time, it is tested in client.yml
# we can skip influxdb-protocol because it has been tested separately in influxdb-protocol.yml
run: |
mvn clean verify \
-P with-integration-tests \
-DskipUTs \
-DintegrationTest.forkCount=1 -DConfigNodeMaxHeapSize=256 -DDataNodeMaxHeapSize=1024 -DDataNodeMaxDirectMemorySize=768 \
-DClusterConfigurations=${{ matrix.cluster1 }},${{ matrix.cluster2 }} \
-pl integration-test \
-am -PMultiClusterIT2SubscriptionRegression \
-ntp
- name: Upload Artifact
if: failure()
uses: actions/upload-artifact@v4
with:
name: cluster-log-subscription-regression-java${{ matrix.java }}-${{ runner.os }}-${{ matrix.cluster1 }}-${{ matrix.cluster2 }}
path: integration-test/target/cluster-logs
retention-days: 30
20 changes: 17 additions & 3 deletions integration-test/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,7 @@
</activation>
<properties>
<integrationTest.excludedGroups/>
<integrationTest.includedGroups>org.apache.iotdb.itbase.category.MultiClusterIT1,org.apache.iotdb.itbase.category.MultiClusterIT2AutoCreateSchema,org.apache.iotdb.itbase.category.MultiClusterIT2ManualCreateSchema,org.apache.iotdb.itbase.category.MultiClusterIT2Subscription,org.apache.iotdb.itbase.category.MultiClusterIT3</integrationTest.includedGroups>
<integrationTest.includedGroups>org.apache.iotdb.itbase.category.MultiClusterIT1,org.apache.iotdb.itbase.category.MultiClusterIT2AutoCreateSchema,org.apache.iotdb.itbase.category.MultiClusterIT2ManualCreateSchema,org.apache.iotdb.itbase.category.MultiClusterIT2SubscriptionArchVerification,org.apache.iotdb.itbase.category.MultiClusterIT2SubscriptionRegression,org.apache.iotdb.itbase.category.MultiClusterIT3</integrationTest.includedGroups>
<integrationTest.launchNodeInSameJVM>false</integrationTest.launchNodeInSameJVM>
<integrationTest.randomSelectWriteNode>true</integrationTest.randomSelectWriteNode>
<integrationTest.readAndVerifyWithMultiNode>true</integrationTest.readAndVerifyWithMultiNode>
Expand Down Expand Up @@ -465,13 +465,27 @@
</properties>
</profile>
<profile>
<id>MultiClusterIT2Subscription</id>
<id>MultiClusterIT2SubscriptionArchVerification</id>
<activation>
<activeByDefault>false</activeByDefault>
</activation>
<properties>
<integrationTest.excludedGroups/>
<integrationTest.includedGroups>org.apache.iotdb.itbase.category.MultiClusterIT2Subscription</integrationTest.includedGroups>
<integrationTest.includedGroups>org.apache.iotdb.itbase.category.MultiClusterIT2SubscriptionArchVerification</integrationTest.includedGroups>
<integrationTest.launchNodeInSameJVM>false</integrationTest.launchNodeInSameJVM>
<integrationTest.randomSelectWriteNode>true</integrationTest.randomSelectWriteNode>
<integrationTest.readAndVerifyWithMultiNode>true</integrationTest.readAndVerifyWithMultiNode>
<integrationTest.testEnv>MultiCluster</integrationTest.testEnv>
</properties>
</profile>
<profile>
<id>MultiClusterIT2SubscriptionRegression</id>
<activation>
<activeByDefault>false</activeByDefault>
</activation>
<properties>
<integrationTest.excludedGroups/>
<integrationTest.includedGroups>org.apache.iotdb.itbase.category.MultiClusterIT2SubscriptionRegression</integrationTest.includedGroups>
<integrationTest.launchNodeInSameJVM>false</integrationTest.launchNodeInSameJVM>
<integrationTest.randomSelectWriteNode>true</integrationTest.randomSelectWriteNode>
<integrationTest.readAndVerifyWithMultiNode>true</integrationTest.readAndVerifyWithMultiNode>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/*
* 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.iotdb.itbase.category;

public interface MultiClusterIT2SubscriptionArchVerification {}
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@

package org.apache.iotdb.itbase.category;

public interface MultiClusterIT2Subscription {}
public interface MultiClusterIT2SubscriptionRegression {}
Original file line number Diff line number Diff line change
Expand Up @@ -24,19 +24,20 @@
import org.junit.After;
import org.junit.Before;
import org.junit.Rule;
import org.junit.rules.TestName;
import org.junit.rules.TestRule;

public abstract class AbstractSubscriptionIT {

@Rule public TestName testName = new TestName();
@Rule public DisplayName testName = new DisplayName();

@Rule public final TestRule skipOnSetUpFailure = new SkipOnSetUpFailure("setUp");
@Rule
public final TestRule skipOnSetUpAndTearDownFailure =
new SkipOnSetUpAndTearDownFailure("setUp", "tearDown");

@Before
public void setUp() {
public void setUp() throws Exception {
// set thread name
Thread.currentThread().setName(String.format("%s - main", testName.getMethodName()));
Thread.currentThread().setName(String.format("%s - main", testName.getDisplayName()));

// set thread pools core size
SubscriptionExecutorServiceManager.setControlFlowExecutorCorePoolSize(1);
Expand All @@ -45,5 +46,5 @@ public void setUp() {
}

@After
public void tearDown() {}
public void tearDown() throws Exception {}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/*
* 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.iotdb.subscription.it;

import org.junit.rules.TestWatcher;
import org.junit.runner.Description;

public class DisplayName extends TestWatcher {

private volatile String displayName;

public DisplayName() {}

protected void starting(final Description d) {
this.displayName = d.getDisplayName();
}

public String getDisplayName() {
return displayName;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
/*
* 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.iotdb.subscription.it;

import org.checkerframework.checker.nullness.qual.NonNull;
import org.junit.Assume;
import org.junit.rules.TestRule;
import org.junit.runner.Description;
import org.junit.runners.model.MultipleFailureException;
import org.junit.runners.model.Statement;

import java.lang.reflect.Method;

public class SkipOnSetUpAndTearDownFailure implements TestRule {

private final String setUpMethodName;
private final String tearDownMethodName;

/**
* @param setUpMethodName Should be exactly the same as the method name decorated with @Before.
* @param tearDownMethodName Should be exactly the same as the method name decorated with @After.
*/
public SkipOnSetUpAndTearDownFailure(
@NonNull final String setUpMethodName, @NonNull final String tearDownMethodName) {
this.setUpMethodName = setUpMethodName;
this.tearDownMethodName = tearDownMethodName;
}

@Override
public Statement apply(final Statement base, final Description description) {
return new Statement() {
@Override
public void evaluate() throws Throwable {
try {
base.evaluate();
} catch (final Throwable e) {
// Pay attention to the situation of MultipleFailureException...
if ((e instanceof MultipleFailureException
&& ((MultipleFailureException) e)
.getFailures().stream().allMatch(this::isExceptionInSetUpOrTearDown))
|| isExceptionInSetUpOrTearDown(e)) {
Assume.assumeTrue(
String.format(
"Skipping test due to setup or tearDown failure for %s#%s",
description.getClassName(), description.getMethodName()),
false);
}

// Re-throw the exception (which means the test has failed).
throw e;

// Regardless of the circumstances, the method decorated with @After will always be
// executed.
}
}

private boolean isExceptionInSetUpOrTearDown(final Throwable e) {
// Trace back the exception stack to determine whether the exception was thrown during the
// setUp or tearDown phase.
for (final StackTraceElement stackTraceElement : e.getStackTrace()) {
if (setUpMethodName.equals(stackTraceElement.getMethodName())
&& description.getClassName().equals(stackTraceElement.getClassName())
&& isMethodAnnotationWithBefore(stackTraceElement.getMethodName())) {
e.printStackTrace();
return true;
}

if (tearDownMethodName.equals(stackTraceElement.getMethodName())
&& description.getClassName().equals(stackTraceElement.getClassName())
&& isMethodAnnotationWithAfter(stackTraceElement.getMethodName())) {
e.printStackTrace();
return true;
}
}
return false;
}

private boolean isMethodAnnotationWithBefore(final String methodName) {
try {
final Method method = description.getTestClass().getDeclaredMethod(methodName);
return method.isAnnotationPresent(org.junit.Before.class);
} catch (final Throwable ignored) {
return false;
}
}

private boolean isMethodAnnotationWithAfter(final String methodName) {
try {
final Method method = description.getTestClass().getDeclaredMethod(methodName);
return method.isAnnotationPresent(org.junit.After.class);
} catch (final Throwable ignored) {
return false;
}
}
};
}
}
Loading
Loading