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

Fix supplier tests for aarch64 #1586

Merged
merged 1 commit into from
Sep 28, 2022
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
42 changes: 39 additions & 3 deletions tests/mechanic/supplier_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -650,7 +650,23 @@ def test_build(self):
variables={"clean_command": "./gradlew clean", "system.build_command": "./gradlew assemble"},
)
builder = mock.create_autospec(supplier.Builder)
renderer = supplier.TemplateRenderer(version="abc")
renderer = supplier.TemplateRenderer(version="abc", arch="x86_64")
es = supplier.ElasticsearchSourceSupplier(
revision="abc", es_src_dir="/src", remote_url="", car=car, builder=builder, template_renderer=renderer
)
es.prepare()

builder.build.assert_called_once_with(["./gradlew clean", "./gradlew assemble"])

def test_build_arm(self):
car = team.Car(
"default",
root_path=None,
config_paths=[],
variables={"clean_command": "./gradlew clean", "system.build_command.arch": "./gradlew assemble"},
)
builder = mock.create_autospec(supplier.Builder)
renderer = supplier.TemplateRenderer(version="abc", arch="aarch64")
es = supplier.ElasticsearchSourceSupplier(
revision="abc", es_src_dir="/src", remote_url="", car=car, builder=builder, template_renderer=renderer
)
Expand All @@ -668,7 +684,7 @@ def test_raises_error_on_missing_car_variable(self):
# system.build_command is not defined
},
)
renderer = supplier.TemplateRenderer(version="abc")
renderer = supplier.TemplateRenderer(version="abc", arch="x86_64")
builder = mock.create_autospec(supplier.Builder)
es = supplier.ElasticsearchSourceSupplier(
revision="abc", es_src_dir="/src", remote_url="", car=car, builder=builder, template_renderer=renderer
Expand All @@ -690,7 +706,27 @@ def test_add_elasticsearch_binary(self):
"system.artifact_path_pattern": "distribution/archives/tar/build/distributions/*.tar.gz",
},
)
renderer = supplier.TemplateRenderer(version="abc")
renderer = supplier.TemplateRenderer(version="abc", arch="x86_64")
es = supplier.ElasticsearchSourceSupplier(
revision="abc", es_src_dir="/src", remote_url="", car=car, builder=None, template_renderer=renderer
)
binaries = {}
es.add(binaries=binaries)
assert binaries == {"elasticsearch": "elasticsearch.tar.gz"}

@mock.patch("glob.glob", lambda p: ["elasticsearch.tar.gz"])
def test_add_elasticsearch_binary_arm(self):
car = team.Car(
"default",
root_path=None,
config_paths=[],
variables={
"clean_command": "./gradlew clean",
"system.build_command.arch": "./gradlew assemble",
"system.artifact_path_pattern.arch": "distribution/archives/tar/build/distributions/*.tar.gz",
},
)
renderer = supplier.TemplateRenderer(version="abc", arch="aarch64")
es = supplier.ElasticsearchSourceSupplier(
revision="abc", es_src_dir="/src", remote_url="", car=car, builder=None, template_renderer=renderer
)
Expand Down