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

56 lines
1.6 KiB
Groovy
Raw Normal View History

package biz.nellemann.hmci
import biz.nellemann.hmci.dto.toml.InfluxConfiguration
import spock.lang.Ignore
import spock.lang.Specification
@Ignore
class InfluxClientTest extends Specification {
InfluxClient influxClient
def setup() {
influxClient = new InfluxClient(new InfluxConfiguration("http://localhost:8086", "root", "", "hmci"))
influxClient.login()
}
def cleanup() {
influxClient.logoff()
}
2020-08-13 09:48:00 +00:00
void "write ManagedSystem data to influx"() {
setup:
def testFile = new File(getClass().getResource('/pcm-data-managed-system.json').toURI())
def testJson = testFile.getText('UTF-8')
when:
2021-01-14 12:51:18 +00:00
ManagedSystem system = new ManagedSystem("e09834d1-c930-3883-bdad-405d8e26e166", "TestSystem", "TestType", "TestModel", "Test s/n")
system.processMetrics(testJson)
influxClient.writeManagedSystem(system)
then:
system.metrics.systemUtil.utilInfo.name == "S822L-8247-213C1BA"
}
2020-08-13 09:48:00 +00:00
void "write LogicalPartition data to influx"() {
setup:
def testFile = new File(getClass().getResource('/pcm-data-logical-partition.json').toURI())
def testJson = testFile.getText('UTF-8')
when:
2021-01-14 12:51:18 +00:00
ManagedSystem system = new ManagedSystem("e09834d1-c930-3883-bdad-405d8e26e166", "TestSystem", "TestType", "TestModel", "Test s/n")
2020-08-13 09:48:00 +00:00
LogicalPartition lpar = new LogicalPartition("2DE05DB6-8AD5-448F-8327-0F488D287E82", "9Flash01", "OS400", system)
lpar.processMetrics(testJson)
influxClient.writeLogicalPartition(lpar)
then:
2020-10-14 15:28:43 +00:00
lpar.metrics.systemUtil.sample.sampleInfo.status == 2
2020-08-13 09:48:00 +00:00
}
}