(t *testing.T)
| 501 | } |
| 502 | |
| 503 | func TestMultiPart(t *testing.T) { |
| 504 | initDb(t) |
| 505 | defer cleanupDb(t) |
| 506 | |
| 507 | ctx, cancelFn := context.WithTimeout(context.Background(), 5*time.Second) |
| 508 | defer cancelFn() |
| 509 | zoneId := uuid.NewString() |
| 510 | fileName := "m2" |
| 511 | data := makeText(80) |
| 512 | err := WFS.MakeFile(ctx, zoneId, fileName, nil, wshrpc.FileOpts{}) |
| 513 | if err != nil { |
| 514 | t.Fatalf("error creating file: %v", err) |
| 515 | } |
| 516 | err = WFS.AppendData(ctx, zoneId, fileName, []byte(data)) |
| 517 | if err != nil { |
| 518 | t.Fatalf("error appending data: %v", err) |
| 519 | } |
| 520 | checkFileSize(t, ctx, zoneId, fileName, 80) |
| 521 | checkFileData(t, ctx, zoneId, fileName, data) |
| 522 | _, barr, err := WFS.ReadAt(ctx, zoneId, fileName, 42, 10) |
| 523 | if err != nil { |
| 524 | t.Fatalf("error reading data: %v", err) |
| 525 | } |
| 526 | if string(barr) != data[42:52] { |
| 527 | t.Errorf("data mismatch: expected %q, got %q", data[42:52], string(barr)) |
| 528 | } |
| 529 | WFS.WriteAt(ctx, zoneId, fileName, 49, []byte("world")) |
| 530 | checkFileSize(t, ctx, zoneId, fileName, 80) |
| 531 | checkFileDataAt(t, ctx, zoneId, fileName, 49, "world") |
| 532 | checkFileDataAt(t, ctx, zoneId, fileName, 48, "8world4") |
| 533 | } |
| 534 | |
| 535 | func testIntMapsEq(t *testing.T, msg string, m map[int]int, expected map[int]int) { |
| 536 | if len(m) != len(expected) { |
nothing calls this directly
no test coverage detected