MCPcopy
hub / github.com/syncthing/syncthing / TestPullTempFileCaseConflict

Function TestPullTempFileCaseConflict

lib/model/folder_sendrecv_test.go:1148–1173  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

1146}
1147
1148func TestPullTempFileCaseConflict(t *testing.T) {
1149 _, f := setupSendReceiveFolder(t)
1150
1151 copyChan := make(chan copyBlocksState, 1)
1152
1153 file := protocol.FileInfo{Name: "foo"}
1154 confl := "Foo"
1155 tempNameConfl := fs.TempName(confl)
1156 if fd, err := f.mtimefs.Create(tempNameConfl); err != nil {
1157 t.Fatal(err)
1158 } else {
1159 if _, err := fd.Write([]byte("data")); err != nil {
1160 t.Fatal(err)
1161 }
1162 fd.Close()
1163 }
1164
1165 f.handleFile(t.Context(), file, copyChan)
1166
1167 cs := <-copyChan
1168 if _, err := cs.tempFile(); err != nil {
1169 t.Error(err)
1170 } else {
1171 cs.finalClose()
1172 }
1173}
1174
1175func TestPullCaseOnlyRename(t *testing.T) {
1176 m, f := setupSendReceiveFolder(t)

Callers

nothing calls this directly

Calls 10

TempNameFunction · 0.92
setupSendReceiveFolderFunction · 0.85
FatalMethod · 0.80
handleFileMethod · 0.80
tempFileMethod · 0.80
finalCloseMethod · 0.80
CreateMethod · 0.65
CloseMethod · 0.65
ErrorMethod · 0.65
WriteMethod · 0.45

Tested by

no test coverage detected