More tests and removal of redundant metrics in some VIOS measurements.

This commit is contained in:
Mark Nellemann 2021-09-20 15:36:23 +02:00
parent bd5ad22b73
commit 7d010e7968
5 changed files with 208 additions and 10 deletions

View file

@ -35,7 +35,7 @@ dependencies {
application {
mainClass.set('biz.nellemann.hmci.Application')
applicationDefaultJvmArgs = [ "-server", "-Xms256m", "-Xmx1024m" ]
applicationDefaultJvmArgs = [ "-server", "-Xms256m", "-Xmx1024m", "-XX:+UseG1GC" ]
}
test {
@ -96,7 +96,7 @@ jacocoTestCoverageVerification {
violationRules {
rule {
limit {
minimum = 0.4 // TODO: Raise when more tests are implemented
minimum = 0.5 // TODO: Raise when more tests are implemented
}
}
}
@ -118,5 +118,14 @@ jar {
}
}
tasks.create("packages") {
group "build"
dependsOn ":build"
dependsOn ":buildDeb"
dependsOn ":buildRpm"
}
sourceCompatibility = 1.8
targetCompatibility = 1.8

View file

@ -3,9 +3,9 @@ Description=HMC Insights Service
[Service]
#User=nobody
#Group=nogroup
TimeoutStartSec=0
Restart=always
#Group=nobody
TimeoutSec=20
Restart=on-failure
ExecStart=/opt/hmci/bin/hmci
[Install]

View file

@ -249,6 +249,7 @@ class ManagedSystem extends MetaSystem {
fieldsMap.put("timeSpentWaitingForDispatch", vios.processor.timePerInstructionExecution);
fieldsMap.put("timePerInstructionExecution", vios.processor.timeSpentWaitingForDispatch);
fieldsMap.put("weight", vios.processor.weight);
fieldsMap.put("mode", vios.processor.mode);
log.trace("getViosProcessorMetrics() - fields: " + fieldsMap);
list.add(new Measurement(tagsMap, fieldsMap));
@ -304,7 +305,6 @@ class ManagedSystem extends MetaSystem {
fieldsMap.put("receivedPackets", adapter.receivedPackets);
fieldsMap.put("droppedPackets", adapter.droppedPackets);
fieldsMap.put("transferredBytes", adapter.transferredBytes);
fieldsMap.put("physicalLocation", adapter.physicalLocation);
log.trace("getViosNetworkSharedAdapters() - fields: " + fieldsMap);
list.add(new Measurement(tagsMap, fieldsMap));
@ -347,7 +347,6 @@ class ManagedSystem extends MetaSystem {
fieldsMap.put("sentPhysicalPackets", adapter.sentPhysicalPackets);
fieldsMap.put("transferredBytes", adapter.transferredBytes);
fieldsMap.put("transferredPhysicalBytes", adapter.transferredPhysicalBytes);
fieldsMap.put("physicalLocation", adapter.physicalLocation);
log.trace("getViosNetworkVirtualAdapters() - fields: " + fieldsMap);
list.add(new Measurement(tagsMap, fieldsMap));
@ -435,7 +434,6 @@ class ManagedSystem extends MetaSystem {
fieldsMap.put("readBytes", adapter.readBytes);
fieldsMap.put("writeBytes", adapter.writeBytes);
fieldsMap.put("transmittedBytes", adapter.transmittedBytes);
fieldsMap.put("physicalLocation", adapter.physicalLocation);
log.trace("getViosStorageFiberChannelAdapters() - fields: " + fieldsMap);
list.add(new Measurement(tagsMap, fieldsMap));
@ -503,7 +501,6 @@ class ManagedSystem extends MetaSystem {
fieldsMap.put("writeBytes", adapter.writeBytes);
fieldsMap.put("transmittedBytes", adapter.transmittedBytes);
fieldsMap.put("type", adapter.type);
fieldsMap.put("physicalLocation", adapter.physicalLocation);
log.trace("getViosStoragePhysicalAdapters() - fields: " + fieldsMap);
list.add(new Measurement(tagsMap, fieldsMap));
@ -538,7 +535,6 @@ class ManagedSystem extends MetaSystem {
fieldsMap.put("writeBytes", adapter.writeBytes);
fieldsMap.put("transmittedBytes", adapter.transmittedBytes);
fieldsMap.put("type", adapter.type);
fieldsMap.put("physicalLocation", adapter.physicalLocation);
log.trace("getViosStorageVirtualAdapters() - fields: " + fieldsMap);
list.add(new Measurement(tagsMap, fieldsMap));

View file

@ -135,8 +135,165 @@ class ManagedSystemTest extends Specification {
then:
listOfMeasurements.size() == 2
listOfMeasurements.first().fields['mode'] == "share_idle_procs_active"
listOfMeasurements.first().fields['entitledProcUnits'] == 1.0
listOfMeasurements.first().fields['utilizedCappedProcUnits'] == 0.12
}
void "test getViosNetworkLpars"() {
setup:
def testFile = new File(getClass().getResource('/pcm-data-managed-system.json').toURI())
def testJson = testFile.getText('UTF-8')
ManagedSystem system = new ManagedSystem("e09834d1-c930-3883-bdad-405d8e26e166", "Test Name","Test Type", "Test Model", "Test S/N")
when:
system.processMetrics(testJson)
List<Measurement> listOfMeasurements = system.getViosNetworkLpars()
then:
listOfMeasurements.size() == 2
listOfMeasurements.first().tags['viosname'] == "VIOS1"
listOfMeasurements.first().fields['clientlpars'] == 1
}
void "test getViosNetworkSharedAdapters"() {
setup:
def testFile = new File(getClass().getResource('/pcm-data-managed-system.json').toURI())
def testJson = testFile.getText('UTF-8')
ManagedSystem system = new ManagedSystem("e09834d1-c930-3883-bdad-405d8e26e166", "Test Name","Test Type", "Test Model", "Test S/N")
when:
system.processMetrics(testJson)
List<Measurement> listOfMeasurements = system.getViosNetworkSharedAdapters()
then:
listOfMeasurements.size() == 2
listOfMeasurements.first().tags['viosname'] == "VIOS1"
listOfMeasurements.first().tags['location'] == "U8247.22L.213C1BA-V1-C2-T1"
listOfMeasurements.first().fields['type'] == "sea"
listOfMeasurements.first().fields['transferredBytes'] == 14180.2d
}
void "test getViosNetworkVirtualAdapters"() {
setup:
def testFile = new File(getClass().getResource('/pcm-data-managed-system.json').toURI())
def testJson = testFile.getText('UTF-8')
ManagedSystem system = new ManagedSystem("e09834d1-c930-3883-bdad-405d8e26e166", "Test Name","Test Type", "Test Model", "Test S/N")
when:
system.processMetrics(testJson)
List<Measurement> listOfMeasurements = system.getViosNetworkVirtualAdapters()
then:
listOfMeasurements.size() == 4
listOfMeasurements.first().tags['viosname'] == "VIOS1"
listOfMeasurements.first().tags['location'] == "U8247.22L.213C1BA-V1-C2"
listOfMeasurements.first().tags['vswitchid'] == "0"
listOfMeasurements.first().fields['transferredBytes'] == 8245.4d
}
void "test getViosNetworkGenericAdapters"() {
setup:
def testFile = new File(getClass().getResource('/pcm-data-managed-system.json').toURI())
def testJson = testFile.getText('UTF-8')
ManagedSystem system = new ManagedSystem("e09834d1-c930-3883-bdad-405d8e26e166", "Test Name","Test Type", "Test Model", "Test S/N")
when:
system.processMetrics(testJson)
List<Measurement> listOfMeasurements = system.getViosNetworkGenericAdapters()
then:
listOfMeasurements.size() == 6
listOfMeasurements.first().tags['viosname'] == "VIOS1"
listOfMeasurements.first().tags['location'] == "U78CB.001.WZS0BYF-P1-C10-T3"
listOfMeasurements.first().fields['receivedBytes'] == 1614.567d
listOfMeasurements.first().fields['sentBytes'] == 3511.833d
}
void "test getViosStorageLpars"() {
setup:
def testFile = new File(getClass().getResource('/pcm-data-managed-system.json').toURI())
def testJson = testFile.getText('UTF-8')
ManagedSystem system = new ManagedSystem("e09834d1-c930-3883-bdad-405d8e26e166", "Test Name","Test Type", "Test Model", "Test S/N")
when:
system.processMetrics(testJson)
List<Measurement> listOfMeasurements = system.getViosStorageLpars()
then:
listOfMeasurements.size() == 2
listOfMeasurements.first().tags['viosname'] == "VIOS1"
listOfMeasurements.first().fields['clientlpars'] == 1
}
void "test getViosStorageFiberChannelAdapters"() {
setup:
def testFile = new File(getClass().getResource('/pcm-data-managed-system.json').toURI())
def testJson = testFile.getText('UTF-8')
ManagedSystem system = new ManagedSystem("e09834d1-c930-3883-bdad-405d8e26e166", "Test Name","Test Type", "Test Model", "Test S/N")
when:
system.processMetrics(testJson)
List<Measurement> listOfMeasurements = system.getViosStorageFiberChannelAdapters()
then:
listOfMeasurements.size() == 4
listOfMeasurements.first().tags['viosname'] == "VIOS1"
listOfMeasurements.first().tags['location'] == "U78CB.001.WZS0BYF-P1-C12-T1"
listOfMeasurements.first().fields['numOfReads'] == 0.0
listOfMeasurements.first().fields['numOfWrites'] == 0.067d
}
void "test getViosStoragePhysicalAdapters"() {
setup:
def testFile = new File(getClass().getResource('/pcm-data-managed-system.json').toURI())
def testJson = testFile.getText('UTF-8')
ManagedSystem system = new ManagedSystem("e09834d1-c930-3883-bdad-405d8e26e166", "Test Name","Test Type", "Test Model", "Test S/N")
when:
system.processMetrics(testJson)
List<Measurement> listOfMeasurements = system.getViosStoragePhysicalAdapters()
then:
listOfMeasurements.size() == 2
listOfMeasurements.first().tags['viosname'] == "VIOS1"
listOfMeasurements.first().tags['location'] == "U78CB.001.WZS0BYF-P1-C14-T1"
listOfMeasurements.first().fields['numOfReads'] == 0.0
listOfMeasurements.first().fields['numOfWrites'] == 19.467d
}
void "test getViosStorageVirtualAdapters"() {
setup:
def testFile = new File(getClass().getResource('/pcm-data-managed-system.json').toURI())
def testJson = testFile.getText('UTF-8')
ManagedSystem system = new ManagedSystem("e09834d1-c930-3883-bdad-405d8e26e166", "Test Name","Test Type", "Test Model", "Test S/N")
when:
system.processMetrics(testJson)
List<Measurement> listOfMeasurements = system.getViosStorageVirtualAdapters()
then:
listOfMeasurements.size() == 3
listOfMeasurements.first().tags['viosname'] == "VIOS1"
listOfMeasurements.first().tags['location'] == "U8247.22L.213C1BA-V1-C6"
listOfMeasurements.first().fields['numOfReads'] == 0.0
listOfMeasurements.first().fields['numOfWrites'] == 0.0
}
}

View file

@ -23,4 +23,40 @@ class SystemEnergyTest extends Specification {
system.energy.metrics.systemUtil.sample.energyUtil.thermalUtil.baseboardTemperatures.first().temperatureReading == 45.0
}
void "test power readings for ManagedSystem Energy"() {
setup:
def testFile = new File(getClass().getResource('/pcm-data-energy.json').toURI())
def testJson = testFile.getText('UTF-8')
when:
ManagedSystem system = new ManagedSystem("e09834d1-c930-3883-bdad-405d8e26e166", "Test Name","Test Type", "Test Model", "Test S/N")
system.energy.processMetrics(testJson)
List<Measurement> measurements = system.energy.getPowerMetrics()
then:
measurements.first().tags.get('servername') == 'Test Name'
measurements.first().fields.get('powerReading') == 542.0f
}
void "test thermal readings for ManagedSystem Energy"() {
setup:
def testFile = new File(getClass().getResource('/pcm-data-energy.json').toURI())
def testJson = testFile.getText('UTF-8')
when:
ManagedSystem system = new ManagedSystem("e09834d1-c930-3883-bdad-405d8e26e166", "Test Name","Test Type", "Test Model", "Test S/N")
system.energy.processMetrics(testJson)
List<Measurement> measurements = system.energy.getThermalMetrics()
then:
measurements.first().tags.get('servername') == 'Test Name'
measurements.first().fields.get('cpuTemperature_1') == 46.0f
measurements.first().fields.get('cpuTemperature_2') == 54.0f
measurements.first().fields.get('inletTemperature_1') == 26.0f
}
}