Its not networked
// Read the data back
fmt.Println("Fetching object back using GetObject...")
r, err := c.GetObject(context.Background(), bucketName, objectName, minio.GetObjectOptions{})
if err != nil {
logError(testName, function, args, startTime, "", "GetObject failed", err)
return
}
defer r.Close()
fmt.Println("GetObject successful")
// Stat the object
st, err := r.Stat()
if err != nil {
logError(testName, function, args, startTime, "", "Stat object failed", err)
return
}
fmt.Printf("Stat object successful. Object size: %d bytes\n", st.Size)
if st.Size != int64(bufSize) { // bufSize is original object size (129 MB)
logError(testName, function, args, startTime, "", fmt.Sprintf("Number of bytes does not match, expected %d, got %d", bufSize, st.Size), err)
return
}
fmt.Println("Object size verified against expected buffer size")
--------------------------------------------------------
// Comparison function after seek
cmpData := func(r io.Reader, start, end int) {
if end-start == 0 {
fmt.Printf("cmpData: no bytes to compare (start: %d, end: %d)\n", start, end)
return
}
fmt.Printf("cmpData: comparing bytes from %d to %d...\n", start, end)
buffer := bytes.NewBuffer([]byte{})
// This is the critical line where the error occurs
if _, err := io.CopyN(buffer, r, int64(bufSize)); err != nil {
if err != io.EOF {
logError(testName, function, args, startTime, "", "CopyN failed", err)
return
}
// ... rest of cmpData function ...
}
if !bytes.Equal(buf[start:end], buffer.Bytes()) {
logError(testName, function, args, startTime, "", "Incorrect read bytes v/s original buffer", err)
return
}
fmt.Println("cmpData: byte comparison successful — data matches original buffer")
}
----------------------------------------------------------------------------