golang-im聊天
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.
 
 
 
 

57 lines
987 B

  1. package k8s
  2. import (
  3. "context"
  4. "fmt"
  5. "testing"
  6. "google.golang.org/grpc"
  7. )
  8. func Test_resolveEndpoint(t *testing.T) {
  9. fmt.Println(resolveEndpoint("namespace.server_name:port"))
  10. }
  11. func TestClient(t *testing.T) {
  12. _, err := grpc.DialContext(context.TODO(), "172.18.0.2:8000", grpc.WithInsecure())
  13. if err != nil {
  14. panic(err)
  15. }
  16. }
  17. func Test_isEqual(t *testing.T) {
  18. type args struct {
  19. s1 []string
  20. s2 []string
  21. }
  22. tests := []struct {
  23. name string
  24. args args
  25. want bool
  26. }{
  27. {
  28. name: "",
  29. args: args{s1: []string{"1", "2"}, s2: []string{"2", "1"}},
  30. want: true,
  31. },
  32. {
  33. name: "",
  34. args: args{s1: []string{"1", "2"}, s2: []string{"1", "2"}},
  35. want: true,
  36. },
  37. {
  38. name: "",
  39. args: args{s1: []string{"1", "2"}, s2: []string{"1"}},
  40. want: false,
  41. },
  42. }
  43. for _, tt := range tests {
  44. t.Run(tt.name, func(t *testing.T) {
  45. if got := isEqualIps(tt.args.s1, tt.args.s2); got != tt.want {
  46. t.Errorf("isEqual() = %v, want %v", got, tt.want)
  47. }
  48. })
  49. }
  50. }