sysmon/plugins/sysmon-aix/src/test/groovy/AixProcessorTest.groovy

49 lines
1.4 KiB
Groovy
Raw Normal View History

import org.sysmon.plugins.sysmon_aix.AixProcessorExtension
import org.sysmon.plugins.sysmon_aix.AixProcessorStat
import spock.lang.Specification
class AixProcessorTest extends Specification {
void "test AIX lparstat output processing"() {
setup:
def testFile = new File(getClass().getResource('/lparstat-aix.txt').toURI())
List<String> lines = testFile.readLines("UTF-8")
when:
AixProcessorExtension extension = new AixProcessorExtension()
AixProcessorStat stats = extension.processCommandOutput(lines)
then:
stats.getUser() == 83.7f
stats.getSys() == 3.3f
stats.getWait() == 0.0f
stats.getIdle() == 13.0f
stats.getFields().get("ent") == 0.50f
}
void "test Linux lparstat output processing"() {
setup:
def testFile = new File(getClass().getResource('/lparstat-linux.txt').toURI())
List<String> lines = testFile.readLines("UTF-8")
when:
AixProcessorExtension extension = new AixProcessorExtension()
AixProcessorStat stats = extension.processCommandOutput(lines)
then:
stats.getUser() == 0.03f
stats.getSys() == 0.0f
stats.getWait() == 0.0f
stats.getIdle() == 99.97f
stats.getFields().get("ent") == 4.00f
stats.getTags().get("mode") == "Uncapped"
stats.getTags().get("type") == "Shared"
}
}