Fixed test to be able to be executed on OS different from linux
This commit is contained in:
parent
849cc923f3
commit
e5106cd6c0
|
@ -445,6 +445,37 @@ public class SmartgearResourcesTest extends ERManagementTest {
|
||||||
public static final String CPU_MODEL_B = "model\b";
|
public static final String CPU_MODEL_B = "model\b";
|
||||||
public static final String CPU_MODEL_NUMBER = "modelNumber";
|
public static final String CPU_MODEL_NUMBER = "modelNumber";
|
||||||
|
|
||||||
|
|
||||||
|
public static List<CPUFacet> getFakeCPUFacets() {
|
||||||
|
List<CPUFacet> cpuFacets = new ArrayList<>();
|
||||||
|
|
||||||
|
if(cpuFacets.size()==0) {
|
||||||
|
for(int i=0; i<8; i++) {
|
||||||
|
CPUFacet cpuFacet = new CPUFacetImpl();
|
||||||
|
cpuFacet.setVendor("Apple");
|
||||||
|
cpuFacet.setModel("Apple M2 Pro");
|
||||||
|
cpuFacet.setClockSpeed("3,504 GHz");
|
||||||
|
cpuFacet.setAdditionalProperty("coreType", "Performance Cores (Avalanche)");
|
||||||
|
cpuFacets.add(cpuFacet);
|
||||||
|
}
|
||||||
|
for(int i=0; i<4; i++) {
|
||||||
|
CPUFacet cpuFacet = new CPUFacetImpl();
|
||||||
|
cpuFacet.setVendor("Apple");
|
||||||
|
cpuFacet.setModel("Apple M2 Pro");
|
||||||
|
cpuFacet.setClockSpeed("2.424 GHz");
|
||||||
|
cpuFacet.setAdditionalProperty("coreType", "Efficiency Cores (Blizzard)");
|
||||||
|
cpuFacets.add(cpuFacet);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return cpuFacets;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This function properly works on Linux but fails on
|
||||||
|
* other system such as Mac OS. In such case, the function
|
||||||
|
* getFakeCPUFacet() is used instead;
|
||||||
|
*/
|
||||||
public static List<CPUFacet> getCPUFacets() {
|
public static List<CPUFacet> getCPUFacets() {
|
||||||
|
|
||||||
List<CPUFacet> cpuFacets = new ArrayList<>();
|
List<CPUFacet> cpuFacets = new ArrayList<>();
|
||||||
|
@ -453,7 +484,7 @@ public class SmartgearResourcesTest extends ERManagementTest {
|
||||||
|
|
||||||
if (!file.exists()) {
|
if (!file.exists()) {
|
||||||
logger.warn("cannot acquire CPU info (no /proc/cpuinfo)");
|
logger.warn("cannot acquire CPU info (no /proc/cpuinfo)");
|
||||||
return cpuFacets;
|
return getFakeCPUFacets();
|
||||||
}
|
}
|
||||||
|
|
||||||
BufferedReader input = null;
|
BufferedReader input = null;
|
||||||
|
@ -531,6 +562,11 @@ public class SmartgearResourcesTest extends ERManagementTest {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(cpuFacets.size()==0) {
|
||||||
|
return getFakeCPUFacets();
|
||||||
|
}
|
||||||
|
|
||||||
return cpuFacets;
|
return cpuFacets;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue