Skip to content
This repository was archived by the owner on Jul 12, 2023. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,9 @@ private void assertGcloudDatastoreEmulator() {
var activeRunner = activeRunnerField.get(helper);
return activeRunner.getClass();
}).get();
if (!runnerClass.getName().equals("com.google.cloud.testing.BaseEmulatorHelper$GcloudEmulatorRunner")) {
if (!runnerClass.getName().equals("com.google.cloud.testing.BaseEmulatorHelper$GcloudEmulatorRunner")
&& !runnerClass.getName().equals("com.google.cloud.testing.BaseEmulatorHelper$DownloadableEmulatorRunner"))
{
throw new AssertionError("Not using gcloud sdk datastore emulator, please run: "
+ "gcloud components install beta cloud-datastore-emulator");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,12 @@
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.nullValue;
import static org.junit.Assert.fail;

import com.google.cloud.datastore.Datastore;
import com.google.cloud.datastore.Entity;
import junitparams.JUnitParamsRunner;
import junitparams.Parameters;
import org.hamcrest.Matchers;
import org.junit.Assert;
import org.junit.ClassRule;
import org.junit.Rule;
import org.junit.Test;
Expand Down Expand Up @@ -64,12 +63,13 @@ public void testEmulator(Datastore client) {
}

@Test
public void shouldFailIfNotGcloudEmulator() throws InterruptedException {
environmentVariables.clear("PATH");
public void shouldBeGcloudEmulator() {
var emulator = new DatastoreEmulator();

var exception = Assert.assertThrows(AssertionError.class, emulator::before);

assertThat(exception.getMessage(), Matchers.startsWith("Not using gcloud sdk datastore emulator"));
try {
emulator.before();
} catch (Exception e) {
fail("Not using gcloud sdk datastore emulator");
}
}
}