Skip to content

Commit ecce041

Browse files
Improve a few flaky tests
1 parent 4e8ad48 commit ecce041

File tree

2 files changed

+15
-7
lines changed

2 files changed

+15
-7
lines changed

tests/runtime_parameters_tests.rs

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ use crate::test_helpers::*;
2020
#[test]
2121
fn test_runtime_parameters_across_groups() -> Result<(), Box<dyn std::error::Error>> {
2222
let vh = "test_runtime_parameters_across_groups";
23+
delete_vhost(vh).expect("failed to delete a virtual host");
24+
2325
run_succeeds(["declare", "vhost", "--name", vh]);
2426
run_succeeds([
2527
"-V",
@@ -31,8 +33,9 @@ fn test_runtime_parameters_across_groups() -> Result<(), Box<dyn std::error::Err
3133
"--name",
3234
"my-upstream",
3335
"--value",
34-
"{\"uri\":\"amqp://target.hostname\",\"expires\":3600000}",
36+
"{\"uri\":\"amqp://target.hostname\"}",
3537
]);
38+
await_metric_emission(200);
3639

3740
run_succeeds([
3841
"-V",
@@ -42,7 +45,7 @@ fn test_runtime_parameters_across_groups() -> Result<(), Box<dyn std::error::Err
4245
"--component",
4346
"federation-upstream",
4447
])
45-
.stdout(predicate::str::contains("my-upstream").and(predicate::str::contains("3600000")));
48+
.stdout(predicate::str::contains("my-upstream"));
4649

4750
run_succeeds([
4851
"-V",
@@ -73,6 +76,8 @@ fn test_runtime_parameters_across_groups() -> Result<(), Box<dyn std::error::Err
7376
#[test]
7477
fn test_runtime_parameters_cmd_group() -> Result<(), Box<dyn std::error::Error>> {
7578
let vh = "test_runtime_parameters_cmd_group";
79+
delete_vhost(vh).expect("failed to delete a virtual host");
80+
7681
run_succeeds(["vhosts", "declare", "--name", vh]);
7782
run_succeeds([
7883
"-V",
@@ -84,11 +89,11 @@ fn test_runtime_parameters_cmd_group() -> Result<(), Box<dyn std::error::Error>>
8489
"--name",
8590
"my-upstream",
8691
"--value",
87-
"{\"uri\":\"amqp://target.hostname\",\"expires\":3600000}",
92+
"{\"uri\":\"amqp://target.hostname\",\"ack-mode\":\"on-confirm\"}",
8893
]);
94+
await_metric_emission(200);
8995

90-
run_succeeds(["parameters", "list_all"])
91-
.stdout(predicate::str::contains("my-upstream").and(predicate::str::contains("3600000")));
96+
run_succeeds(["parameters", "list_all"]).stdout(predicate::str::contains("my-upstream"));
9297

9398
run_succeeds([
9499
"-V",
@@ -98,7 +103,7 @@ fn test_runtime_parameters_cmd_group() -> Result<(), Box<dyn std::error::Error>>
98103
"--component",
99104
"federation-upstream",
100105
])
101-
.stdout(predicate::str::contains("my-upstream").and(predicate::str::contains("3600000")));
106+
.stdout(predicate::str::contains("my-upstream"));
102107

103108
run_succeeds([
104109
"-V",
@@ -108,7 +113,7 @@ fn test_runtime_parameters_cmd_group() -> Result<(), Box<dyn std::error::Error>>
108113
"--component",
109114
"federation-upstream",
110115
])
111-
.stdout(predicate::str::contains("my-upstream").and(predicate::str::contains("3600000")));
116+
.stdout(predicate::str::contains("my-upstream"));
112117

113118
run_succeeds([
114119
"-V",

tests/shovel_tests.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,8 @@ fn test_shovel_declaration_with_overlapping_destination_types()
127127
#[test]
128128
fn test_amqp091_shovel_declaration_and_deletion() -> Result<(), Box<dyn std::error::Error>> {
129129
let vh = "rust.shovels.2";
130+
delete_vhost(vh).expect("failed to delete a virtual host");
131+
130132
let name = "shovels.test_amqp091_shovel_declaration_and_deletion";
131133

132134
let amqp_endpoint = amqp_endpoint_with_vhost(vh);
@@ -150,6 +152,7 @@ fn test_amqp091_shovel_declaration_and_deletion() -> Result<(), Box<dyn std::err
150152
"--destination-exchange",
151153
dest_x,
152154
]);
155+
await_metric_emission(200);
153156

154157
run_succeeds(["-V", vh, "shovels", "list"]).stdout(
155158
predicate::str::contains(vh)

0 commit comments

Comments
 (0)