Skip to content
Merged
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,11 @@ SystemConfig createSystemConfig() {
}

if (systemInfo.is64BitSystem()) {
archType = ArchType.ARCH_AMD64;
if (systemInfo.isOsLinux() && systemInfo.isArmArchitecture()) {
archType = ArchType.ARCH_ARM64;
} else {
archType = ArchType.ARCH_AMD64;
}
} else {
archType = ArchType.ARCH_386;
}
Expand Down Expand Up @@ -66,6 +70,7 @@ String getName() {

enum ArchType {
ARCH_AMD64("amd64"),
ARCH_ARM64("arm64"),
ARCH_386("386");

private final String name;
Expand Down
5 changes: 5 additions & 0 deletions src/main/java/io/specto/hoverfly/junit/core/SystemInfo.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ class SystemInfo {
private final boolean isOsMac = SystemUtils.IS_OS_MAC;
private final boolean isOsLinux = SystemUtils.IS_OS_LINUX;
private final boolean is64BitSystem = SystemUtils.OS_ARCH.contains("64");
private final boolean isArmArchitecture = SystemUtils.OS_ARCH.contains("aarch");
private final String osName = SystemUtils.OS_NAME;

boolean isOsWindows() {
Expand All @@ -29,6 +30,10 @@ boolean is64BitSystem() {
return is64BitSystem;
}

boolean isArmArchitecture() {
return isArmArchitecture;
}

String getOsName() {
return osName;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@
import org.junit.Test;
import org.powermock.reflect.Whitebox;

import static io.specto.hoverfly.junit.core.SystemConfigFactory.ArchType.ARCH_386;
import static io.specto.hoverfly.junit.core.SystemConfigFactory.ArchType.ARCH_AMD64;
import static io.specto.hoverfly.junit.core.SystemConfigFactory.ArchType.*;
import static io.specto.hoverfly.junit.core.SystemConfigFactory.OsName.*;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.catchThrowable;
Expand Down Expand Up @@ -46,6 +45,18 @@ public void shouldCreateSystemConfigForLinux() {
assertThat(systemConfig.getOsName()).isEqualTo(LINUX);
}

@Test
public void shouldCreateSystemConfigWithArm64BitArchType() {

when(systemInfo.isOsLinux()).thenReturn(true);
when(systemInfo.is64BitSystem()).thenReturn(true);
when(systemInfo.isArmArchitecture()).thenReturn(true);

SystemConfig systemConfig = factory.createSystemConfig();

assertThat(systemConfig.getArchType()).isEqualTo(ARCH_ARM64);
}

@Test
public void shouldCreateSystemConfigForMac() {

Expand Down