Minor nits

This commit is contained in:
Abhishek Pandey 2023-06-30 09:26:13 -07:00
parent e8fb164f18
commit b7ea2ae4df
3 changed files with 6 additions and 26 deletions

View File

@ -57,8 +57,8 @@ func addS3Commands(cmd *cobra.Command) *cobra.Command {
// More generic and more frequently used flags take precedence.
fs.StringVar(&bucket, "bucket", "", "Name of S3 bucket for repo. (required)")
fs.StringVar(&prefix, "prefix", "", "Repo prefix within bucket.")
fs.StringVar(&endpoint, "endpoint", "127.0.0.1:9000", "S3 service endpoint.")
fs.BoolVar(&doNotUseTLS, "disable-tls", true, "Disable TLS (HTTPS)")
fs.StringVar(&endpoint, "endpoint", "s3.amazonaws.com", "S3 service endpoint.")
fs.BoolVar(&doNotUseTLS, "disable-tls", false, "Disable TLS (HTTPS)")
fs.BoolVar(&doNotVerifyTLS, "disable-tls-verification", false, "Disable TLS (HTTPS) certificate verification.")
// In general, we don't want to expose this flag to users and have them mistake it

View File

@ -22,7 +22,7 @@ type CorsoItemExtensionFactory func(
*details.ExtensionInfo,
) (CorsoItemExtension, error)
// Thin wrapper for runtime logging & metrics
// Thin wrapper for runtime logging & metrics around extensions
type loggerExtension struct {
info details.ItemInfo
innerRc io.ReadCloser
@ -84,7 +84,8 @@ var _ AddItemExtensioner = &ItemExtensionHandler{}
type ItemExtensionHandler struct{}
// AddItemExtensions wraps provided readcloser with extensions
// supplied via factory
// supplied via factory, with the first extension in slice being
// the innermost one.
func (eh *ItemExtensionHandler) AddItemExtensions(
ctx context.Context,
rc io.ReadCloser,

View File

@ -20,9 +20,7 @@ import (
var _ CorsoItemExtension = &MockExtension{}
// Temporary, testing purposes only
type MockExtension struct {
// TODO: Add cumlulative crc32 checksum
numBytes int
crc32 uint32
info details.ItemInfo
@ -48,7 +46,7 @@ func (me *MockExtension) Read(p []byte) (int, error) {
me.crc32 = crc32.Update(me.crc32, crc32.IEEETable, p[:n])
if err == io.EOF {
logger.Ctx(me.ctx).Info("mock extension reached EOF")
logger.Ctx(me.ctx).Debug("mock extension reached EOF")
me.extInfo.Data["numBytes"] = me.numBytes
me.extInfo.Data["crc32"] = me.crc32
}
@ -97,25 +95,6 @@ func TestExtensionsUnitSuite(t *testing.T) {
suite.Run(t, &ExtensionsUnitSuite{Suite: tester.NewUnitSuite(t)})
}
// func readFrom(rc io.ReadCloser) error {
// defer rc.Close()
// p := make([]byte, 4)
// for {
// _, err := rc.Read(p)
// if err == io.EOF {
// break
// }
// if err != nil {
// return err
// }
// }
// return nil
// }
func (suite *ExtensionsUnitSuite) TestAddItemExtensions() {
type outputValidationFunc func(
extRc io.ReadCloser,