MCPcopy Create free account
hub / github.com/Driver-C/tryssh / CreateTestConfigFile

Function CreateTestConfigFile

testutil/helpers.go:18–28  ·  view source on GitHub ↗

CreateTestConfigFile writes a test configuration file in the given directory.

(t *testing.T, dir string, content string)

Source from the content-addressed store, hash-verified

16
17// CreateTestConfigFile writes a test configuration file in the given directory.
18func CreateTestConfigFile(t *testing.T, dir string, content string) string {
19 t.Helper()
20 path := filepath.Join(dir, "tryssh.db")
21 if err := os.MkdirAll(filepath.Dir(path), 0755); err != nil {
22 t.Fatalf("Failed to create config dir: %v", err)
23 }
24 if err := os.WriteFile(path, []byte(content), 0644); err != nil {
25 t.Fatalf("Failed to write test config: %v", err)
26 }
27 return path
28}
29
30// CreateTestKnownHosts writes a test known_hosts file in the given directory.
31func CreateTestKnownHosts(t *testing.T, dir string, content string) string {

Calls

no outgoing calls