Skip to content
This repository has been archived by the owner on Oct 9, 2023. It is now read-only.

Implement UserManager #47

Merged
merged 84 commits into from
Jul 7, 2023
Merged

Conversation

dmikhalin
Copy link
Contributor

@dmikhalin dmikhalin commented Jun 9, 2023

What is the goal of this PR?

We implement UserManager.

What are the changes implemented in this PR?

We implemented:

  • User struct and UserManager
  • corresponding BDD steps

As UserManager BDD scenarios have to be run on typedb-cluster, we changed the default connection in Context to cluster connection, and run all behaviour tests on cluster. We added waiting to some steps because of eventual consistency of typedb-cluster.

@typedb-bot
Copy link
Member

typedb-bot commented Jun 9, 2023

PR Review Checklist

Do not edit the content of this comment. The PR reviewer should simply update this comment by ticking each review item below, as they get completed.


Trivial Change

  • This change is trivial and does not require a code or architecture review.

Code

  • Packages, classes, and methods have a single domain of responsibility.
  • Packages, classes, and methods are grouped into cohesive and consistent domain model.
  • The code is canonical and the minimum required to achieve the goal.
  • Modules, libraries, and APIs are easy to use, robust (foolproof and not errorprone), and tested.
  • Logic and naming has clear narrative that communicates the accurate intent and responsibility of each module (e.g. method, class, etc.).
  • The code is algorithmically efficient and scalable for the whole application.

Architecture

  • Any required refactoring is completed, and the architecture does not introduce technical debt incidentally.
  • Any required build and release automations are updated and/or implemented.
  • Any new components follows a consistent style with respect to the pre-existing codebase.
  • The architecture intuitively reflects the application domain, and is easy to understand.
  • The architecture has a well-defined hierarchy of encapsulated components.
  • The architecture is extensible and scalable.

@dmikhalin dmikhalin self-assigned this Jun 9, 2023
@dmitrii-ubskii dmitrii-ubskii changed the base branch from master to api-rearchitecture June 12, 2023 10:07
@dmikhalin dmikhalin requested a review from dmitrii-ubskii July 5, 2023 09:12
tests/behaviour/util.rs Outdated Show resolved Hide resolved
tests/behaviour/util.rs Outdated Show resolved Hide resolved
tests/behaviour/connection/steps.rs Outdated Show resolved Hide resolved
tests/behaviour/connection/database/steps.rs Outdated Show resolved Hide resolved
src/connection/network/stub.rs Outdated Show resolved Hide resolved
src/connection/network/stub.rs Outdated Show resolved Hide resolved
src/connection/connection.rs Outdated Show resolved Hide resolved
src/connection/connection.rs Outdated Show resolved Hide resolved
src/connection/connection.rs Outdated Show resolved Hide resolved
@dmikhalin dmikhalin requested a review from dmitrii-ubskii July 5, 2023 11:31
src/connection/network/stub.rs Outdated Show resolved Hide resolved
src/connection/connection.rs Outdated Show resolved Hide resolved
src/connection/connection.rs Outdated Show resolved Hide resolved
src/user/user_manager.rs Outdated Show resolved Hide resolved
tests/behaviour/mod.rs Outdated Show resolved Hide resolved
Comment on lines +110 to +112
pub async fn cleanup_databases(&mut self) {
try_join_all(self.databases.all().await.unwrap().into_iter().map(Database::delete)).await.ok();
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

We ignore possible errors that could appear when database is still in all() but is already deleted.

Comment on lines 100 to 102
source tools/start-cluster-servers.sh # use source to receive export vars
bazel test //tests --test_env=ROOT_CA=$ROOT_CA --test_arg=-- --test_arg=behaviour::concept --test_arg=--test-threads=1 --test_output=streamed && export TEST_SUCCESS=0 || export TEST_SUCCESS=1
tools/stop-cluster-servers.sh
Copy link
Member

@flyingsilverfin flyingsilverfin Jul 6, 2023

Choose a reason for hiding this comment

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

we should make two sets of tests in automation.yml: one for cluster (test-behaviour-concept-cluster) and (test-behaviour-concept-core)

Same pattern for behaviour-typeql and the rest

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We decided that it's out of the scope now. https://github.com/vaticle/typedb-client-rust/issues/52

Comment on lines 113 to 114
source tools/start-cluster-servers.sh # use source to receive export vars
bazel test //tests --test_env=ROOT_CA=$ROOT_CA --test_arg=-- --test_arg=behaviour::connection --test_arg=--test-threads=1 --test_output=streamed && export TEST_SUCCESS=0 || export TEST_SUCCESS=1
Copy link
Member

Choose a reason for hiding this comment

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

I've made a comment on typedb/typedb-common#147 to implement root CA & TLS support in the TypeDB runner. I don't think it currently is able to do that.

tests/behaviour/connection/user/steps.rs Show resolved Hide resolved
tests/behaviour/mod.rs Outdated Show resolved Hide resolved
tests/integration/user.rs Outdated Show resolved Hide resolved
@dmikhalin dmikhalin requested a review from flyingsilverfin July 6, 2023 12:06
bazel test //tests --test_arg=-- --test_arg=behaviour::concept --test_arg=--test-threads=1 --test_output=streamed && export TEST_SUCCESS=0 || export TEST_SUCCESS=1
tools/stop-core-server.sh
source tools/start-cluster-servers.sh # use source to receive export vars
bazel test //tests --test_env=ROOT_CA=$ROOT_CA --test_arg=-- --test_arg=behaviour::concept --test_arg=--test-threads=1 --test_output=streamed && export TEST_SUCCESS=0 || export TEST_SUCCESS=1
Copy link
Member

Choose a reason for hiding this comment

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

couple more extra --test-threads=1 here and below

@dmikhalin dmikhalin merged commit 388b472 into typedb:api-rearchitecture Jul 7, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants