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

test: add integration tests #493

Merged
merged 7 commits into from
Feb 26, 2022
Merged

test: add integration tests #493

merged 7 commits into from
Feb 26, 2022

Conversation

tisonkun
Copy link
Contributor

This closes #226.

Signed-off-by: tison <wander4096@gmail.com>
Signed-off-by: tison <wander4096@gmail.com>
use crate::create_universe;

#[tokio::test]
#[ignore]
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Executed by cargo test --test it -p engula-client -- --ignored.

Copy link

Choose a reason for hiding this comment

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

It looks like you've deliberately ignored all integration tests, why?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Integration tests require running services which differs from unit tests.

I actually have two ideas here.

The one is as this and run all unit tests by cargo test --workspace.

The other could be not to ignore any test and running test with exact package and pattern for both unit tests and integration tests.

Copy link

Choose a reason for hiding this comment

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

Got it, in fact, this is equivalent to providing control to run unit tests and integration tests separately.

I think this is great, especially when there is a relatively clear boundary between unit tests and integration tests.


#[tokio::test]
#[ignore]
async fn test_apis() -> Result<()> {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Can extend to more tests.

Signed-off-by: tison <wander4096@gmail.com>
src/engula/src/server.rs Outdated Show resolved Hide resolved
Signed-off-by: tison <wander4096@gmail.com>

info!(message = "Starting Engula server...", %addr);
let liveness =
Copy link
Contributor

Choose a reason for hiding this comment

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

Why do you add both gRPC health service and another liveness server?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

For running a simplest it case, we don't have to implement it. Let me remove it as overkill.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated. Although, we may want to implement similar logics later.

  1. For a liveness service, it report that the instance is alive. And we'd better implement it in a way that can be easily verified handy.
  2. For health check, it's more complex to define readiness for kernel services, for example, a recovered cooperator may have to rebuild its state. A health service follow gRPC standard enables we to report health status of each gRPC service and tonic_health provides a heath reporter which can be cloned and passed to our kernel services for reporting. However, it can be an overkill for now.

src/client/tests/it/main.rs Outdated Show resolved Hide resolved
src/engula/src/server.rs Outdated Show resolved Hide resolved
docker-compose.yml Outdated Show resolved Hide resolved
Signed-off-by: tison <wander4096@gmail.com>
Signed-off-by: tison <wander4096@gmail.com>
PsiACE
PsiACE previously approved these changes Feb 26, 2022
Copy link
Contributor

@huachaohuang huachaohuang left a comment

Choose a reason for hiding this comment

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

Rest LGTM

src/engula/src/server.rs Outdated Show resolved Hide resolved
Co-authored-by: Richard <huachao.huang@gmail.com>
@huachaohuang huachaohuang merged commit cf3601b into engula:main Feb 26, 2022
@tisonkun tisonkun deleted the e2e branch February 26, 2022 14:17
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 test for engula binary
3 participants