hmci/src/test/groovy/biz/nellemann/hmci/ManagedSystemTest.groovy

91 lines
3.5 KiB
Groovy
Raw Normal View History

package biz.nellemann.hmci
import spock.lang.Specification
class ManagedSystemTest extends Specification {
void "test processPcmJson for ManagedSystem"() {
setup:
def testFile = new File(getClass().getResource('/pcm-data-managed-system.json').toURI())
def testJson = testFile.getText('UTF-8')
when:
ManagedSystem system = new ManagedSystem("site1", "e09834d1-c930-3883-bdad-405d8e26e166", "Test Name","Test Type", "Test Model", "Test S/N")
system.processMetrics(testJson)
then:
system.metrics.systemUtil.sample.serverUtil.memory.assignedMemToLpars == 40960.000
system.metrics.systemUtil.sample.serverUtil.processor.totalProcUnits == 24.000
system.metrics.systemUtil.sample.viosUtil.first().name == "VIOS1"
system.metrics.systemUtil.sample.viosUtil.first().memory.assignedMem == 8192.0
system.metrics.systemUtil.sample.viosUtil.first().storage.genericPhysicalAdapters.first().transmittedBytes == 9966.933
system.metrics.systemUtil.sample.viosUtil.first().storage.fiberChannelAdapters.first().numOfPorts == 3
}
2020-08-13 09:48:00 +00:00
void "test getMemoryMetrics"() {
setup:
def testFile = new File(getClass().getResource('/pcm-data-managed-system.json').toURI())
def testJson = testFile.getText('UTF-8')
ManagedSystem system = new ManagedSystem("site1", "e09834d1-c930-3883-bdad-405d8e26e166", "Test Name","Test Type", "Test Model", "Test S/N")
2020-08-13 09:48:00 +00:00
when:
system.processMetrics(testJson)
List<Measurement> listOfMeasurements = system.getMemoryMetrics()
2020-08-13 09:48:00 +00:00
then:
listOfMeasurements.size() == 1
listOfMeasurements.first().fields['totalMem'] == 1048576.000
2020-08-13 09:48:00 +00:00
}
void "test getProcessorMetrics"() {
setup:
def testFile = new File(getClass().getResource('/pcm-data-managed-system.json').toURI())
def testJson = testFile.getText('UTF-8')
ManagedSystem system = new ManagedSystem("site1", "e09834d1-c930-3883-bdad-405d8e26e166", "Test Name","Test Type", "Test Model", "Test S/N")
2020-08-13 09:48:00 +00:00
when:
system.processMetrics(testJson)
List<Measurement> listOfMeasurements = system.getProcessorMetrics()
2020-08-13 09:48:00 +00:00
then:
listOfMeasurements.size() == 1
listOfMeasurements.first().fields['availableProcUnits'] == 16.000
2020-08-13 09:48:00 +00:00
}
void "test getSystemSharedProcessorPools"() {
setup:
def testFile = new File(getClass().getResource('/pcm-data-managed-system.json').toURI())
def testJson = testFile.getText('UTF-8')
ManagedSystem system = new ManagedSystem("site1", "e09834d1-c930-3883-bdad-405d8e26e166", "Test Name","Test Type", "Test Model", "Test S/N")
2020-08-13 09:48:00 +00:00
when:
system.processMetrics(testJson)
List<Measurement> listOfMeasurements = system.getSharedProcessorPools()
2020-08-13 09:48:00 +00:00
then:
listOfMeasurements.size() == 1
listOfMeasurements.first().fields['assignedProcUnits'] == 23.767
2020-08-13 09:48:00 +00:00
}
2020-08-18 11:49:48 +00:00
void "test VIOS data"() {
setup:
def testFile = new File(getClass().getResource('/pcm-data-managed-system.json').toURI())
def testJson = testFile.getText('UTF-8')
ManagedSystem system = new ManagedSystem("site1", "e09834d1-c930-3883-bdad-405d8e26e166", "Test Name","Test Type", "Test Model", "Test S/N")
when:
system.processMetrics(testJson)
List<Measurement> listOfMeasurements = system.getSharedProcessorPools()
2020-08-18 11:49:48 +00:00
then:
listOfMeasurements.size() == 1
listOfMeasurements.first().fields['assignedProcUnits'] == 23.767
2020-08-18 11:49:48 +00:00
}
}