Skip to content

Commit

Permalink
fix: Hms test on macos should use correct arch (apache#461)
Browse files Browse the repository at this point in the history
  • Loading branch information
liurenjie1024 authored Jul 15, 2024
1 parent 08c46fb commit 0942e3c
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 2 deletions.
4 changes: 3 additions & 1 deletion crates/catalog/hms/testdata/hms_catalog/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@
# See the License for the specific language governing permissions and
# limitations under the License.

FROM openjdk:8-jre-slim AS build
FROM --platform=$BUILDPLATFORM openjdk:8-jre-slim AS build

ARG BUILDPLATFORM

RUN apt-get update -qq && apt-get -qq -y install curl

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ services:
hive-metastore:
image: iceberg-hive-metastore
build: ./
platform: ${DOCKER_DEFAULT_PLATFORM}
expose:
- 9083
environment:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ services:
hive-metastore:
image: iceberg-hive-metastore
build: ./hms_catalog/
platform: ${DOCKER_DEFAULT_PLATFORM}
expose:
- 9083
environment:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

FROM openjdk:8-jre-slim AS build
FROM --platform=$BUILDPLATFORM openjdk:8-jre-slim AS build

RUN apt-get update -qq && apt-get -qq -y install curl

Expand Down
13 changes: 13 additions & 0 deletions crates/test_utils/src/docker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,23 @@ impl DockerCompose {
self.project_name.as_str()
}

fn get_os_arch() -> String {
let mut cmd = Command::new("docker");
cmd.arg("info")
.arg("--format")
.arg("{{.OSType}}/{{.Architecture}}");

get_cmd_output(cmd, "Get os arch".to_string())
.trim()
.to_string()
}

pub fn run(&self) {
let mut cmd = Command::new("docker");
cmd.current_dir(&self.docker_compose_dir);

cmd.env("DOCKER_DEFAULT_PLATFORM", Self::get_os_arch());

cmd.args(vec![
"compose",
"-p",
Expand Down

0 comments on commit 0942e3c

Please sign in to comment.