2021-05-21 09:08:43 +00:00
|
|
|
import sysmon.plugins.os_aix.AixProcessorExtension
|
|
|
|
import sysmon.plugins.os_aix.AixProcessorStat
|
2021-05-07 10:39:55 +00:00
|
|
|
import spock.lang.Specification
|
|
|
|
|
|
|
|
class AixProcessorTest extends Specification {
|
|
|
|
|
2021-06-08 18:24:43 +00:00
|
|
|
void "test AIX lparstat shared output processing"() {
|
2021-05-07 10:39:55 +00:00
|
|
|
|
|
|
|
setup:
|
2021-09-17 09:53:57 +00:00
|
|
|
InputStream inputStream = getClass().getResourceAsStream('/lparstat-aix-shared.txt')
|
2021-05-07 10:39:55 +00:00
|
|
|
|
|
|
|
when:
|
|
|
|
AixProcessorExtension extension = new AixProcessorExtension()
|
2021-06-10 06:55:03 +00:00
|
|
|
AixProcessorStat stats = extension.processCommandOutput(inputStream)
|
2021-05-07 10:39:55 +00:00
|
|
|
|
|
|
|
then:
|
2021-05-10 14:56:56 +00:00
|
|
|
stats.getUser() == 83.7f
|
|
|
|
stats.getSys() == 3.3f
|
|
|
|
stats.getWait() == 0.0f
|
|
|
|
stats.getIdle() == 13.0f
|
2021-11-06 19:32:54 +00:00
|
|
|
stats.getFields().get("smt") == 8
|
2021-05-10 14:56:56 +00:00
|
|
|
stats.getFields().get("ent") == 0.50f
|
2021-06-08 18:24:43 +00:00
|
|
|
stats.getFields().get("type") == "Shared"
|
2021-05-07 10:39:55 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
2021-06-08 18:24:43 +00:00
|
|
|
void "test AIX lparstat dedicated output processing"() {
|
|
|
|
|
|
|
|
setup:
|
2021-09-17 09:53:57 +00:00
|
|
|
InputStream inputStream = getClass().getResourceAsStream('/lparstat-aix-dedicated.txt')
|
2021-06-08 18:24:43 +00:00
|
|
|
|
|
|
|
when:
|
|
|
|
AixProcessorExtension extension = new AixProcessorExtension()
|
2021-06-10 06:55:03 +00:00
|
|
|
AixProcessorStat stats = extension.processCommandOutput(inputStream)
|
2021-06-08 18:24:43 +00:00
|
|
|
|
|
|
|
then:
|
|
|
|
stats.getUser() == 0.1f
|
|
|
|
stats.getSys() == 0.2f
|
|
|
|
stats.getWait() == 0.0f
|
|
|
|
stats.getIdle() == 99.7f
|
2021-11-06 19:32:54 +00:00
|
|
|
stats.getFields().get("smt") == 8
|
2021-06-08 18:24:43 +00:00
|
|
|
stats.getFields().get("physc") == 0.07f
|
|
|
|
stats.getFields().get("type") == "Dedicated"
|
|
|
|
|
|
|
|
}
|
2021-05-10 14:56:56 +00:00
|
|
|
|
2021-05-11 13:37:23 +00:00
|
|
|
void "test Linux lparstat output processing"() {
|
|
|
|
|
|
|
|
setup:
|
2021-09-17 09:53:57 +00:00
|
|
|
InputStream inputStream = getClass().getResourceAsStream('/lparstat-linux.txt')
|
2021-05-11 13:37:23 +00:00
|
|
|
|
|
|
|
when:
|
|
|
|
AixProcessorExtension extension = new AixProcessorExtension()
|
2021-06-10 06:55:03 +00:00
|
|
|
AixProcessorStat stats = extension.processCommandOutput(inputStream)
|
2021-05-11 13:37:23 +00:00
|
|
|
|
|
|
|
then:
|
|
|
|
stats.getUser() == 0.03f
|
|
|
|
stats.getSys() == 0.0f
|
|
|
|
stats.getWait() == 0.0f
|
|
|
|
stats.getIdle() == 99.97f
|
2021-11-06 19:32:54 +00:00
|
|
|
stats.getFields().get("smt") == 8
|
2021-05-11 13:37:23 +00:00
|
|
|
stats.getFields().get("ent") == 4.00f
|
2021-05-21 09:08:43 +00:00
|
|
|
stats.getFields().get("mode") == "Uncapped"
|
|
|
|
stats.getFields().get("type") == "Shared"
|
2021-05-11 13:37:23 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
2021-05-07 10:39:55 +00:00
|
|
|
}
|