sdk_test.go 642 B

12345678910111213141516171819202122232425262728293031
  1. package sdk
  2. import (
  3. "testing"
  4. "github.com/open-falcon/falcon-plus/modules/aggregator/g"
  5. . "github.com/smartystreets/goconvey/convey"
  6. )
  7. func init() {
  8. g.ParseConfig("../cfg.example.json")
  9. }
  10. func TestSDK(t *testing.T) {
  11. Convey("get hostnames by id", t, func() {
  12. r, err := HostnamesByID(1)
  13. t.Log(r, err)
  14. So(err, ShouldBeNil)
  15. So(len(r), ShouldBeGreaterThanOrEqualTo, 0)
  16. })
  17. Convey("query last points", t, func() {
  18. r, err := QueryLastPoints([]string{"laiweiofficemac"}, []string{"agent.alive"})
  19. t.Log(r, err)
  20. So(err, ShouldBeNil)
  21. So(len(r), ShouldBeGreaterThanOrEqualTo, 0)
  22. for _, x := range r {
  23. t.Log(x)
  24. }
  25. })
  26. }