MCPcopy Create free account
hub / github.com/docker/docker-agent / TestIsExternalReference

Function TestIsExternalReference

pkg/config/resolve_test.go:644–707  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

642}
643
644func TestIsExternalReference(t *testing.T) {
645 t.Parallel()
646
647 tests := []struct {
648 name string
649 input string
650 expected bool
651 }{
652 {
653 name: "OCI reference with namespace",
654 input: "agentcatalog/pirate",
655 expected: true,
656 },
657 {
658 name: "OCI reference with registry",
659 input: "docker.io/myorg/myagent:v1",
660 expected: true,
661 },
662 {
663 name: "HTTPS URL",
664 input: "https://example.com/agent.yaml",
665 expected: true,
666 },
667 {
668 name: "HTTP URL",
669 input: "http://example.com/agent.yaml",
670 expected: true,
671 },
672 {
673 name: "simple agent name is not external",
674 input: "my_agent",
675 expected: false,
676 },
677 {
678 name: "agent name with hyphen is not external",
679 input: "my-local-agent",
680 expected: false,
681 },
682 {
683 name: "empty string is not external",
684 input: "",
685 expected: false,
686 },
687 {
688 name: "named OCI reference is external",
689 input: "reviewer:agentcatalog/review-pr",
690 expected: true,
691 },
692 {
693 name: "named URL reference is external",
694 input: "myagent:https://example.com/agent.yaml",
695 expected: true,
696 },
697 }
698
699 for _, tt := range tests {
700 t.Run(tt.name, func(t *testing.T) {
701 t.Parallel()

Callers

nothing calls this directly

Calls 2

IsExternalReferenceFunction · 0.85
RunMethod · 0.65

Tested by

no test coverage detected