Skip to content

Add integration tests, Docker on CI, and implement waitForPendingUpdate #32

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

Merged
merged 7 commits into from
Oct 8, 2020

Conversation

eskombro
Copy link
Member

@eskombro eskombro commented Oct 6, 2020

The goal for this PR is:

(it will be mandatory to pass integration tests for merging a PR into master after this PR is merged)

Related to this issue: @niemannd propose some unit testing in #31

Closes #14
Closes #23

@eskombro eskombro marked this pull request as ready for review October 6, 2020 07:27
@eskombro eskombro force-pushed the add_integration_tests branch from 2642014 to 412140e Compare October 6, 2020 07:41
@eskombro eskombro marked this pull request as draft October 6, 2020 07:52
@eskombro eskombro linked an issue Oct 6, 2020 that may be closed by this pull request
@eskombro eskombro marked this pull request as ready for review October 6, 2020 08:11
@eskombro eskombro force-pushed the add_integration_tests branch 8 times, most recently from e7a7579 to f4e3b6f Compare October 6, 2020 13:34
@eskombro eskombro force-pushed the add_integration_tests branch from f4e3b6f to 2278605 Compare October 6, 2020 15:10
@eskombro eskombro requested a review from curquiza October 6, 2020 16:12
@eskombro eskombro self-assigned this Oct 6, 2020
@eskombro eskombro changed the title Add integration tests Add integration tests, CI, and implement waitForPendingUpdate Oct 6, 2020
@eskombro eskombro changed the title Add integration tests, CI, and implement waitForPendingUpdate Add integration tests, Docker on CI, and implement waitForPendingUpdate Oct 6, 2020
curquiza
curquiza previously approved these changes Oct 6, 2020
Copy link
Member

@curquiza curquiza left a comment

Choose a reason for hiding this comment

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

Two useless suggestions 😇
Great work, I approve!

* @param intervalInMs number of milliseconds before requesting the status again
* @throws Exception if timeout is reached
*/
public void waitForPendingUpdate(int updateId, int timeoutInMs, int intervalInMs) throws Exception {
Copy link
Contributor

Choose a reason for hiding this comment

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

maybe something like a CompletableFuture<UpdateStatus> would be better for something like this.
Supply the updateId -> thenApply(...) the while loop -> call .get(timeout)

@eskombro eskombro requested a review from niemannd October 7, 2020 15:15
Comment on lines 23 to 36
public String moviesFileToString () {
String content = "";
String filePath = "src/test/java/com/meilisearch/sdk/movies.json";
try
{
content = new String ( Files.readAllBytes( Paths.get(filePath) ) );
}
catch (IOException e)
{
e.printStackTrace();
}
this.movies_data = content;
return content;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

please put the json file unter src/test/resources/movies.json
src/test/java should only contain java files

Also, please load the File from classpath.
This way we can move around our source files without to worry about where the json is located ;)

Comment on lines +14 to +16
String movies_data;
Movie[] movies = new Movie[10];
Gson gson = new Gson();
Copy link
Contributor

Choose a reason for hiding this comment

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

more of a general point: unless you really need fields package private, just declare them as private.
helps to avoid other parts of the program fucking around with the internal state of the class.

@eskombro
Copy link
Member Author

eskombro commented Oct 8, 2020

@niemannd thanks for your review!

@eskombro eskombro merged commit 0474852 into master Oct 8, 2020
@curquiza curquiza deleted the add_integration_tests branch November 25, 2020 14:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add WaitForPendingUpdate method Fix integration tests and add CI
3 participants