蛋蛋星球-客户端
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

hdl_friend_circle._test.go 1.4 KiB

2 周前
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. package friend_circle
  2. import (
  3. "code.fnuoos.com/EggPlanet/egg_system_rules.git/md"
  4. "code.fnuoos.com/go_rely_warehouse/zyos_go_es.git/es"
  5. "fmt"
  6. "testing"
  7. )
  8. func TestCreateFriendCircleIndex(t *testing.T) {
  9. es.Init("http://123.57.140.192:9200", "elastic", "fnuo123")
  10. err := es.CreateIndexIfNotExists(md.EggFriendCircleEsIndex, md.EggFriendCircleEsMapping)
  11. if err != nil {
  12. fmt.Println(err)
  13. }
  14. fmt.Println("success")
  15. }
  16. func TestCreateFriendCircleCommentLikeIndex(t *testing.T) {
  17. es.Init("http://123.57.140.192:9200", "elastic", "fnuo123")
  18. for i := 0; i < 10; i++ {
  19. index := fmt.Sprintf("%s%d", md.EggFriendCircleLikeEsIndex, i)
  20. err := es.CreateIndexIfNotExists(index, md.EggFriendCircleLikeEsMapping)
  21. if err != nil {
  22. fmt.Println(err)
  23. }
  24. }
  25. fmt.Println("success")
  26. }
  27. func TestCreateFriendCircleCommentIndex(t *testing.T) {
  28. es.Init("http://123.57.140.192:9200", "elastic", "fnuo123")
  29. for i := 0; i < 10; i++ {
  30. index := fmt.Sprintf("%s%d", md.EggFriendCircleCommentEsIndex, i)
  31. err := es.CreateIndexIfNotExists(index, md.EggFriendCircleCommentEsMapping)
  32. if err != nil {
  33. fmt.Println(err)
  34. }
  35. }
  36. fmt.Println("success")
  37. }
  38. func TestDeleteIndex(t *testing.T) {
  39. es.Init("http://123.57.140.192:9200", "elastic", "fnuo123")
  40. for i := 0; i < 10; i++ {
  41. index := fmt.Sprintf("%s%d", md.EggFriendCircleLikeEsIndex, i)
  42. _, err := es.DeleteIndex(index)
  43. if err != nil {
  44. fmt.Println(err)
  45. return
  46. }
  47. }
  48. fmt.Println("success")
  49. }