memcache_test.go 847 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. package dao
  2. import (
  3. "context"
  4. "testing"
  5. "go-common/app/job/main/dm/model"
  6. . "github.com/smartystreets/goconvey/convey"
  7. )
  8. func TestSubjectCache(t *testing.T) {
  9. Convey("subject cache", t, func() {
  10. sub, err := testDao.SubjectCache(context.TODO(), 1, 1221)
  11. So(err, ShouldBeNil)
  12. So(sub, ShouldNotBeNil)
  13. })
  14. }
  15. func TestSetSubjectCache(t *testing.T) {
  16. sub := &model.Subject{
  17. Type: 1,
  18. Oid: 1221,
  19. }
  20. Convey("add subject cache", t, func() {
  21. err := testDao.SetSubjectCache(context.TODO(), sub)
  22. So(err, ShouldBeNil)
  23. })
  24. }
  25. func TestDurationCache(t *testing.T) {
  26. Convey("", t, func() {
  27. _, err := testDao.DurationCache(context.TODO(), 1221)
  28. So(err, ShouldBeNil)
  29. })
  30. }
  31. func TestSetDurationCachee(t *testing.T) {
  32. Convey("", t, func() {
  33. err := testDao.SetDurationCache(context.TODO(), 1221, 10000)
  34. So(err, ShouldBeNil)
  35. })
  36. }