googleapis / java-datastore

Apache License 2.0
47 stars 43 forks source link

Starting LocalDatastoreHelper stalls if `beta` gcloud component is not installed #302

Open pomu0325 opened 3 years ago

pomu0325 commented 3 years ago

Environment details

Steps to reproduce

  1. Remove beta component: gcloud components remove beta
  2. Run the code which uses LocalDatastoreHelper

Code example

import com.google.cloud.datastore.testing.LocalDatastoreHelper;

public class Test {
  public static void main(String[] args) throws Exception {
    LocalDatastoreHelper emulator = LocalDatastoreHelper.create();
    emulator.start();

    System.out.println("Started!");
  }
}

How I found this

Your current Cloud SDK version is: 322.0.0 Installing components from version: 322.0.0

┌─────────────────────────────────────────────┐ │ These components will be installed. │ ├──────────────────────┬────────────┬─────────┤ │ Name │ Version │ Size │ ├──────────────────────┼────────────┼─────────┤ │ gcloud Beta Commands │ 2019.05.17 │ < 1 MiB │ └──────────────────────┴────────────┴─────────┘

For the latest full release notes, please visit: https://cloud.google.com/sdk/release_notes

Do you want to continue (Y/n)?



#### Possible solution

Add `--quiet` option to run emulator, so as to silently install `beta` component.
https://github.com/pomu0325/java-datastore/commit/e2cb8f26e977c6c220ba047fe28f4ca1c3da7d40
crwilcox commented 3 years ago

It seems the issue here is likely that the process is blocking on https://github.com/googleapis/java-datastore/blob/master/google-cloud-datastore/src/main/java/com/google/cloud/datastore/testing/LocalDatastoreHelper.java#L273 which never occurs as the components aren't present.

Perhaps this method https://github.com/googleapis/java-core/blob/375983090b3700b3fb6a1953626db7efca49cc51/google-cloud-core/src/main/java/com/google/cloud/testing/BaseEmulatorHelper.java#L94 needs a timeout?

meredithslota commented 1 year ago

@prash-mi Can you or @jainsahab take a look?