MCPcopy
hub / github.com/helm/helm / TestPluginPackageDefaultRequiresSigning

Function TestPluginPackageDefaultRequiresSigning

pkg/cmd/plugin_package_test.go:93–128  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

91}
92
93func TestPluginPackageDefaultRequiresSigning(t *testing.T) {
94 // Create a test plugin directory
95 tempDir := t.TempDir()
96 pluginDir := filepath.Join(tempDir, "test-plugin")
97 if err := os.MkdirAll(pluginDir, 0755); err != nil {
98 t.Fatal(err)
99 }
100
101 // Create a plugin.yaml file
102 if err := os.WriteFile(filepath.Join(pluginDir, "plugin.yaml"), []byte(testPluginYAML), 0644); err != nil {
103 t.Fatal(err)
104 }
105
106 // Create package options with default sign=true and invalid keyring
107 o := &pluginPackageOptions{
108 sign: true, // This is now the default
109 keyring: "/non/existent/keyring",
110 pluginPath: pluginDir,
111 destination: tempDir,
112 }
113
114 // Run the package command
115 out := &bytes.Buffer{}
116 err := o.run(out)
117
118 // Should fail because signing is required by default
119 if err == nil {
120 t.Error("expected error when signing fails with default settings")
121 }
122
123 // Check that no tarball was created
124 tarballPath := filepath.Join(tempDir, "test-plugin.tgz")
125 if _, err := os.Stat(tarballPath); !os.IsNotExist(err) {
126 t.Error("tarball should not exist when signing fails")
127 }
128}
129
130func TestPluginPackageSigningFailure(t *testing.T) {
131 // Create a test plugin directory

Callers

nothing calls this directly

Calls 4

runMethod · 0.95
FatalMethod · 0.80
WriteFileMethod · 0.45
ErrorMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…