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

Writing quickstart + test for Bigtable #1431

Merged
merged 17 commits into from
Jun 3, 2019
Merged

Writing quickstart + test for Bigtable #1431

merged 17 commits into from
Jun 3, 2019

Conversation

billyjacobson
Copy link
Member

No description provided.

@billyjacobson billyjacobson requested a review from a team May 21, 2019 21:11
@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label May 21, 2019
Copy link
Contributor

@lesv lesv left a comment

Choose a reason for hiding this comment

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

Isn't there a pom.xml or something to build & test this? I hate to just check in something that can't be built on an automated basis.
@kurtisvg FYI

@kurtisvg
Copy link
Contributor

Isn't there a pom.xml or something to build & test this

Looks like the pom here is being used.

@billyjacobson
Copy link
Member Author

billyjacobson commented May 23, 2019

Isn't there a pom.xml or something to build & test this? I hate to just check in something that can't be built on an automated basis.
@kurtisvg FYI

Sorry, I put out the stuff with the pom in a separate PR cus that code was already existing, but this code is all new. You already reviewed that other PR though. Is there a way to trigger the tests to run for this submit?

@kurtisvg
Copy link
Contributor

Oh the reason this isn't running tests is because it's not being merged to master. Do you want to merge them into the master branch?

@billyjacobson billyjacobson changed the base branch from bigtable-veneer-samples to master May 23, 2019 16:48
@billyjacobson billyjacobson requested a review from lesv May 24, 2019 18:45
@lesv
Copy link
Contributor

lesv commented May 24, 2019 via email

@kurtisvg kurtisvg requested review from kurtisvg and removed request for lesv May 24, 2019 19:18
@kurtisvg kurtisvg added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label May 30, 2019
@kokoro-team kokoro-team removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label May 30, 2019
@billyjacobson billyjacobson requested a review from kurtisvg June 3, 2019 17:38
Copy link
Contributor

@kurtisvg kurtisvg left a comment

Choose a reason for hiding this comment

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

LGTM

@BeforeClass
public static void beforeClass() throws IOException {
projectId = System.getProperty(PROJECT_PROPERTY_NAME);
projectId = requireEnv("GOOGLE_CLOUD_PROJECT");
if (projectId == null) {
Copy link
Contributor

Choose a reason for hiding this comment

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

requireEnv should throw an error if projectID is null, so you can remove this check

@billyjacobson billyjacobson merged commit 1a491c8 into master Jun 3, 2019
@billyjacobson billyjacobson deleted the cbt-quickstart branch June 3, 2019 19:49

} catch (Exception e) {
System.out.println("Error during functionName: \n" + e.toString());
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we collapse the try-catch blocks into one?

try (BigtableDataClient dataClient = BigtableDataClient.create(settings)) {
...
} catch (NotFoundException e) {
   System.err.println("Failed to read from a non-existent table: " + e.getMessage());
} catch (Exception e) {
   System.out.println("Error during functionName: \n" + e.toString());
 }

}

} catch (Exception e) {
System.out.println("Error during functionName: \n" + e.toString());
Copy link
Contributor

Choose a reason for hiding this comment

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

Whats functionName?

Copy link
Contributor

Choose a reason for hiding this comment

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

Also, please use System.err

@@ -40,8 +40,7 @@
/** Integration tests for {@link HelloWorld} */
public class HelloWorldTest {

private static final String PROJECT_PROPERTY_NAME = "bigtable.project";
private static final String INSTANCE_PROPERTY_NAME = "bigtable.instance";
private static final String INSTANCE_PROPERTY_NAME = "BIGTABLE_TESTING_INSTANCE";
Copy link
Contributor

Choose a reason for hiding this comment

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

These shouldn't be called properties any more since its using env var now

assertNotNull(
System.getenv(varName),
"System property '%s' is required to perform these tests.".format(varName));
return System.getenv(varName);
Copy link
Contributor

Choose a reason for hiding this comment

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

you can combine the return here:

return assertNotNull(
        System.getenv(varName),
        "System property '%s' is required to perform these tests.".format(varName));

Copy link
Member Author

Choose a reason for hiding this comment

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

assertNotNull doesn't return the value of System.getenv(varName)

Copy link
Contributor

Choose a reason for hiding this comment

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

Oops, I thought you were using Preconditions.checkNotNull, which does. Any reason not to use that?

assertNotNull(
System.getenv(varName),
"System property '%s' is required to perform these tests.".format(varName));
return System.getenv(varName);
Copy link
Contributor

Choose a reason for hiding this comment

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

Same as above

public class QuickstartTest {

private static final String INSTANCE_PROPERTY_NAME = "BIGTABLE_TESTING_INSTANCE";
private static final String TABLE_ID = "quickstart-table";
Copy link
Contributor

Choose a reason for hiding this comment

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

Please don't hardcode the table id, it will cause these tests to be flaky when multiple PRs are opened

}

@Before
public void setupStream() {
Copy link
Contributor

Choose a reason for hiding this comment

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

Please use the junit convention of calling this setUp()

assertNotNull(
System.getenv(varName),
"System property '%s' is required to perform these tests.".format(varName));
return System.getenv(varName);
Copy link
Contributor

Choose a reason for hiding this comment

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

Same as above


public class Quickstart {

public static void quickstart(String projectId, String instanceId, String tableId) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Please include a main()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes This human has signed the Contributor License Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants