MCPcopy
hub / github.com/helm/helm / TestGetPluginName

Function TestGetPluginName

pkg/registry/plugin_test.go:23–93  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

21)
22
23func TestGetPluginName(t *testing.T) {
24 tests := []struct {
25 name string
26 source string
27 expected string
28 expectErr bool
29 }{
30 {
31 name: "valid OCI reference with tag",
32 source: "oci://ghcr.io/user/plugin-name:v1.0.0",
33 expected: "plugin-name",
34 },
35 {
36 name: "valid OCI reference with digest",
37 source: "oci://ghcr.io/user/plugin-name@sha256:1234567890abcdef",
38 expected: "plugin-name",
39 },
40 {
41 name: "valid OCI reference without tag",
42 source: "oci://ghcr.io/user/plugin-name",
43 expected: "plugin-name",
44 },
45 {
46 name: "valid OCI reference with multiple path segments",
47 source: "oci://registry.example.com/org/team/plugin-name:latest",
48 expected: "plugin-name",
49 },
50 {
51 name: "valid OCI reference with plus signs in tag",
52 source: "oci://registry.example.com/user/plugin-name:v1.0.0+build.1",
53 expected: "plugin-name",
54 },
55 {
56 name: "valid OCI reference - single path segment",
57 source: "oci://registry.example.com/plugin",
58 expected: "plugin",
59 },
60 {
61 name: "invalid OCI reference - no repository",
62 source: "oci://registry.example.com",
63 expectErr: true,
64 },
65 {
66 name: "invalid OCI reference - malformed",
67 source: "not-an-oci-reference",
68 expectErr: true,
69 },
70 }
71
72 for _, tt := range tests {
73 t.Run(tt.name, func(t *testing.T) {
74 pluginName, err := GetPluginName(tt.source)
75
76 if tt.expectErr {
77 if err == nil {
78 t.Error("expected error but got none")
79 }
80 return

Callers

nothing calls this directly

Calls 3

GetPluginNameFunction · 0.85
RunMethod · 0.65
ErrorMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…