(t *testing.T)
| 49 | } |
| 50 | |
| 51 | func TestHostnameValidator(t *testing.T) { |
| 52 | tests := []struct { |
| 53 | name string |
| 54 | input string |
| 55 | wantsErr bool |
| 56 | }{ |
| 57 | { |
| 58 | name: "valid hostname", |
| 59 | input: "internal.instance", |
| 60 | wantsErr: false, |
| 61 | }, |
| 62 | { |
| 63 | name: "hostname with slashes", |
| 64 | input: "//internal.instance", |
| 65 | wantsErr: true, |
| 66 | }, |
| 67 | { |
| 68 | name: "empty hostname", |
| 69 | input: " ", |
| 70 | wantsErr: true, |
| 71 | }, |
| 72 | { |
| 73 | name: "hostname with colon", |
| 74 | input: "internal.instance:2205", |
| 75 | wantsErr: true, |
| 76 | }, |
| 77 | } |
| 78 | |
| 79 | for _, tt := range tests { |
| 80 | t.Run(tt.name, func(t *testing.T) { |
| 81 | err := HostnameValidator(tt.input) |
| 82 | if tt.wantsErr { |
| 83 | assert.Error(t, err) |
| 84 | return |
| 85 | } |
| 86 | assert.NoError(t, err) |
| 87 | }) |
| 88 | } |
| 89 | } |
| 90 | |
| 91 | func TestGraphQLEndpoint(t *testing.T) { |
| 92 | tests := []struct { |
nothing calls this directly
no test coverage detected