Skip to content

Commit

Permalink
Reuse cli api client
Browse files Browse the repository at this point in the history
  • Loading branch information
rmn-boiko committed Feb 6, 2025
1 parent 39b5bde commit f984a0a
Show file tree
Hide file tree
Showing 14 changed files with 135 additions and 19 deletions.
109 changes: 108 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,10 @@ kamu-task-system-inmem = { git = "https://github.com/kamu-data/kamu-cli", tag =
kamu-task-system-postgres = { git = "https://github.com/kamu-data/kamu-cli", tag = "v0.221.0", version = "0.221.0", default-features = false }
kamu-task-system-sqlite = { git = "https://github.com/kamu-data/kamu-cli", tag = "v0.221.0", version = "0.221.0", default-features = false }

# E2E
#E2E
kamu-cli-e2e-common = { git = "https://github.com/kamu-data/kamu-cli", tag = "v0.221.0", version = "0.221.0", default-features = false }

# Workspace E2E
kamu-node-e2e-common = { path = "src/e2e/app/common", version = "0.53.0", default-features = false }
kamu-node-e2e-common-macros = { path = "src/e2e/app/common-macros", version = "0.53.0", default-features = false }
kamu-node-puppet = { path = "src/e2e/app/kamu-node-puppet", version = "0.53.0", default-features = false }
Expand Down
1 change: 1 addition & 0 deletions src/e2e/app/common/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ doctest = false
[dependencies]
internal-error = { workspace = true }
kamu-adapter-http = { workspace = true }
kamu-cli-e2e-common = { workspace = true }
kamu-node-e2e-common-macros = { workspace = true }
kamu-node-puppet = { workspace = true, default-features = false, features = [
"extensions",
Expand Down
3 changes: 2 additions & 1 deletion src/e2e/app/common/src/e2e_harness.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,13 @@

use std::future::Future;

use kamu_cli_e2e_common::KamuApiServerClient;
use kamu_node_puppet::extensions::KamuNodePuppetExt;
use kamu_node_puppet::{KamuNodePuppet, NewWorkspaceOptions};
use regex::Regex;
use sqlx::{PgPool, SqlitePool};

use crate::{api_server_e2e_test, KamuApiServerClient};
use crate::api_server_e2e_test;

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

Expand Down
3 changes: 1 addition & 2 deletions src/e2e/app/common/src/e2e_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,12 @@ use std::future::Future;
use std::path::PathBuf;

use internal_error::{InternalError, ResultIntoInternal};
use kamu_cli_e2e_common::KamuApiServerClient;
use kamu_node_puppet::extensions::ServerOutput;
use reqwest::Url;
use tokio_retry::strategy::FixedInterval;
use tokio_retry::Retry;

use crate::KamuApiServerClient;

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

pub async fn api_server_e2e_test<ServerRunFut, Fixture, FixtureFut>(
Expand Down
8 changes: 4 additions & 4 deletions src/e2e/app/common/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@

mod e2e_harness;
mod e2e_test;
mod kamu_api_server_client;
mod kamu_api_server_client_ext;
// mod kamu_api_server_client;
// mod kamu_api_server_client_ext;

pub use e2e_harness::*;
pub use e2e_test::*;
pub use kamu_api_server_client::*;
pub use kamu_api_server_client_ext::*;
// pub use kamu_api_server_client::*;
// pub use kamu_api_server_client_ext::*;

pub mod prelude;
2 changes: 1 addition & 1 deletion src/e2e/app/repo-tests/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ normal = ["kamu-node"]


[dependencies]
kamu-node-e2e-common = { workspace = true }
kamu-cli-e2e-common = { workspace = true }
kamu-adapter-http = { workspace = true }
kamu-accounts = { workspace = true }
odf = { workspace = true }
Expand Down
2 changes: 1 addition & 1 deletion src/e2e/app/repo-tests/src/test_accounts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
use std::assert_matches::assert_matches;

use kamu_accounts::{DEFAULT_ACCOUNT_ID, DEFAULT_ACCOUNT_NAME};
use kamu_node_e2e_common::*;
use kamu_cli_e2e_common::{AccountMeError, KamuApiServerClient, KamuApiServerClientExt};

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

Expand Down
11 changes: 8 additions & 3 deletions src/e2e/app/repo-tests/src/test_auth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@

use std::assert_matches::assert_matches;

use kamu_node_e2e_common::{
use kamu_cli_e2e_common::{
GraphQLResponseExt,
KamuApiServerClient,
KamuApiServerClientExt,
LoginError,
Expand Down Expand Up @@ -65,7 +66,9 @@ pub async fn test_kamu_access_token_middleware(mut kamu_api_server_client: KamuA
}
"#,
))
.await;
.await
.data();

let access_token = login_response["auth"]["login"]["accessToken"]
.as_str()
.map(ToOwned::to_owned)
Expand Down Expand Up @@ -103,7 +106,9 @@ pub async fn test_kamu_access_token_middleware(mut kamu_api_server_client: KamuA
.replace("<account_id>", account_id.as_str())
.as_str(),
)
.await;
.await
.data();

let kamu_token = create_token_response["auth"]["createAccessToken"]["token"]["composed"]
.as_str()
.map(ToOwned::to_owned)
Expand Down
2 changes: 1 addition & 1 deletion src/e2e/app/repo-tests/src/test_dataset.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
use std::assert_matches::assert_matches;

use kamu_adapter_http::general::DatasetInfoResponse;
use kamu_node_e2e_common::{
use kamu_cli_e2e_common::{
CreateDatasetResponse,
DatasetByIdError,
KamuApiServerClient,
Expand Down
2 changes: 1 addition & 1 deletion src/e2e/app/repo-tests/src/test_odf_core.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
use std::assert_matches::assert_matches;

use kamu_adapter_http::general::NodeInfoResponse;
use kamu_node_e2e_common::{KamuApiServerClient, KamuApiServerClientExt};
use kamu_cli_e2e_common::{KamuApiServerClient, KamuApiServerClientExt};

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

Expand Down
2 changes: 1 addition & 1 deletion src/e2e/app/repo-tests/src/test_openapi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

use std::path::PathBuf;

use kamu_node_e2e_common::KamuApiServerClient;
use kamu_cli_e2e_common::KamuApiServerClient;
use reqwest::Method;

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
Expand Down
2 changes: 1 addition & 1 deletion src/e2e/app/repo-tests/src/test_selftest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
// the Business Source License, use of this software will be governed
// by the Apache License, Version 2.0.

use kamu_node_e2e_common::KamuApiServerClient;
use kamu_cli_e2e_common::KamuApiServerClient;

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

Expand Down
2 changes: 1 addition & 1 deletion src/e2e/app/repo-tests/src/test_swagger.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

use std::path::PathBuf;

use kamu_node_e2e_common::{KamuApiServerClient, KamuApiServerClientExt};
use kamu_cli_e2e_common::{KamuApiServerClient, KamuApiServerClientExt};

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

Expand Down

0 comments on commit f984a0a

Please sign in to comment.