databus_test.go 877 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. package dao
  2. import (
  3. "context"
  4. "encoding/json"
  5. "fmt"
  6. "testing"
  7. "go-common/app/interface/main/dm2/model"
  8. . "github.com/smartystreets/goconvey/convey"
  9. )
  10. func TestPubDatabus(t *testing.T) {
  11. var (
  12. tp int32 = 1
  13. aid int64 = 10097265
  14. oid int64 = 1508
  15. cnt int64 = 26
  16. num int64 = 1
  17. duration int64 = 9031000
  18. c = context.TODO()
  19. )
  20. Convey("flush segment dm xml", t, func() {
  21. err := testDao.PubDatabus(c, tp, aid, oid, cnt, num, duration)
  22. So(err, ShouldBeNil)
  23. })
  24. }
  25. func TestSendAction(t *testing.T) {
  26. var (
  27. c = context.TODO()
  28. flush = &model.Flush{Oid: 1221, Type: 1}
  29. )
  30. Convey("flush xml", t, func() {
  31. data, err := json.Marshal(flush)
  32. So(err, ShouldBeNil)
  33. act := &model.Action{Action: model.ActionFlush, Data: data}
  34. err = testDao.SendAction(c, fmt.Sprint(flush.Oid), act)
  35. So(err, ShouldBeNil)
  36. })
  37. }