Skip to content

Commit

Permalink
Refactoring code due to the deletion of configure_cluster() in kind c…
Browse files Browse the repository at this point in the history
…lass(not pass pylint)
  • Loading branch information
hzeng21 committed Feb 1, 2024
1 parent 2ff5690 commit 8e00049
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 17 deletions.
10 changes: 5 additions & 5 deletions acto/engine.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"""The main engine of Acto. It is responsible for running the test cases and
collecting the results."""

import importlib
import json
import os
Expand Down Expand Up @@ -784,6 +785,8 @@ def __init__(
cluster = kind.Kind(
acto_namespace=acto_namespace,
feature_gates=operator_config.kubernetes_engine.feature_gates,
num_nodes=operator_config.num_nodes,
version=operator_config.kubernetes_version,
)
else:
logger.warning(
Expand All @@ -793,6 +796,8 @@ def __init__(
cluster = kind.Kind(
acto_namespace=acto_namespace,
feature_gates=operator_config.kubernetes_engine.feature_gates,
num_nodes=operator_config.num_nodes,
version=operator_config.kubernetes_version,
)

self.cluster = cluster
Expand All @@ -810,11 +815,6 @@ def __init__(
self.runner_type = Runner
self.checker_type = CheckerSet

# generate configuration files for the cluster runtime
self.cluster.configure_cluster(
operator_config.num_nodes, self.operator_config.kubernetes_version
)

self.__learn(
context_file=context_file,
helper_crd=helper_crd,
Expand Down
14 changes: 5 additions & 9 deletions acto/post_process/post_diff_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,7 @@ def from_file(cls, file_path: str) -> "DiffTestResult":
def to_file(self, file_path: str):
"""Dump the DiffTestResult to a file"""
with open(file_path, "w", encoding="utf-8") as f:
json.dump(
self.model_dump(), f, cls=ActoEncoder, indent=4
)
json.dump(self.model_dump(), f, cls=ActoEncoder, indent=4)


def dict_hash(d: dict) -> int:
Expand Down Expand Up @@ -571,9 +569,8 @@ def post_process(self, workdir: str, num_workers: int = 1):
cluster = kind.Kind(
acto_namespace=self.acto_namespace,
feature_gates=self.config.kubernetes_engine.feature_gates,
)
cluster.configure_cluster(
self.config.num_nodes, self.config.kubernetes_version
num_nodes=self.config.num_nodes,
version=self.config.kubernetes_version,
)
deploy = Deploy(self.config.deploy)
# Build an archive to be preloaded
Expand Down Expand Up @@ -648,9 +645,8 @@ def check_diff_test_result(
cluster = kind.Kind(
acto_namespace=self.acto_namespace,
feature_gates=self.config.kubernetes_engine.feature_gates,
)
cluster.configure_cluster(
self.config.num_nodes, self.config.kubernetes_version
num_nodes=self.config.num_nodes,
version=self.config.kubernetes_version,
)

deploy = Deploy(self.config.deploy)
Expand Down
6 changes: 3 additions & 3 deletions acto/post_process/simple_crash_test.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Temporary code, do not use"""

import glob
import json
import logging
Expand Down Expand Up @@ -265,9 +266,8 @@ def post_process(self, workdir: str, num_workers: int = 1):
acto_namespace=self.acto_namespace,
posthooks=[posthook],
feature_gates=self.config.kubernetes_engine.feature_gates,
)
cluster.configure_cluster(
self.config.num_nodes, self.config.kubernetes_version
num_nodes=self.config.num_nodes,
version=self.config.kubernetes_version,
)
deploy = Deploy(self.config.deploy)

Expand Down

0 comments on commit 8e00049

Please sign in to comment.