(t *testing.T)
| 300 | } |
| 301 | |
| 302 | func TestAttributesOneofAttr(t *testing.T) { |
| 303 | reg := newTestRegistry(t) |
| 304 | cont, err := containers.NewContainer(containers.Name("acme.ns")) |
| 305 | if err != nil { |
| 306 | t.Fatal(err) |
| 307 | } |
| 308 | attrs := NewAttributeFactory(cont, reg, reg) |
| 309 | data := map[string]any{ |
| 310 | "a": map[string]any{ |
| 311 | "b": []int32{2, 42}, |
| 312 | }, |
| 313 | "acme.a.b": 1, |
| 314 | "acme.ns.a.b": "found", |
| 315 | } |
| 316 | vars, _ := NewActivation(data) |
| 317 | |
| 318 | // a.b -> should resolve to acme.ns.a.b per namespace resolution rules. |
| 319 | attr := attrs.MaybeAttribute(1, "a") |
| 320 | qualB := makeQualifier(t, attrs, nil, 2, "b") |
| 321 | attr.AddQualifier(qualB) |
| 322 | out, err := attr.Resolve(vars) |
| 323 | if err != nil { |
| 324 | t.Fatal(err) |
| 325 | } |
| 326 | if out != "found" { |
| 327 | t.Errorf("Got %v, wanted 'found'", out) |
| 328 | } |
| 329 | } |
| 330 | |
| 331 | func TestAttributesConditionalAttrTrueBranch(t *testing.T) { |
| 332 | reg := newTestRegistry(t) |
nothing calls this directly
no test coverage detected