Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add support to customize gcloud command of LocalDatastoreHelper #137

Merged
merged 8 commits into from Jun 4, 2020
Expand Up @@ -33,6 +33,7 @@
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.concurrent.TimeoutException;
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
Expand All @@ -53,6 +54,11 @@ public void setUp() throws IOException {
dataDir = Files.createTempDirectory("gcd");
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, can you also add a delete in an @After so we're not leaving lots of directories around?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

}

@After
public void tearDown() throws IOException {
Files.delete(dataDir);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Calling Files.delete will fail if it is a directory which is not empty javadoc.

Instead you can use the helper method com.google.cloud.datastore.testing.LocalDatastoreHelper#deleteRecursively by making it package-private.

Copy link
Contributor Author

@athakor athakor Jun 4, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done. PTAL

}

@Test
public void testCreate() {
LocalDatastoreHelper helper = LocalDatastoreHelper.create(0.75);
Expand Down Expand Up @@ -111,6 +117,7 @@ public void testCreateWithToBuilder() throws IOException {
assertTrue(actualHelper.isStoreOnDisk());
assertEquals(9091, actualHelper.getPort());
assertEquals(dataDir, actualHelper.getGcdPath());
Files.delete(dataDir);
}

@Test
Expand Down