test: fix test w/curl error, bucket creation/location tests

This commit is contained in:
Luke McCrone
2025-11-25 11:49:34 -05:00
parent 13810e227c
commit 9c8e14d406
48 changed files with 654 additions and 265 deletions
+5 -10
View File
@@ -6,7 +6,6 @@ import (
"crypto/sha256"
"encoding/base64"
"encoding/hex"
"errors"
"fmt"
logger "github.com/versity/versitygw/tests/rest_scripts/logger"
"os"
@@ -112,9 +111,6 @@ type S3Command struct {
}
func (s *S3Command) OpenSSLCommand() error {
if s.FilePath == "" {
return errors.New("for openssl command, filePath must be set")
}
if err := s.prepareForBuild(); err != nil {
return fmt.Errorf("error preparing for command building: %w", err)
}
@@ -162,9 +158,6 @@ func (s *S3Command) prepareForBuild() error {
}
func (s *S3Command) preparePayload() error {
if s.PayloadFile != "" && s.Payload != "" {
return fmt.Errorf("cannot have both payload and payloadFile parameters set")
}
if s.PayloadFile != "" {
s.dataSource = NewFileDataSource(s.PayloadFile)
} else if s.Payload != "" {
@@ -198,6 +191,8 @@ func (s *S3Command) initializeOpenSSLPayloadAndGetContentLength() error {
streamingUnsignedPayloadTrailerImpl := NewStreamingUnsignedPayloadWithTrailer(s.dataSource, int64(s.ChunkSize), s.ChecksumType)
streamingUnsignedPayloadTrailerImpl.OmitTrailerOrKey(s.OmitPayloadTrailer, s.OmitPayloadTrailerKey)
s.payloadOpenSSL = streamingUnsignedPayloadTrailerImpl
case UnsignedPayload, "":
s.payloadOpenSSL = NewWholePayload(s.dataSource)
default:
return fmt.Errorf("unsupported OpenSSL payload type: '%s'", s.PayloadType)
}
@@ -407,6 +402,9 @@ func (s *S3Command) buildOpenSSLCommand() error {
if _, err = file.Write(openSSLCommandBytes); err != nil {
return fmt.Errorf("error writing to file: %w", err)
}
if _, err := file.Write([]byte{'\r', '\n', '\r', '\n'}); err != nil {
return fmt.Errorf("error writing to file: %w", err)
}
if s.PayloadFile != "" || s.Payload != "" {
if err = s.writeOpenSSLPayload(file); err != nil {
return fmt.Errorf("error writing openssl payload: %w", err)
@@ -416,9 +414,6 @@ func (s *S3Command) buildOpenSSLCommand() error {
}
func (s *S3Command) writeOpenSSLPayload(file *os.File) error {
if _, err := file.Write([]byte{'\r', '\n', '\r', '\n'}); err != nil {
return fmt.Errorf("error writing to file: %w", err)
}
if awsPayload, ok := s.payloadOpenSSL.(*PayloadStreamingAWS4HMACSHA256); ok {
awsPayload.AddInitialSignatureAndSigningKey(s.signature, s.signingKey)
}