File tree Expand file tree Collapse file tree 3 files changed +45
-0
lines changed
driver-core/src/test/java/com/datastax/driver/core Expand file tree Collapse file tree 3 files changed +45
-0
lines changed Original file line number Diff line number Diff line change 1010import static org .mockito .Mockito .times ;
1111import static org .mockito .Mockito .verify ;
1212
13+ import com .datastax .driver .core .utils .ScyllaOnly ;
1314import java .util .Collection ;
1415import org .testng .annotations .Test ;
1516
1617@ CreateCCM (CreateCCM .TestMode .PER_METHOD )
18+ @ ScyllaOnly
1719public class ScyllaSniProxyTest extends CCMTestsSupport {
1820
1921 private void test_ccm_cluster (int testNodes ) {
Original file line number Diff line number Diff line change 2323
2424import com .datastax .driver .core .utils .CassandraVersion ;
2525import com .datastax .driver .core .utils .DseVersion ;
26+ import com .datastax .driver .core .utils .ScyllaOnly ;
2627import com .datastax .driver .core .utils .ScyllaSkip ;
2728import java .lang .reflect .AnnotatedElement ;
2829import java .lang .reflect .Method ;
@@ -129,6 +130,10 @@ private boolean scanAnnotatedElement(AnnotatedElement element) {
129130 scyllaSkipCheck ();
130131 foundAnnotation = true ;
131132 }
133+ if (element .isAnnotationPresent (ScyllaOnly .class )) {
134+ scyllaOnlyCheck ();
135+ foundAnnotation = true ;
136+ }
132137 if (element .isAnnotationPresent (CassandraVersion .class )) {
133138 CassandraVersion cassandraVersion = element .getAnnotation (CassandraVersion .class );
134139 cassandraVersionCheck (cassandraVersion );
@@ -173,6 +178,12 @@ private static void scyllaSkipCheck() {
173178 }
174179 }
175180
181+ private static void scyllaOnlyCheck () {
182+ if (CCMBridge .getGlobalScyllaVersion () == null ) {
183+ throw new SkipException ("Skipping test because it is enabled only for Scylla cluster." );
184+ }
185+ }
186+
176187 private static void versionCheck (
177188 VersionNumber current , VersionNumber required , String skipString ) {
178189 if (current == null ) {
Original file line number Diff line number Diff line change 1+ /*
2+ * Copyright (C) 2022 ScyllaDB
3+ *
4+ * Licensed under the Apache License, Version 2.0 (the "License");
5+ * you may not use this file except in compliance with the License.
6+ * You may obtain a copy of the License at
7+ *
8+ * http://www.apache.org/licenses/LICENSE-2.0
9+ *
10+ * Unless required by applicable law or agreed to in writing, software
11+ * distributed under the License is distributed on an "AS IS" BASIS,
12+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+ * See the License for the specific language governing permissions and
14+ * limitations under the License.
15+ */
16+
17+ package com .datastax .driver .core .utils ;
18+
19+ import java .lang .annotation .Retention ;
20+ import java .lang .annotation .RetentionPolicy ;
21+
22+ /**
23+ * Annotation for a Class or Method that skips a test when NOT testing with Scylla.
24+ *
25+ * @see com.datastax.driver.core.TestListener#beforeInvocation(org.testng.IInvokedMethod,
26+ * org.testng.ITestResult)
27+ */
28+ @ Retention (RetentionPolicy .RUNTIME )
29+ public @interface ScyllaOnly {
30+ /** @return The description returned if the Scylla requirement is not met. */
31+ String description () default "Marked skip when not testing with Scylla." ;
32+ }
You can’t perform that action at this time.
0 commit comments