Skip to content

Commit

Permalink
Add push test from registered repo
Browse files Browse the repository at this point in the history
  • Loading branch information
rmn-boiko committed Oct 16, 2024
1 parent 1ba2367 commit 0657621
Show file tree
Hide file tree
Showing 2 changed files with 81 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/e2e/app/cli/inmem/tests/tests/test_smart_transfer_protocol.rs
Original file line number Diff line number Diff line change
Expand Up @@ -125,3 +125,14 @@ kamu_cli_execute_command_e2e_test!(
);

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

kamu_cli_run_api_server_e2e_test!(
storage = inmem,
fixture = kamu_cli_e2e_repo_tests::test_smart_push_from_registered_repo,
options = Options::default()
.with_multi_tenant()
.with_today_as_frozen_system_time(),
extra_test_groups = "engine, ingest, datafusion"
);

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
70 changes: 70 additions & 0 deletions src/e2e/app/cli/repo-tests/src/test_smart_transfer_protocol.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1283,3 +1283,73 @@ pub async fn test_smart_pull_derivative(kamu: KamuCliPuppet) {
}

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

pub async fn test_smart_push_from_registered_repo(kamu_api_server_client: KamuApiServerClient) {
let dataset_alias = DatasetAlias::new(
Some(AccountName::new_unchecked("e2e-user")),
DatasetName::new_unchecked("player-scores"),
);
let kamu_api_server_dataset_endpoint =
kamu_api_server_client.get_dataset_endpoint(&dataset_alias);

// 1. Grub a token
let token = kamu_api_server_client.login_as_e2e_user().await;

// 2. Pushing the dataset to the API server
{
let kamu_in_push_workspace = KamuCliPuppet::new_workspace_tmp().await;

// 2.1. Add the dataset
{
kamu_in_push_workspace
.execute_with_input(["add", "--stdin"], DATASET_ROOT_PLAYER_SCORES_SNAPSHOT_STR)
.await
.success();
}

// 2.1. Ingest data to the dataset
{
kamu_in_push_workspace
.ingest_data(
&dataset_alias.dataset_name,
DATASET_ROOT_PLAYER_SCORES_INGEST_DATA_NDJSON_CHUNK_1,
)
.await;
}

// 2.2. Login to the API server
kamu_in_push_workspace
.execute([
"login",
kamu_api_server_client.get_base_url().as_str(),
"--access-token",
token.as_str(),
])
.await
.success();

// 2.3. Push the dataset to the API server without too argument
kamu_in_push_workspace
.assert_success_command_execution(
["push", dataset_alias.dataset_name.as_str()],
None,
Some(["1 dataset(s) pushed"]),
)
.await;
}

// 3. Pulling the dataset from the API server
{
let kamu_in_pull_workspace = KamuCliPuppet::new_workspace_tmp().await;

kamu_in_pull_workspace
.assert_success_command_execution(
["pull", kamu_api_server_dataset_endpoint.as_str()],
None,
Some(["1 dataset(s) updated"]),
)
.await;
}
}

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

0 comments on commit 0657621

Please sign in to comment.