(t *testing.T)
| 49 | } |
| 50 | |
| 51 | func TestEncodeNodeMetadata_ValidationErrors(t *testing.T) { |
| 52 | tests := []struct { |
| 53 | name string |
| 54 | role NodeRole |
| 55 | zone string |
| 56 | wantErr string |
| 57 | }{ |
| 58 | { |
| 59 | name: "zone too long", |
| 60 | role: NodeRoleMember, |
| 61 | zone: "0123456789abcdef0", // 17 bytes |
| 62 | wantErr: "zone name too long", |
| 63 | }, |
| 64 | } |
| 65 | |
| 66 | for _, tt := range tests { |
| 67 | t.Run(tt.name, func(t *testing.T) { |
| 68 | _, err := EncodeNodeMetadata(tt.role, tt.zone) |
| 69 | require.Error(t, err) |
| 70 | assert.Contains(t, err.Error(), tt.wantErr) |
| 71 | }) |
| 72 | } |
| 73 | } |
| 74 | |
| 75 | func TestEncodedNodeMetadata_ZeroAllocations(t *testing.T) { |
| 76 | encoded, err := EncodeNodeMetadata(NodeRoleBridge, "zone-a") |
nothing calls this directly
no test coverage detected