mirror of
https://github.com/google/nomulus.git
synced 2025-07-26 04:28:34 +02:00
Temporarily disable SQL->DS replay in all tests (#1363)
This commit is contained in:
parent
5cfd96b63c
commit
72a70bebe7
2 changed files with 20 additions and 11 deletions
|
@ -49,8 +49,7 @@ import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
import org.joda.time.DateTime;
|
import org.joda.time.DateTime;
|
||||||
import org.joda.time.Duration;
|
import org.joda.time.Duration;
|
||||||
import org.junit.jupiter.api.AfterEach;
|
import org.junit.jupiter.api.Disabled;
|
||||||
import org.junit.jupiter.api.BeforeEach;
|
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import org.junit.jupiter.api.extension.RegisterExtension;
|
import org.junit.jupiter.api.extension.RegisterExtension;
|
||||||
import org.junitpioneer.jupiter.RetryingTest;
|
import org.junitpioneer.jupiter.RetryingTest;
|
||||||
|
@ -74,7 +73,8 @@ public class ReplicateToDatastoreActionTest {
|
||||||
private ReplicateToDatastoreAction action;
|
private ReplicateToDatastoreAction action;
|
||||||
private FakeResponse response;
|
private FakeResponse response;
|
||||||
|
|
||||||
@BeforeEach
|
// TODO(b/197534789): fix these tests and re-add the @BeforeEach
|
||||||
|
// @BeforeEach
|
||||||
void setUp() {
|
void setUp() {
|
||||||
resetAction();
|
resetAction();
|
||||||
injectExtension.setStaticField(Ofy.class, "clock", fakeClock);
|
injectExtension.setStaticField(Ofy.class, "clock", fakeClock);
|
||||||
|
@ -88,13 +88,15 @@ public class ReplicateToDatastoreActionTest {
|
||||||
TestObject.beforeDatastoreSaveCallCount = 0;
|
TestObject.beforeDatastoreSaveCallCount = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@AfterEach
|
// TODO(b/197534789): fix these tests and re-add the @AfterEach
|
||||||
|
// @AfterEach
|
||||||
void tearDown() {
|
void tearDown() {
|
||||||
DatabaseHelper.removeDatabaseMigrationSchedule();
|
DatabaseHelper.removeDatabaseMigrationSchedule();
|
||||||
fakeClock.disableAutoIncrement();
|
fakeClock.disableAutoIncrement();
|
||||||
}
|
}
|
||||||
|
|
||||||
@RetryingTest(4)
|
@RetryingTest(4)
|
||||||
|
@Disabled("b/197534789")
|
||||||
void testReplication() {
|
void testReplication() {
|
||||||
TestObject foo = TestObject.create("foo");
|
TestObject foo = TestObject.create("foo");
|
||||||
TestObject bar = TestObject.create("bar");
|
TestObject bar = TestObject.create("bar");
|
||||||
|
@ -120,6 +122,7 @@ public class ReplicateToDatastoreActionTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@RetryingTest(4)
|
@RetryingTest(4)
|
||||||
|
@Disabled("b/197534789")
|
||||||
void testReplayFromLastTxn() {
|
void testReplayFromLastTxn() {
|
||||||
TestObject foo = TestObject.create("foo");
|
TestObject foo = TestObject.create("foo");
|
||||||
TestObject bar = TestObject.create("bar");
|
TestObject bar = TestObject.create("bar");
|
||||||
|
@ -142,6 +145,7 @@ public class ReplicateToDatastoreActionTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@RetryingTest(4)
|
@RetryingTest(4)
|
||||||
|
@Disabled("b/197534789")
|
||||||
void testUnintentionalConcurrency() {
|
void testUnintentionalConcurrency() {
|
||||||
TestObject foo = TestObject.create("foo");
|
TestObject foo = TestObject.create("foo");
|
||||||
TestObject bar = TestObject.create("bar");
|
TestObject bar = TestObject.create("bar");
|
||||||
|
@ -177,6 +181,7 @@ public class ReplicateToDatastoreActionTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@RetryingTest(4)
|
@RetryingTest(4)
|
||||||
|
@Disabled("b/197534789")
|
||||||
void testMissingTransactions() {
|
void testMissingTransactions() {
|
||||||
// Write a transaction (should have a transaction id of 1).
|
// Write a transaction (should have a transaction id of 1).
|
||||||
TestObject foo = TestObject.create("foo");
|
TestObject foo = TestObject.create("foo");
|
||||||
|
@ -194,6 +199,7 @@ public class ReplicateToDatastoreActionTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@Disabled("b/197534789")
|
||||||
void testMissingTransactions_fullTask() {
|
void testMissingTransactions_fullTask() {
|
||||||
// Write a transaction (should have a transaction id of 1).
|
// Write a transaction (should have a transaction id of 1).
|
||||||
TestObject foo = TestObject.create("foo");
|
TestObject foo = TestObject.create("foo");
|
||||||
|
@ -212,6 +218,7 @@ public class ReplicateToDatastoreActionTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@Disabled("b/197534789")
|
||||||
void testBeforeDatastoreSaveCallback() {
|
void testBeforeDatastoreSaveCallback() {
|
||||||
TestObject testObject = TestObject.create("foo");
|
TestObject testObject = TestObject.create("foo");
|
||||||
insertInDb(testObject);
|
insertInDb(testObject);
|
||||||
|
@ -221,6 +228,7 @@ public class ReplicateToDatastoreActionTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@Disabled("b/197534789")
|
||||||
void testNotInMigrationState_doesNothing() {
|
void testNotInMigrationState_doesNothing() {
|
||||||
// set a schedule that backtracks the current status to DATASTORE_PRIMARY
|
// set a schedule that backtracks the current status to DATASTORE_PRIMARY
|
||||||
DateTime now = fakeClock.nowUtc();
|
DateTime now = fakeClock.nowUtc();
|
||||||
|
@ -257,6 +265,7 @@ public class ReplicateToDatastoreActionTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@Disabled("b/197534789")
|
||||||
void testFailure_cannotAcquireLock() {
|
void testFailure_cannotAcquireLock() {
|
||||||
RequestStatusChecker requestStatusChecker = mock(RequestStatusChecker.class);
|
RequestStatusChecker requestStatusChecker = mock(RequestStatusChecker.class);
|
||||||
when(requestStatusChecker.getLogId()).thenReturn("logId");
|
when(requestStatusChecker.getLogId()).thenReturn("logId");
|
||||||
|
|
|
@ -38,7 +38,6 @@ import google.registry.persistence.transaction.Transaction.Delete;
|
||||||
import google.registry.persistence.transaction.Transaction.Mutation;
|
import google.registry.persistence.transaction.Transaction.Mutation;
|
||||||
import google.registry.persistence.transaction.Transaction.Update;
|
import google.registry.persistence.transaction.Transaction.Update;
|
||||||
import google.registry.persistence.transaction.TransactionEntity;
|
import google.registry.persistence.transaction.TransactionEntity;
|
||||||
import google.registry.util.RequestStatusChecker;
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
@ -46,7 +45,6 @@ import javax.annotation.Nullable;
|
||||||
import org.junit.jupiter.api.extension.AfterEachCallback;
|
import org.junit.jupiter.api.extension.AfterEachCallback;
|
||||||
import org.junit.jupiter.api.extension.BeforeEachCallback;
|
import org.junit.jupiter.api.extension.BeforeEachCallback;
|
||||||
import org.junit.jupiter.api.extension.ExtensionContext;
|
import org.junit.jupiter.api.extension.ExtensionContext;
|
||||||
import org.mockito.Mockito;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A JUnit extension that replays datastore transactions against postgresql.
|
* A JUnit extension that replays datastore transactions against postgresql.
|
||||||
|
@ -83,11 +81,13 @@ public class ReplayExtension implements BeforeEachCallback, AfterEachCallback {
|
||||||
* Create a replay extension that replays from SQL to cloud datastore when running in SQL mode.
|
* Create a replay extension that replays from SQL to cloud datastore when running in SQL mode.
|
||||||
*/
|
*/
|
||||||
public static ReplayExtension createWithDoubleReplay(FakeClock clock) {
|
public static ReplayExtension createWithDoubleReplay(FakeClock clock) {
|
||||||
return new ReplayExtension(
|
// TODO: use the proper double-replay extension when the tests are not flaky
|
||||||
clock,
|
// return new ReplayExtension(
|
||||||
true,
|
// clock,
|
||||||
new ReplicateToDatastoreAction(
|
// true,
|
||||||
clock, Mockito.mock(RequestStatusChecker.class), new FakeResponse()));
|
// new ReplicateToDatastoreAction(
|
||||||
|
// clock, Mockito.mock(RequestStatusChecker.class), new FakeResponse()));
|
||||||
|
return createWithCompare(clock);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue