Skip to content

Commit

Permalink
fix: removes label selector from old e2e tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Ygnas committed Nov 13, 2024
1 parent b349460 commit bca0c05
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 10 deletions.
2 changes: 1 addition & 1 deletion tests/e2e/heterogeneous_clusters_kind_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def teardown_method(self):
@pytest.mark.nvidia_gpu
def test_heterogeneous_clusters(self):
create_namespace(self)
create_kueue_resources(self, 2)
create_kueue_resources(self, 2, with_labels=True)
self.run_heterogeneous_clusters()

def run_heterogeneous_clusters(
Expand Down
2 changes: 1 addition & 1 deletion tests/e2e/heterogeneous_clusters_oauth_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def teardown_method(self):

def test_heterogeneous_clusters(self):
create_namespace(self)
create_kueue_resources(self, 2)
create_kueue_resources(self, 2, with_labels=True)
self.run_heterogeneous_clusters()

def run_heterogeneous_clusters(
Expand Down
18 changes: 10 additions & 8 deletions tests/e2e/support.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,12 @@ def create_namespace(self):
return RuntimeError(e)


def create_new_resource_flavor(self, num_flavors):
def create_new_resource_flavor(self, num_flavors, with_labels):
self.resource_flavors = []
for i in range(num_flavors):
default = i < 1
resource_flavor = f"test-resource-flavor-{random_choice()}"
create_resource_flavor(self, resource_flavor, default)
create_resource_flavor(self, resource_flavor, default, with_labels)
self.resource_flavors.append(resource_flavor)


Expand Down Expand Up @@ -173,7 +173,7 @@ def create_cluster_queue(self, cluster_queue, flavor):
self.cluster_queue = cluster_queue


def create_resource_flavor(self, flavor, default=True):
def create_resource_flavor(self, flavor, default=True, with_labels=False):
worker_label, worker_value = os.getenv("WORKER_LABEL", "worker-1=true").split("=")
control_label, control_value = os.getenv(
"CONTROL_LABEL", "ingress-ready=true"
Expand All @@ -182,9 +182,11 @@ def create_resource_flavor(self, flavor, default=True):
"TOLERATION_KEY", "node-role.kubernetes.io/control-plane"
)

node_labels = (
{worker_label: worker_value} if default else {control_label: control_value}
)
node_labels = {}
if with_labels:
node_labels = (
{worker_label: worker_value} if default else {control_label: control_value}
)

resource_flavor_json = {
"apiVersion": "kueue.x-k8s.io/v1beta1",
Expand Down Expand Up @@ -260,9 +262,9 @@ def create_local_queue(self, cluster_queue, local_queue, is_default=True):
self.local_queue = local_queue


def create_kueue_resources(self, resource_ammount=1):
def create_kueue_resources(self, resource_ammount=1, with_labels=False):
print("creating Kueue resources ...")
create_new_resource_flavor(self, resource_ammount)
create_new_resource_flavor(self, resource_ammount, with_labels)
create_new_cluster_queue(self, resource_ammount)
create_new_local_queue(self, resource_ammount)

Expand Down

0 comments on commit bca0c05

Please sign in to comment.