Disable mint full object tests (#20743)

Remove expected failures from https://github.com/minio/minio-go/pull/2026
This commit is contained in:
Klaus Post 2024-12-09 18:59:22 -08:00 committed by GitHub
parent aff2a76d80
commit 5bb31e4883
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 38 additions and 18 deletions

View File

@ -7,6 +7,7 @@ export ACCESS_KEY="$2"
export SECRET_KEY="$3" export SECRET_KEY="$3"
export JOB_NAME="$4" export JOB_NAME="$4"
export MINT_MODE="full" export MINT_MODE="full"
export MINT_NO_FULL_OBJECT="true"
docker system prune -f || true docker system prune -f || true
docker volume prune -f || true docker volume prune -f || true
@ -35,6 +36,7 @@ docker run --rm --net=mint_default \
-e ACCESS_KEY="${ACCESS_KEY}" \ -e ACCESS_KEY="${ACCESS_KEY}" \
-e SECRET_KEY="${SECRET_KEY}" \ -e SECRET_KEY="${SECRET_KEY}" \
-e ENABLE_HTTPS=0 \ -e ENABLE_HTTPS=0 \
-e MINT_NO_FULL_OBJECT="${MINT_NO_FULL_OBJECT}" \
-e MINT_MODE="${MINT_MODE}" \ -e MINT_MODE="${MINT_MODE}" \
docker.io/minio/mint:edge docker.io/minio/mint:edge

View File

@ -1338,6 +1338,7 @@ func (api objectAPIHandlers) PostPolicyBucketHandler(w http.ResponseWriter, r *h
return return
} }
} }
opts.EncryptFn = metadataEncrypter(objectEncryptionKey)
pReader, err = pReader.WithEncryption(hashReader, &objectEncryptionKey) pReader, err = pReader.WithEncryption(hashReader, &objectEncryptionKey)
if err != nil { if err != nil {
writeErrorResponse(ctx, w, toAPIError(ctx, err), r.URL) writeErrorResponse(ctx, w, toAPIError(ctx, err), r.URL)

View File

@ -404,12 +404,7 @@ func putOptsFromHeaders(ctx context.Context, hdr http.Header, metadata map[strin
metadata = make(map[string]string) metadata = make(map[string]string)
} }
wantCRC, err := hash.GetContentChecksum(hdr)
if err != nil {
return opts, fmt.Errorf("invalid/unknown checksum sent: %v", err)
}
etag := strings.TrimSpace(hdr.Get(xhttp.MinIOSourceETag)) etag := strings.TrimSpace(hdr.Get(xhttp.MinIOSourceETag))
if crypto.S3KMS.IsRequested(hdr) { if crypto.S3KMS.IsRequested(hdr) {
keyID, context, err := crypto.S3KMS.ParseHTTP(hdr) keyID, context, err := crypto.S3KMS.ParseHTTP(hdr)
if err != nil { if err != nil {
@ -423,7 +418,6 @@ func putOptsFromHeaders(ctx context.Context, hdr http.Header, metadata map[strin
ServerSideEncryption: sseKms, ServerSideEncryption: sseKms,
UserDefined: metadata, UserDefined: metadata,
MTime: mtime, MTime: mtime,
WantChecksum: wantCRC,
PreserveETag: etag, PreserveETag: etag,
}, nil }, nil
} }
@ -438,7 +432,6 @@ func putOptsFromHeaders(ctx context.Context, hdr http.Header, metadata map[strin
opts.ReplicationSourceRetentionTimestamp = retaintimestmp opts.ReplicationSourceRetentionTimestamp = retaintimestmp
opts.ReplicationSourceTaggingTimestamp = taggingtimestmp opts.ReplicationSourceTaggingTimestamp = taggingtimestmp
opts.PreserveETag = etag opts.PreserveETag = etag
opts.WantChecksum = wantCRC
return opts, nil return opts, nil
} }

View File

@ -1899,6 +1899,13 @@ func (api objectAPIHandlers) PutObjectHandler(w http.ResponseWriter, r *http.Req
var reader io.Reader var reader io.Reader
reader = rd reader = rd
var opts ObjectOptions
opts, err = putOptsFromReq(ctx, r, bucket, object, metadata)
if err != nil {
writeErrorResponse(ctx, w, toAPIError(ctx, err), r.URL)
return
}
actualSize := size actualSize := size
var idxCb func() []byte var idxCb func() []byte
if isCompressible(r.Header, object) && size > minCompressibleSize { if isCompressible(r.Header, object) && size > minCompressibleSize {
@ -1915,6 +1922,8 @@ func (api objectAPIHandlers) PutObjectHandler(w http.ResponseWriter, r *http.Req
writeErrorResponse(ctx, w, errorCodes.ToAPIErr(ErrInvalidChecksum), r.URL) writeErrorResponse(ctx, w, errorCodes.ToAPIErr(ErrInvalidChecksum), r.URL)
return return
} }
opts.WantChecksum = actualReader.Checksum()
// Set compression metrics. // Set compression metrics.
var s2c io.ReadCloser var s2c io.ReadCloser
wantEncryption := crypto.Requested(r.Header) wantEncryption := crypto.Requested(r.Header)
@ -1945,22 +1954,17 @@ func (api objectAPIHandlers) PutObjectHandler(w http.ResponseWriter, r *http.Req
writeErrorResponse(ctx, w, toAPIError(ctx, err), r.URL) writeErrorResponse(ctx, w, toAPIError(ctx, err), r.URL)
return return
} }
if err := hashReader.AddChecksum(r, size < 0); err != nil { if size >= 0 {
if err := hashReader.AddChecksum(r, false); err != nil {
writeErrorResponse(ctx, w, errorCodes.ToAPIErr(ErrInvalidChecksum), r.URL) writeErrorResponse(ctx, w, errorCodes.ToAPIErr(ErrInvalidChecksum), r.URL)
return return
} }
opts.WantChecksum = hashReader.Checksum()
}
rawReader := hashReader rawReader := hashReader
pReader := NewPutObjReader(rawReader) pReader := NewPutObjReader(rawReader)
var opts ObjectOptions
opts, err = putOptsFromReq(ctx, r, bucket, object, metadata)
if err != nil {
writeErrorResponse(ctx, w, toAPIError(ctx, err), r.URL)
return
}
opts.IndexCB = idxCb opts.IndexCB = idxCb
opts.WantChecksum = hashReader.Checksum()
if opts.PreserveETag != "" || if opts.PreserveETag != "" ||
r.Header.Get(xhttp.IfMatch) != "" || r.Header.Get(xhttp.IfMatch) != "" ||

View File

@ -257,6 +257,26 @@ func (r *Reader) Read(p []byte) (int, error) {
r.contentHasher.Write(p[:n]) r.contentHasher.Write(p[:n])
} }
// If we have reached our expected size,
// do one more read to ensure we are at EOF
// and that any trailers have been read.
attempts := 0
for err == nil && r.size >= 0 && r.bytesRead >= r.size {
attempts++
if r.bytesRead > r.size {
return 0, SizeTooLarge{Want: r.size, Got: r.bytesRead}
}
var tmp [1]byte
var n2 int
n2, err = r.src.Read(tmp[:])
if n2 > 0 {
return 0, SizeTooLarge{Want: r.size, Got: r.bytesRead}
}
if attempts == 100 {
return 0, io.ErrNoProgress
}
}
if err == io.EOF { // Verify content SHA256, if set. if err == io.EOF { // Verify content SHA256, if set.
if r.expectedMin > 0 { if r.expectedMin > 0 {
if r.bytesRead < r.expectedMin { if r.bytesRead < r.expectedMin {