It is too slow testing Datastore locally when use LocalDatastoreHelper
It is too slow testing Datastore locally when we use com.google.cloud.datastore.testing.LocalDatastoreHelper in google-cloud-0.4.0 with cloud-datastore-emulator 1.2.1.
I figure out LocalDatastoreHelper define private static final String GCD_VERSION = "1.2.0"; and lastest gcloud datastore version is cloud-datastore-emulator 1.2.1 (gcloud-tools current version is 128.0.0). So, when we test by using LocalDatastoreHelper, it cannot find the cloud-datastore-emulator 1.2.0 version in gcloud path, and as result, it ends up making download of cloud-datastore-emulator 1.2.1 for each test case.
To solve this problem, I had to downgrade the gcloud-tools to 125.0.0.
@pauloleitemoreira thanks for the report. You are right, there are 2 problems here:
- The version we specify in
GCD_VERSIONis the minimum required to successfully run the tests. We allow using an already installed version of the emulator but only if the version is an exact match (we don't check if the installed version is more recent yet). This is something we need to fix. - It's odd that the emulator is re-downloaded with every test case.
LocalDatastoreHelpershould reuse previously downloaded emulators. This is a bug that you spotted, we did not update the value ofMD5_CHECKSUMto match version1.2.0, hence the emulator is always re-downloaded.
I can fix 2. right away. I'll need some more time to start working on 1.