Skip to content

Add smoke tests for LedgerHandleAdv and TailingReads#1389

Closed
sijie wants to merge 2 commits intoapache:masterfrom
sijie:more_integration_tests
Closed

Add smoke tests for LedgerHandleAdv and TailingReads#1389
sijie wants to merge 2 commits intoapache:masterfrom
sijie:more_integration_tests

Conversation

@sijie
Copy link
Copy Markdown
Member

@sijie sijie commented May 4, 2018

Descriptions of the changes in this PR:

Add two tests:

  • basic writes/reads with LedgerHandleAdv
  • tailing reads with LedgerHandle

@sijie sijie added this to the 4.8.0 milestone May 4, 2018
@sijie sijie self-assigned this May 4, 2018
@sijie sijie requested review from dlg99, ivankelly and jvrao May 4, 2018 02:05
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

@Slf4j
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

👍 we may need another chance to do a cleanup with Lombok.

Copy link
Copy Markdown
Member

@jiazhai jiazhai left a comment

Choose a reason for hiding this comment

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

+1

Copy link
Copy Markdown
Contributor

@ivankelly ivankelly left a comment

Choose a reason for hiding this comment

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

Couple of nits, but lgtm

<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<javac.target>1.8</javac.target>
<redirectTestOutputToFile>true</redirectTestOutputToFile>
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Separate change, should be separate PR

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I am changing the variable ONLY in the smoke test module, which is the module I am testing. I am not touching any other places that have this flag. so I am not sure if it really needs to be a separated PR, but if you feel strong, I can do it in a separate PR.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

it's fine for this PR, but in future, changes like this should be separate.

String zookeeper = BookKeeperClusterUtils.zookeeperConnectString(docker);
@Cleanup BookKeeper bk = new BookKeeper(zookeeper);
@Cleanup LedgerHandle writeLh = bk.createLedger(DigestType.CRC32C, PASSWD);
@Cleanup("shutdown") ExecutorService writeExecutor = Executors.newSingleThreadExecutor(
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nit: A fixed thread pool with numThreads = 2, would reduce the amout of cleanup.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

it is much clear to have two seperated thread pools with different names for debugging purpose.


// start the read thread
readExecutor.submit(() -> {
long lastEntryId = numEntries - 2;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

A comment for where the -2 comes from would be useful. Maybe rename to lastExpectedConfirmedEntryId to make it clear its not the last entry written, but the entry before the last entry written, and hence the last confirmed.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

done. fixed

CompletableFuture<Void> writeFuture = new CompletableFuture<>();

// start the read thread
readExecutor.submit(() -> {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nit: If you coerce the lambda to a callable, your can assign readFuture directly from submit, and skip the try-catch

Future<?> readFuture = readExecutor.submit((Callable<Void>)() -> ...);

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I wrote it in a try-catch block so that I can write log statements.

@@ -48,42 +55,143 @@ public class TestSmoke {
private String currentVersion = System.getProperty("currentVersion");

@Before
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

These could be beforeClass and afterClass, since there's no need to have a clean cluster for the different api tests.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I am not sure beforeClass and afterClass work in arquillian tests. (I could be wrong, but that was my impression from Ali)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

now that you mention it, that could be the case. I think I tried to move the init metadata stuff to beforeClass before, and it refused to work

@ivankelly
Copy link
Copy Markdown
Contributor

lgtm #shipit

@sijie
Copy link
Copy Markdown
Member Author

sijie commented May 5, 2018

retest this please

@sijie
Copy link
Copy Markdown
Member Author

sijie commented May 6, 2018

the change is about IT tests. All the IT tests passed. so going to ignore CI in order to merge it.

@sijie
Copy link
Copy Markdown
Member Author

sijie commented May 6, 2018

IGNORE CI

@sijie sijie closed this in e77a80a May 6, 2018
sijie added a commit that referenced this pull request May 12, 2018
Descriptions of the changes in this PR:

Add two tests:

- basic writes/reads with LedgerHandleAdv
- tailing reads with LedgerHandle

Author: Sijie Guo <sijie@apache.org>

Reviewers: Ivan Kelly <ivank@apache.org>, Enrico Olivelli <eolivelli@gmail.com>, Jia Zhai <None>

This closes #1389 from sijie/more_integration_tests
@sijie sijie deleted the more_integration_tests branch July 16, 2018 02:46
reddycharan pushed a commit to reddycharan/bookkeeper that referenced this pull request Oct 17, 2018
Descriptions of the changes in this PR:

Add two tests:

- basic writes/reads with LedgerHandleAdv
- tailing reads with LedgerHandle

Author: Sijie Guo <sijie@apache.org>

Reviewers: Ivan Kelly <ivank@apache.org>, Enrico Olivelli <eolivelli@gmail.com>, Jia Zhai <None>

This closes apache#1389 from sijie/more_integration_tests

Signed-off-by: JV Jujjuri <vjujjuri@salesforce.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants