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

enhancement(tests): Create affinity pod in separate namespace for k8s tests #7831

Merged
merged 1 commit into from
Jun 11, 2021
Merged
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
23 changes: 16 additions & 7 deletions lib/k8s-e2e-tests/tests/vector-agent.rs
Original file line number Diff line number Diff line change
Expand Up @@ -689,7 +689,9 @@ async fn pod_filtering() -> Result<(), Box<dyn std::error::Error>> {

let test_namespace = framework.namespace(&pod_namespace).await?;

let affinity_pod = create_affinity_pod(&framework, &pod_namespace, &affinity_label).await?;
let affinity_ns_name = format!("{}-affinity", pod_namespace);
let affinity_ns = framework.namespace(&affinity_ns_name).await?;
let affinity_pod = create_affinity_pod(&framework, &affinity_ns_name, &affinity_label).await?;

let excluded_test_pod = framework
.test_pod(test_pod::Config::from_pod(&make_test_pod_with_affinity(
Expand All @@ -699,7 +701,7 @@ async fn pod_filtering() -> Result<(), Box<dyn std::error::Error>> {
vec![("vector.dev/exclude", "true")],
vec![],
Some((&affinity_label, "yes")),
Some(&pod_namespace),
Some(&affinity_ns_name),
))?)
.await?;

Expand All @@ -722,7 +724,7 @@ async fn pod_filtering() -> Result<(), Box<dyn std::error::Error>> {
vec![],
vec![],
Some((&affinity_label, "yes")),
Some(&pod_namespace),
Some(&affinity_ns_name),
))?)
.await?;
framework
Expand Down Expand Up @@ -832,6 +834,7 @@ async fn pod_filtering() -> Result<(), Box<dyn std::error::Error>> {
drop(excluded_test_pod);
drop(control_test_pod);
drop(affinity_pod);
drop(affinity_ns);
drop(test_namespace);
drop(vector);
Ok(())
Expand Down Expand Up @@ -1397,8 +1400,9 @@ async fn multiple_ns() -> Result<(), Box<dyn std::error::Error>> {

// Create a pod for our other pods to have an affinity to to ensure they are all deployed on
// the same node.
let affinity_ns = framework.namespace(&pod_namespace).await?;
let affinity_pod = create_affinity_pod(&framework, &pod_namespace, &affinity_label).await?;
let affinity_ns_name = format!("{}-affinity", pod_namespace);
let affinity_ns = framework.namespace(&affinity_ns_name).await?;
let affinity_pod = create_affinity_pod(&framework, &affinity_ns_name, &affinity_label).await?;

let mut test_pods = vec![];
for ns in &expected_namespaces {
Expand All @@ -1411,7 +1415,7 @@ async fn multiple_ns() -> Result<(), Box<dyn std::error::Error>> {
vec![],
vec![],
Some((affinity_label.as_str(), "yes")),
Some(&pod_namespace),
Some(&affinity_ns_name),
))?)
.await?;
framework
Expand All @@ -1427,7 +1431,12 @@ async fn multiple_ns() -> Result<(), Box<dyn std::error::Error>> {

// Make sure we read the correct nodes logs.
let vector_pod = framework
.get_vector_pod_with_pod(&pod_namespace, "affinity-pod", &namespace, &override_name)
.get_vector_pod_with_pod(
&affinity_ns_name,
"affinity-pod",
&namespace,
&override_name,
)
.await?;

let mut log_reader = framework.logs(&namespace, &format!("pod/{}", vector_pod))?;
Expand Down