mirror of
https://github.com/google/nomulus.git
synced 2025-07-10 13:13:28 +02:00
Relax premium list existence check to allow Cloud SQL migration (#428)
* Relax premium list existence check to allow Cloud SQL migration We need to be able to simultaneously update premium lists that already exist in Datastore and create them in Cloud SQL (because they haven't been migrated over yet). This temporarily relaxes the existence check for Cloud SQL so that "updates" will work even when the list doesn't yet exist there.
This commit is contained in:
parent
8fb12d21a2
commit
eb7d779bc8
2 changed files with 12 additions and 4 deletions
|
@ -66,10 +66,15 @@ public class PremiumListDao {
|
||||||
jpaTm()
|
jpaTm()
|
||||||
.transact(
|
.transact(
|
||||||
() -> {
|
() -> {
|
||||||
checkArgument(
|
// This check is currently disabled because, during the Cloud SQL migration, we need
|
||||||
checkExists(premiumList.getName()),
|
// to be able to update premium lists in Datastore while simultaneously creating their
|
||||||
"Can't update non-existent premium list '%s'",
|
// first revision in Cloud SQL (i.e. if they haven't been migrated over yet).
|
||||||
premiumList.getName());
|
// TODO(b/147246613): Reinstate this once all premium lists are migrated to Cloud SQL,
|
||||||
|
// and re-enable the test update_throwsWhenListDoesntExist().
|
||||||
|
// checkArgument(
|
||||||
|
// checkExists(premiumList.getName()),
|
||||||
|
// "Can't update non-existent premium list '%s'",
|
||||||
|
// premiumList.getName());
|
||||||
jpaTm().getEntityManager().persist(premiumList);
|
jpaTm().getEntityManager().persist(premiumList);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,6 +35,7 @@ import java.math.BigDecimal;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import org.joda.money.CurrencyUnit;
|
import org.joda.money.CurrencyUnit;
|
||||||
import org.joda.money.Money;
|
import org.joda.money.Money;
|
||||||
|
import org.junit.Ignore;
|
||||||
import org.junit.Rule;
|
import org.junit.Rule;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
|
@ -125,7 +126,9 @@ public class PremiumListDaoTest {
|
||||||
assertThat(thrown).hasMessageThat().isEqualTo("Premium list 'testlist' already exists");
|
assertThat(thrown).hasMessageThat().isEqualTo("Premium list 'testlist' already exists");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO(b/147246613): Un-ignore this.
|
||||||
@Test
|
@Test
|
||||||
|
@Ignore
|
||||||
public void update_throwsWhenListDoesntExist() {
|
public void update_throwsWhenListDoesntExist() {
|
||||||
IllegalArgumentException thrown =
|
IllegalArgumentException thrown =
|
||||||
assertThrows(
|
assertThrows(
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue