MCPcopy Create free account
hub / github.com/containers/image / TestNamespaces

Function TestNamespaces

storage/storage_test.go:616–653  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

614}
615
616func TestNamespaces(t *testing.T) {
617 newStore(t)
618
619 ref, err := Transport.ParseReference("test@aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
620 if err != nil {
621 t.Fatalf("ParseReference(%q) returned error %v", "test", err)
622 }
623 if ref == nil {
624 t.Fatalf("ParseReference returned nil reference")
625 }
626
627 namespaces := ref.PolicyConfigurationNamespaces()
628 for _, namespace := range namespaces {
629 t.Logf("namespace: %q", namespace)
630 err = Transport.ValidatePolicyConfigurationScope(namespace)
631 if ref == nil {
632 t.Fatalf("ValidatePolicyConfigurationScope(%q) returned error: %v", namespace, err)
633 }
634 }
635 namespace := ref.StringWithinTransport()
636 t.Logf("ref: %q", namespace)
637 err = Transport.ValidatePolicyConfigurationScope(namespace)
638 if err != nil {
639 t.Fatalf("ValidatePolicyConfigurationScope(%q) returned error: %v", namespace, err)
640 }
641 for _, namespace := range []string{
642 "@beefee",
643 ":miracle",
644 ":miracle@beefee",
645 "@beefee:miracle",
646 } {
647 t.Logf("invalid ref: %q", namespace)
648 err = Transport.ValidatePolicyConfigurationScope(namespace)
649 if err == nil {
650 t.Fatalf("ValidatePolicyConfigurationScope(%q) should have failed", namespace)
651 }
652 }
653}
654
655func TestSize(t *testing.T) {
656 ensureTestCanCreateImages(t)

Callers

nothing calls this directly

Calls 5

newStoreFunction · 0.85
ParseReferenceMethod · 0.65
StringWithinTransportMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…