grpc_snap_test.go 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. package service
  2. import (
  3. . "github.com/smartystreets/goconvey/convey"
  4. "go-common/app/admin/ep/melloi/model"
  5. "testing"
  6. )
  7. var (
  8. gs = model.GRPCSnap{
  9. ID: 1,
  10. GRPCID: 1,
  11. TaskName: "test",
  12. Department: "test",
  13. Project: "ep",
  14. APP: "melloi",
  15. Active: 1,
  16. HostName: "172.22.33.22",
  17. Port: 9000,
  18. ServiceName: "get",
  19. ProtoClassName: "code",
  20. PkgPath: "book",
  21. RequestType: "reqmsg",
  22. RequestMethod: "reqmethod",
  23. RequestContent: "reqcontent",
  24. ResponseType: "returnmsg",
  25. ScriptPath: "sp",
  26. JarPath: "jp",
  27. JmxPath: "jmxpat",
  28. JmxLog: "hnxkig",
  29. JtlLog: "ht.lgo",
  30. ThreadsSum: 1,
  31. RampUp: 1,
  32. Loops: -1,
  33. LoadTime: 1,
  34. UpdateBy: "hujianping",
  35. }
  36. )
  37. func Test_GrpcSnap(t *testing.T) {
  38. Convey("query grpc snap", t, func() {
  39. _, err := s.QueryGRPCSnapByID(gs.ID)
  40. So(err, ShouldBeNil)
  41. })
  42. Convey("update grpc snap", t, func() {
  43. err := s.UpdateGRPCSnap(&gs)
  44. So(err, ShouldBeNil)
  45. })
  46. Convey("create grpc snap", t, func() {
  47. err := s.CreateGRPCSnap(&gs)
  48. So(err, ShouldBeNil)
  49. })
  50. Convey("delete grpc snap", t, func() {
  51. err := s.DeleteGRPCSnap(gs.ID)
  52. So(err, ShouldBeNil)
  53. })
  54. }