蛋蛋星球-客户端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

58 lines
1.4 KiB

  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. }