hbase_test.go 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. package dao
  2. import (
  3. "context"
  4. "go-common/app/interface/main/history/model"
  5. "testing"
  6. "github.com/smartystreets/goconvey/convey"
  7. )
  8. func TestDaohashRowKey(t *testing.T) {
  9. convey.Convey("hashRowKey", t, func(ctx convey.C) {
  10. var (
  11. mid = int64(14771787)
  12. )
  13. ctx.Convey("When everything gose positive", func(ctx convey.C) {
  14. p1 := hashRowKey(mid)
  15. ctx.Convey("Then p1 should not be nil.", func(ctx convey.C) {
  16. ctx.So(p1, convey.ShouldNotBeNil)
  17. })
  18. })
  19. })
  20. }
  21. func TestDaocolumn(t *testing.T) {
  22. convey.Convey("column", t, func(ctx convey.C) {
  23. var (
  24. aid = int64(14771787)
  25. typ = int8(3)
  26. )
  27. ctx.Convey("When everything gose positive", func(ctx convey.C) {
  28. p1 := d.column(aid, typ)
  29. ctx.Convey("Then p1 should not be nil.", func(ctx convey.C) {
  30. ctx.So(p1, convey.ShouldNotBeNil)
  31. })
  32. })
  33. })
  34. }
  35. func TestDaoAdd(t *testing.T) {
  36. convey.Convey("Add", t, func(ctx convey.C) {
  37. var (
  38. h = &model.History{Mid: 14771787, Aid: 14771787}
  39. )
  40. ctx.Convey("When everything gose positive", func(ctx convey.C) {
  41. err := d.Add(context.Background(), h)
  42. ctx.Convey("Then err should be nil.", func(ctx convey.C) {
  43. ctx.So(err, convey.ShouldBeNil)
  44. })
  45. })
  46. })
  47. }