TestAtomicWriteFile_LargeContent tests with large content
(t *testing.T)
| 97 | |
| 98 | // TestAtomicWriteFile_LargeContent tests with large content |
| 99 | func TestAtomicWriteFile_LargeContent(t *testing.T) { |
| 100 | dir := t.TempDir() |
| 101 | testpath := filepath.Join(dir, "large_test") |
| 102 | |
| 103 | // Create a large content string |
| 104 | largeContent := strings.Repeat("HELM", 1024*1024) |
| 105 | reader := bytes.NewReader([]byte(largeContent)) |
| 106 | mode := os.FileMode(0644) |
| 107 | |
| 108 | err := AtomicWriteFile(testpath, reader, mode) |
| 109 | if err != nil { |
| 110 | t.Errorf("AtomicWriteFile error with large content: %s", err) |
| 111 | } |
| 112 | |
| 113 | got, err := os.ReadFile(testpath) |
| 114 | if err != nil { |
| 115 | t.Fatal(err) |
| 116 | } |
| 117 | |
| 118 | if largeContent != string(got) { |
| 119 | t.Fatalf("expected large content to match, got different length: %d vs %d", len(largeContent), len(got)) |
| 120 | } |
| 121 | } |
| 122 | |
| 123 | // TestPlatformAtomicWriteFile_OverwritesExisting verifies that the platform |
| 124 | // helper replaces existing files instead of silently skipping them. |
nothing calls this directly
no test coverage detected
searching dependent graphs…