Skip to content

Commit

Permalink
Move the CLI update tests to the DB tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
SamirTalwar committed Jun 24, 2024
1 parent da9906a commit 7c40d12
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 3 deletions.
2 changes: 2 additions & 0 deletions Cargo.lock

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

2 changes: 2 additions & 0 deletions crates/tests/databases-tests/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,14 @@ postgres = []

[dependencies]
ndc-postgres = { path = "../../connectors/ndc-postgres" }
ndc-postgres-cli = { path = "../../cli" }
ndc-postgres-configuration = { path = "../../configuration" }
tests-common = { path = "../tests-common" }

anyhow = { workspace = true }
axum = { workspace = true }
insta = { workspace = true, features = ["json"] }
similar-asserts = { workspace = true }
tempfile = { workspace = true }
test-each = { workspace = true }
tokio = { workspace = true, features = ["full"] }
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
mod common;

use tokio::fs;

use ndc_postgres_cli::*;
Expand Down Expand Up @@ -28,7 +26,7 @@ async fn test_update_configuration() -> anyhow::Result<()> {
let configuration_file_path = dir.path().join("configuration.json");
assert!(configuration_file_path.exists());
let contents = fs::read_to_string(configuration_file_path).await?;
common::assert_ends_with_newline(&contents);
assert_ends_with_newline(&contents);
let output: ParsedConfiguration = configuration::parse_configuration(&dir).await?;
let runtime_config = configuration::make_runtime_configuration(output, environment)?;

Expand All @@ -37,3 +35,7 @@ async fn test_update_configuration() -> anyhow::Result<()> {

Ok(())
}

pub fn assert_ends_with_newline(contents: &str) {
assert_eq!(contents.chars().last(), Some('\n'));
}
1 change: 1 addition & 0 deletions crates/tests/databases-tests/src/postgres/mod.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
pub mod cli_update_tests;
pub mod common;
pub mod configuration_tests;
pub mod explain_tests;
Expand Down

0 comments on commit 7c40d12

Please sign in to comment.