(t *testing.T)
| 11 | ) |
| 12 | |
| 13 | func TestCoreDNS(t *testing.T) { |
| 14 | env := coredns.DefaultEnv(context.Background(), &coredns.Request{}) |
| 15 | |
| 16 | tests := []struct { |
| 17 | input string |
| 18 | }{ |
| 19 | {`metadata('geoip/city/name') == 'Exampleshire'`}, |
| 20 | {`(type() == 'A' && name() == 'example.com') || client_ip() == '1.2.3.4'`}, |
| 21 | {`name() matches '^abc\\..*\\.example\\.com\\.$'`}, |
| 22 | {`type() in ['A', 'AAAA']`}, |
| 23 | {`incidr(client_ip(), '192.168.0.0/16')`}, |
| 24 | {`incidr(client_ip(), '127.0.0.0/24')`}, |
| 25 | } |
| 26 | |
| 27 | for _, test := range tests { |
| 28 | t.Run(test.input, func(t *testing.T) { |
| 29 | _, err := expr.Compile(test.input, expr.Env(env), expr.DisableBuiltin("type")) |
| 30 | assert.NoError(t, err) |
| 31 | }) |
| 32 | } |
| 33 | } |
nothing calls this directly
no test coverage detected
searching dependent graphs…