mirror of
https://github.com/google/nomulus
synced 2026-02-09 14:30:33 +00:00
Disable Ofy tests. (#1644)
* Disable Ofy tests. This change just turns off the Ofy tests at the root, by removing processing for dual tests and disassociating the TestOfyOnly annotation from test annotations. This is far less comprehensive than #1631, but it's probably worth entering as a stopgap solution just because it should speed up our test runs and unblock a lot of other cleanup work. * Fix DualDatabaseTestInvocationContextProviderTest
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
|
||||
// Copyright 2020 The Nomulus Authors. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@@ -64,15 +65,13 @@ class DualDatabaseTestInvocationContextProvider implements TestTemplateInvocatio
|
||||
@Override
|
||||
public Stream<TestTemplateInvocationContext> provideTestTemplateInvocationContexts(
|
||||
ExtensionContext context) {
|
||||
TestTemplateInvocationContext ofyContext =
|
||||
createInvocationContext(context.getDisplayName() + " with Datastore", DatabaseType.OFY);
|
||||
TestTemplateInvocationContext sqlContext =
|
||||
createInvocationContext(context.getDisplayName() + " with PostgreSQL", DatabaseType.JPA);
|
||||
Method testMethod = context.getTestMethod().orElseThrow(IllegalStateException::new);
|
||||
if (testMethod.isAnnotationPresent(TestOfyAndSql.class)) {
|
||||
return Stream.of(ofyContext, sqlContext);
|
||||
return Stream.of(sqlContext);
|
||||
} else if (testMethod.isAnnotationPresent(TestOfyOnly.class)) {
|
||||
return Stream.of(ofyContext);
|
||||
throw new RuntimeException("Ofy-only test invoked.");
|
||||
} else if (testMethod.isAnnotationPresent(TestSqlOnly.class)) {
|
||||
return Stream.of(sqlContext);
|
||||
} else {
|
||||
|
||||
@@ -73,10 +73,10 @@ public class DualDatabaseTestInvocationContextProviderTest {
|
||||
|
||||
@AfterAll
|
||||
static void assertEachTransactionManagerIsUsed() {
|
||||
assertThat(testBothDbsOfyCounter).isEqualTo(1);
|
||||
assertThat(testBothDbsOfyCounter).isEqualTo(0);
|
||||
assertThat(testBothDbsSqlCounter).isEqualTo(1);
|
||||
|
||||
assertThat(testOfyOnlyOfyCounter).isEqualTo(1);
|
||||
assertThat(testOfyOnlyOfyCounter).isEqualTo(0);
|
||||
assertThat(testOfyOnlySqlCounter).isEqualTo(0);
|
||||
|
||||
assertThat(testSqlOnlyOfyCounter).isEqualTo(0);
|
||||
|
||||
@@ -19,10 +19,8 @@ import static java.lang.annotation.RetentionPolicy.RUNTIME;
|
||||
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.Target;
|
||||
import org.junit.jupiter.api.TestTemplate;
|
||||
|
||||
/** Annotation to indicate a test method will be executed only with Datastore. */
|
||||
@Target({METHOD})
|
||||
@Retention(RUNTIME)
|
||||
@TestTemplate
|
||||
public @interface TestOfyOnly {}
|
||||
|
||||
Reference in New Issue
Block a user