Skip to content

Commit

Permalink
test: skip test on emulator (#377)
Browse files Browse the repository at this point in the history
Skip GapicSpannerRpcTest when an emulator host has been set, as the
test interferes with the check whether the emulator is running.
  • Loading branch information
olavloite committed Aug 7, 2020
1 parent 7ac6a63 commit aca215d
Showing 1 changed file with 9 additions and 0 deletions.
Expand Up @@ -20,6 +20,7 @@
import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.Assume.assumeTrue;

import com.google.api.core.ApiFunction;
import com.google.auth.oauth2.AccessToken;
Expand Down Expand Up @@ -71,6 +72,7 @@
import java.util.regex.Pattern;
import org.junit.After;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
Expand Down Expand Up @@ -128,6 +130,13 @@ public class GapicSpannerRpcTest {
private InetSocketAddress address;
private final Map<SpannerRpc.Option, Object> optionsMap = new HashMap<>();

@BeforeClass
public static void checkNotEmulator() {
assumeTrue(
"Skip tests when emulator is enabled as this test interferes with the check whether the emulator is running",
System.getenv("SPANNER_EMULATOR_HOST") == null);
}

@Before
public void startServer() throws IOException {
mockSpanner = new MockSpannerServiceImpl();
Expand Down

0 comments on commit aca215d

Please sign in to comment.