From b7ea2ae4df91cb6a6c9ccee896900e089a1eccc9 Mon Sep 17 00:00:00 2001 From: Abhishek Pandey Date: Fri, 30 Jun 2023 09:26:13 -0700 Subject: [PATCH] Minor nits --- src/cli/repo/s3.go | 4 ++-- src/pkg/extensions/extensions.go | 5 +++-- src/pkg/extensions/extensions_test.go | 23 +---------------------- 3 files changed, 6 insertions(+), 26 deletions(-) diff --git a/src/cli/repo/s3.go b/src/cli/repo/s3.go index 7618e08cd..c54dffe66 100644 --- a/src/cli/repo/s3.go +++ b/src/cli/repo/s3.go @@ -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 diff --git a/src/pkg/extensions/extensions.go b/src/pkg/extensions/extensions.go index 01901f4c8..3814e7137 100644 --- a/src/pkg/extensions/extensions.go +++ b/src/pkg/extensions/extensions.go @@ -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, diff --git a/src/pkg/extensions/extensions_test.go b/src/pkg/extensions/extensions_test.go index debe08623..8b1412a28 100644 --- a/src/pkg/extensions/extensions_test.go +++ b/src/pkg/extensions/extensions_test.go @@ -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,