Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compilation error fixed #2206

Merged
merged 2 commits into from
Jan 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/+mirrord-operator-tests.fixed.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fixed a compilation bug in `mirrord-operator` crate tests.
27 changes: 15 additions & 12 deletions mirrord/operator/src/crd/label_selector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -157,12 +157,12 @@ mod tests {
/// and can just use string slices because they are shorter to write.
fn label_selector_req_with_values(
key: &str,
operator: &str,
operator: MatchExpressionOperator,
values: &[&str],
) -> LabelSelectorRequirement {
LabelSelectorRequirement {
key: key.into(),
operator: operator.into(),
operator,
values: Some(
values
.into_iter()
Expand All @@ -175,52 +175,55 @@ mod tests {

/// Convenient function so that we don't have to write `String::from` 1000 times in the tests
/// and can just use string slices because they are shorter to write.
fn label_selector_req_without_values(key: &str, operator: &str) -> LabelSelectorRequirement {
fn label_selector_req_without_values(
key: &str,
operator: MatchExpressionOperator,
) -> LabelSelectorRequirement {
LabelSelectorRequirement {
key: key.into(),
operator: operator.into(),
operator,
values: None,
}
}

#[fixture]
fn answer_in_set() -> LabelSelectorRequirement {
label_selector_req_with_values("answer", "In", &["42", "idk", "very-much"])
label_selector_req_with_values("answer", In, &["42", "idk", "very-much"])
}

#[fixture]
fn answer_not_in_set() -> LabelSelectorRequirement {
label_selector_req_with_values("answer", "NotIn", &["42", "idk", "very-much"])
label_selector_req_with_values("answer", NotIn, &["42", "idk", "very-much"])
}

#[fixture]
fn answer_exists() -> LabelSelectorRequirement {
label_selector_req_without_values("answer", "Exists")
label_selector_req_without_values("answer", Exists)
}

#[fixture]
fn answer_does_not_exist() -> LabelSelectorRequirement {
label_selector_req_without_values("answer", "DoesNotExist")
label_selector_req_without_values("answer", DoesNotExist)
}

#[fixture]
fn question_in_set() -> LabelSelectorRequirement {
label_selector_req_with_values("question", "In", &["why", "how", "when"])
label_selector_req_with_values("question", In, &["why", "how", "when"])
}

#[fixture]
fn question_not_in_set() -> LabelSelectorRequirement {
label_selector_req_with_values("question", "NotIn", &["why", "how", "when"])
label_selector_req_with_values("question", NotIn, &["why", "how", "when"])
}

#[fixture]
fn question_exists() -> LabelSelectorRequirement {
label_selector_req_without_values("question", "Exists")
label_selector_req_without_values("question", Exists)
}

#[fixture]
fn question_does_not_exists() -> LabelSelectorRequirement {
label_selector_req_without_values("question", "DoesNotExist")
label_selector_req_without_values("question", DoesNotExist)
}

#[rstest]
Expand Down
Loading