Skip to content

Commit

Permalink
E2E, test_new_{root,derivative}(): add
Browse files Browse the repository at this point in the history
  • Loading branch information
s373r committed Oct 9, 2024
1 parent c0d67f5 commit 38f1486
Show file tree
Hide file tree
Showing 4 changed files with 97 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/e2e/app/cli/inmem/tests/tests/commands/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ mod test_ingest_command;
mod test_init_command;
mod test_inspect_command;
mod test_log_command;
mod test_new_command;
mod test_rename_command;
mod test_repo_alias_command;
mod test_sql_command;
Expand Down
26 changes: 26 additions & 0 deletions src/e2e/app/cli/inmem/tests/tests/commands/test_new_command.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// Copyright Kamu Data, Inc. and contributors. All rights reserved.
//
// Use of this software is governed by the Business Source License
// included in the LICENSE file.
//
// As of the Change Date specified in that file, in accordance with
// the Business Source License, use of this software will be governed
// by the Apache License, Version 2.0.

use kamu_cli_e2e_common::prelude::*;

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

kamu_cli_execute_command_e2e_test!(
storage = inmem,
fixture = kamu_cli_e2e_repo_tests::test_new_root,
);

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

kamu_cli_execute_command_e2e_test!(
storage = inmem,
fixture = kamu_cli_e2e_repo_tests::test_new_derivative,
);

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
2 changes: 2 additions & 0 deletions src/e2e/app/cli/repo-tests/src/commands/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ mod test_ingest_command;
mod test_init_command;
mod test_inspect_command;
mod test_log_command;
mod test_new_command;
mod test_rename_command;
mod test_repo_alias_command;
mod test_sql_command;
Expand All @@ -29,6 +30,7 @@ pub use test_ingest_command::*;
pub use test_init_command::*;
pub use test_inspect_command::*;
pub use test_log_command::*;
pub use test_new_command::*;
pub use test_rename_command::*;
pub use test_repo_alias_command::*;
pub use test_sql_command::*;
Expand Down
68 changes: 68 additions & 0 deletions src/e2e/app/cli/repo-tests/src/commands/test_new_command.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
// Copyright Kamu Data, Inc. and contributors. All rights reserved.
//
// Use of this software is governed by the Business Source License
// included in the LICENSE file.
//
// As of the Change Date specified in that file, in accordance with
// the Business Source License, use of this software will be governed
// by the Apache License, Version 2.0.

use kamu_cli_puppet::KamuCliPuppet;

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

pub async fn test_new_root(kamu: KamuCliPuppet) {
let assert = kamu
.execute(["new", "--root", "test-dataset"])
.await
.success();

let stderr = std::str::from_utf8(&assert.get_output().stderr).unwrap();

assert!(
stderr.contains(indoc::indoc!(
r#"
Written new manifest template to: test-dataset.yaml
Follow directions in the file's comments and use `kamu add test-dataset.yaml` when ready.
"#
)),
"Unexpected output:\n{stderr}",
);

// TODO: After solving this issue, add `kamu add` calls and populate with
// data
//
// `kamu new`: generate snapshots that will be immediately ready to be
// added/worked on
// https://github.com/kamu-data/kamu-cli/issues/888
}

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

pub async fn test_new_derivative(kamu: KamuCliPuppet) {
let assert = kamu
.execute(["new", "--derivative", "test-dataset"])
.await
.success();

let stderr = std::str::from_utf8(&assert.get_output().stderr).unwrap();

assert!(
stderr.contains(indoc::indoc!(
r#"
Written new manifest template to: test-dataset.yaml
Follow directions in the file's comments and use `kamu add test-dataset.yaml` when ready.
"#
)),
"Unexpected output:\n{stderr}",
);

// TODO: After solving this issue, add `kamu add` calls and populate with
// data
//
// `kamu new`: generate snapshots that will be immediately ready to be
// added/worked on
// https://github.com/kamu-data/kamu-cli/issues/888
}

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

0 comments on commit 38f1486

Please sign in to comment.