test(e2e): Add minimal coverage that CLI reports custom partition templates

pull/24376/head
Fraser Savage 2023-08-30 16:27:03 +01:00
parent 1c80c853b4
commit c0fdd97212
No known key found for this signature in database
GPG Key ID: DE47C33CE8C5C446
3 changed files with 31 additions and 5 deletions

View File

@ -260,6 +260,20 @@ impl NamespaceCmd {
expected_output = BoxPredicate::new(expected_output.and(predicate::str::contains(
format!(r#""maxColumnsPerTable": {expected_max_columns_per_table}"#),
)));
match self.partition_template.clone() {
Some(_) => {
expected_output = BoxPredicate::new(
expected_output
.and(predicate::str::contains(format!(r#""partitionTemplate":"#))),
);
}
None => {
expected_output = BoxPredicate::new(expected_output.and(
predicate::str::contains(format!(r#""partitionTemplate":"#)).not(),
));
}
};
}
}

View File

@ -441,7 +441,7 @@ async fn create_partition_template_implicit_table_creation() {
NamespaceCmd::new("create", NAMESPACE_NAME)
.with_partition_template(
"{\"parts\":[\
{\"timeFormat\":\"%Y-%m\"}, \
{\"timeFormat\":\"%Y-%m\"},\
{\"tagValue\":\"location\"}\
]}",
)

View File

@ -231,7 +231,10 @@ async fn create_positive() {
.arg("t1")
.assert()
.success()
.stdout(predicate::str::contains("t1"));
.stdout(
predicate::str::contains("t1")
.and(predicate::str::contains(r#""partitionTemplate":"#).not()),
);
// Partition template with time format
Command::cargo_bin("influxdb_iox")
@ -246,7 +249,10 @@ async fn create_positive() {
.arg("{\"parts\":[{\"timeFormat\":\"%Y-%m\"}]}")
.assert()
.success()
.stdout(predicate::str::contains("t2"));
.stdout(
predicate::str::contains("t2")
.and(predicate::str::contains(r#""partitionTemplate":"#)),
);
// Partition template with tag
Command::cargo_bin("influxdb_iox")
@ -261,7 +267,10 @@ async fn create_positive() {
.arg("{\"parts\":[{\"tagValue\":\"col1\"}]}")
.assert()
.success()
.stdout(predicate::str::contains("t3"));
.stdout(
predicate::str::contains("t3")
.and(predicate::str::contains(r#""partitionTemplate":"#)),
);
// Partition template with time format, tag value, and tag of unsual column name
Command::cargo_bin("influxdb_iox")
@ -282,7 +291,10 @@ async fn create_positive() {
)
.assert()
.success()
.stdout(predicate::str::contains("t4"));
.stdout(
predicate::str::contains("t4")
.and(predicate::str::contains(r#""partitionTemplate":"#)),
);
}
.boxed()
})),