| 30 | ) |
| 31 | |
| 32 | func TestGet(t *testing.T) { |
| 33 | tests := []struct { |
| 34 | name string |
| 35 | addr resolver.Address |
| 36 | want metadata.MD |
| 37 | }{ |
| 38 | { |
| 39 | name: "not set", |
| 40 | addr: resolver.Address{}, |
| 41 | want: nil, |
| 42 | }, |
| 43 | { |
| 44 | name: "not set", |
| 45 | addr: resolver.Address{ |
| 46 | Attributes: attributes.New(mdKey, mdValue(metadata.Pairs("k", "v"))), |
| 47 | }, |
| 48 | want: metadata.Pairs("k", "v"), |
| 49 | }, |
| 50 | } |
| 51 | for _, tt := range tests { |
| 52 | t.Run(tt.name, func(t *testing.T) { |
| 53 | if got := Get(tt.addr); !cmp.Equal(got, tt.want) { |
| 54 | t.Errorf("Get() = %v, want %v", got, tt.want) |
| 55 | } |
| 56 | }) |
| 57 | } |
| 58 | } |
| 59 | |
| 60 | func TestSet(t *testing.T) { |
| 61 | tests := []struct { |