From 4b3387371f6cdf0d3d0f05709430df3386ebdb2d Mon Sep 17 00:00:00 2001 From: abhiguptacse Date: Wed, 6 Nov 2024 07:16:40 +0000 Subject: [PATCH 1/4] adding sample component + enabled UT --- SampleCustomConfig.yaml | 30 +++ blobfuse2-code-coverage.yaml | 2 +- component/custom/custom_test.go | 6 +- test/e2e_tests/custom_component_test.go | 205 +++++++++++++++++++ test/e2e_tests/data_validation_test.go | 79 -------- test/sample_custom_component1/go.mod | 34 ++++ test/sample_custom_component1/go.sum | 95 +++++++++ test/sample_custom_component1/main.go | 177 ++++++++++++++++ test/sample_custom_component2/go.mod | 34 ++++ test/sample_custom_component2/go.sum | 95 +++++++++ test/sample_custom_component2/main.go | 256 ++++++++++++++++++++++++ 11 files changed, 930 insertions(+), 83 deletions(-) create mode 100644 SampleCustomConfig.yaml mode change 100644 => 100755 component/custom/custom_test.go create mode 100644 test/e2e_tests/custom_component_test.go create mode 100644 test/sample_custom_component1/go.mod create mode 100644 test/sample_custom_component1/go.sum create mode 100644 test/sample_custom_component1/main.go create mode 100644 test/sample_custom_component2/go.mod create mode 100644 test/sample_custom_component2/go.sum create mode 100644 test/sample_custom_component2/main.go diff --git a/SampleCustomConfig.yaml b/SampleCustomConfig.yaml new file mode 100644 index 000000000..f4a75d011 --- /dev/null +++ b/SampleCustomConfig.yaml @@ -0,0 +1,30 @@ +# sample config to test the custom component +allow-other: true + +logging: + type: base + level: log_debug + +components: + - libfuse + - block_cache + - sample_custom_component1 + - sample_custom_component2 + +sample_custom_component1: + block-size-mb: 16 + +sample_custom_component2: + block-size-mb: 16 +libfuse: + attribute-expiration-sec: 120 + entry-expiration-sec: 120 + negative-entry-expiration-sec: 240 + +block_cache: + block-size-mb: 16 + path: /tmp/cache + parallelism: 128 + +attr_cache: + timeout-sec: 7200 \ No newline at end of file diff --git a/blobfuse2-code-coverage.yaml b/blobfuse2-code-coverage.yaml index 8783077bc..9c9a02996 100644 --- a/blobfuse2-code-coverage.yaml +++ b/blobfuse2-code-coverage.yaml @@ -592,7 +592,7 @@ stages: - script: | echo 'mode: count' > ./blobfuse2_coverage_raw.rpt tail -q -n +2 ./*.cov >> ./blobfuse2_coverage_raw.rpt - cat ./blobfuse2_coverage_raw.rpt | grep -v mock_component | grep -v base_component | grep -v loopback | grep -v tools | grep -v "common/log" | grep -v "common/exectime" | grep -v "common/types.go" | grep -v "internal/stats_manager" | grep -v "main.go" | grep -v "component/azstorage/azauthmsi.go" | grep -v "component/azstorage/azauthspn.go" | grep -v "component/stream" | grep -v "component/custom" | grep -v "component/azstorage/azauthcli.go" > ./blobfuse2_coverage.rpt + cat ./blobfuse2_coverage_raw.rpt | grep -v mock_component | grep -v base_component | grep -v loopback | grep -v tools | grep -v "common/log" | grep -v "common/exectime" | grep -v "common/types.go" | grep -v "internal/stats_manager" | grep -v "main.go" | grep -v "component/azstorage/azauthmsi.go" | grep -v "component/azstorage/azauthspn.go" | grep -v "component/stream" | grep -v "component/azstorage/azauthcli.go" > ./blobfuse2_coverage.rpt go tool cover -func blobfuse2_coverage.rpt > ./blobfuse2_func_cover.rpt go tool cover -html=./blobfuse2_coverage.rpt -o ./blobfuse2_coverage.html go tool cover -html=./blobfuse2_ut.cov -o ./blobfuse2_ut.html diff --git a/component/custom/custom_test.go b/component/custom/custom_test.go old mode 100644 new mode 100755 index c4ab82df0..94a1b13ef --- a/component/custom/custom_test.go +++ b/component/custom/custom_test.go @@ -64,7 +64,7 @@ func (suite *customTestSuite) SetupTest() { // // This flag disables all optimizations and inline replacements and then .so will load in debug mode as well. // However same .so will not work with cli mount and there you need to build .so without these flags. -func (suite *customTestSuite) _TestInitializePluginsValidPath() { +func (suite *customTestSuite) TestInitializePluginsValidPath() { // Direct paths to the Go plugin source files source1 := "../../test/sample_custom_component1/main.go" source2 := "../../test/sample_custom_component2/main.go" @@ -74,10 +74,10 @@ func (suite *customTestSuite) _TestInitializePluginsValidPath() { plugin2 := "./sample_custom_component2.so" // Compile the Go plugin source files into .so files - cmd := exec.Command("go", "build", "-buildmode=plugin", "-gcflags=all=-N -l", "-o", plugin1, source1) + cmd := exec.Command("go", "build", "-buildmode=plugin", "-o", plugin1, source1) err := cmd.Run() suite.assert.Nil(err) - cmd = exec.Command("go", "build", "-buildmode=plugin", "-gcflags=all=-N -l", "-o", plugin2, source2) + cmd = exec.Command("go", "build", "-buildmode=plugin", "-o", plugin2, source2) err = cmd.Run() suite.assert.Nil(err) diff --git a/test/e2e_tests/custom_component_test.go b/test/e2e_tests/custom_component_test.go new file mode 100644 index 000000000..f1f5fb1b6 --- /dev/null +++ b/test/e2e_tests/custom_component_test.go @@ -0,0 +1,205 @@ +/* + _____ _____ _____ ____ ______ _____ ------ + | | | | | | | | | | | | | + | | | | | | | | | | | | | + | --- | | | | |-----| |---- | | |-----| |----- ------ + | | | | | | | | | | | | | + | ____| |_____ | ____| | ____| | |_____| _____| |_____ |_____ + + + Licensed under the MIT License . + + Copyright © 2020-2024 Microsoft Corporation. All rights reserved. + Author : + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all + copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + SOFTWARE +*/ + +package e2e_tests + +import ( + "crypto/md5" + "flag" + "fmt" + "io" + "math/rand" + "os" + "os/exec" + "path/filepath" + "testing" + "time" + + "github.com/stretchr/testify/suite" +) + +var customComponentMntPathPtr string +var customComponentTempPathPtr string +var customComponentStoragePathPtr string + +var buffer []byte + +const MB int64 = (1024 * 1024) + +type customComponentTestSuite struct { + suite.Suite +} + +type testConf struct { + testMntPath string + testLocalPath string + testStoragePath string // path which is backed by the storage +} + +var tConf testConf + +func regcustomComponentTestFlag(p *string, name string, value string, usage string) { + if flag.Lookup(name) == nil { + flag.StringVar(p, name, value, usage) + } +} + +func getcustomComponentTestFlag(name string) string { + return flag.Lookup(name).Value.(flag.Getter).Get().(string) +} + +func initcustomComponentFlags() { + customComponentMntPathPtr = getcustomComponentTestFlag("mnt-path") + customComponentTempPathPtr = getcustomComponentTestFlag("tmp-path") + customComponentStoragePathPtr = getcustomComponentTestFlag("storage-path") + blockSizeMB = flag.Lookup("block-size-mb").Value.(flag.Getter).Get().(int) +} + +func getcustomComponentTestDirName(n int) string { + rand.Seed(time.Now().UnixNano()) + b := make([]byte, n) + rand.Read(b) + return fmt.Sprintf("%x", b)[:n] +} + +func (suite *customComponentTestSuite) copyToMountDir(localFilePath string, remoteFilePath string) { + // copy to mounted directory + cpCmd := exec.Command("cp", localFilePath, remoteFilePath) + cliOut, err := cpCmd.Output() + if len(cliOut) != 0 { + fmt.Println(string(cliOut)) + } + suite.Equal(nil, err) +} + +// Computes MD5 and returns the 32byte slice which represents the hash value +func (suite *customComponentTestSuite) computeMD5(filePath string) []byte { + fh, err := os.Open(filePath) + suite.Nil(err) + + fi, err := fh.Stat() + suite.Nil(err) + size := fi.Size() + + hash := md5.New() + bytesCopied, err := io.Copy(hash, fh) + suite.Nil(err) + suite.Equal(size, bytesCopied) + + err = fh.Close() + suite.Nil(err) + + return hash.Sum(nil) +} + +func (suite *customComponentTestSuite) validateData(localFilePath string, remoteFilePath string) { + localMD5sum := suite.computeMD5(localFilePath) + remoteMD5sum := suite.computeMD5(remoteFilePath) + suite.Equal(localMD5sum, remoteMD5sum) +} + +func (suite *customComponentTestSuite) TestCustomComponentIOValidation() { + // Test for writing to the custom component + fileName := "test_file.txt" + localFilePath := filepath.Join(tConf.testLocalPath, fileName) + storagefilePath := filepath.Join(tConf.testStoragePath, fileName) + remoteFilePath := filepath.Join(tConf.testMntPath, fileName) + + // create the file in local directory + srcFile, err := os.OpenFile(localFilePath, os.O_CREATE, 0777) + suite.Equal(nil, err) + defer srcFile.Close() + + // write to file in the local directory + err = os.WriteFile(localFilePath, buffer, 0777) + suite.Equal(nil, err) + + suite.copyToMountDir(localFilePath, remoteFilePath) + + suite.validateData(localFilePath, storagefilePath) + suite.validateData(localFilePath, remoteFilePath) +} + +// -------------- Main Method ------------------- +func TestCustomComponentTestSuite(t *testing.T) { + initcustomComponentFlags() + tConf = testConf{} + + buffer = make([]byte, 9*int64(blockSizeMB)*MB+2*MB) + + // Generate random test dir name where our End to End test run is contained + testDirName := getcustomComponentTestDirName(10) + + // Create directory for testing the End to End test on mount path + tConf.testMntPath = filepath.Join(customComponentMntPathPtr, testDirName) + fmt.Println(tConf.testMntPath) + wd, err := os.Getwd() + if err != nil { + fmt.Println("Error getting current working directory: ", err) + } + tConf.testLocalPath = filepath.Join(wd, testDirName) + fmt.Println(tConf.testLocalPath) + + tConf.testStoragePath = filepath.Join(customComponentStoragePathPtr, testDirName) + rand.Read(buffer) + + err = os.Mkdir(tConf.testMntPath, 0777) + if err != nil { + fmt.Println("Error creating mount directory: ", err) + } + + err = os.Mkdir(tConf.testLocalPath, 0777) + if err != nil { + fmt.Println("Error creating local directory: ", err) + } + + // Run the actual End to End test + suite.Run(t, new(customComponentTestSuite)) + + // Cleanup the test directories + err = os.RemoveAll(filepath.Dir(tConf.testStoragePath)) + if err != nil { + fmt.Println("Error removing mount directory: ", err) + } + + err = os.RemoveAll(tConf.testLocalPath) + if err != nil { + fmt.Println("Error removing local directory: ", err) + } +} + +func init() { + regcustomComponentTestFlag(&customComponentMntPathPtr, "mnt-path", "/mnt/test", "Mount Path of Container") + regcustomComponentTestFlag(&customComponentTempPathPtr, "tmp-path", "/tmp/cache", "Cache dir path") + regcustomComponentTestFlag(&customComponentStoragePathPtr, "storage-path", "/mnt/storage", "Storage path") +} diff --git a/test/e2e_tests/data_validation_test.go b/test/e2e_tests/data_validation_test.go index f9109c58d..bff3c426c 100644 --- a/test/e2e_tests/data_validation_test.go +++ b/test/e2e_tests/data_validation_test.go @@ -169,17 +169,6 @@ func createFileHandleInLocalAndRemote(suite *dataValidationTestSuite, localFileP return lfh, rfh } -// Open File in Local and Mounted Directories and returns there file handles the associated fd has O_RDONLY Mode -func openFileHandleInLocalAndRemote(suite *dataValidationTestSuite, flags int, localFilePath, remoteFilePath string) (lfh *os.File, rfh *os.File) { - lfh, err := os.OpenFile(localFilePath, flags, 0666) - suite.Nil(err) - - rfh, err = os.OpenFile(remoteFilePath, flags, 0666) - suite.Nil(err) - - return lfh, rfh -} - // closes the file handles, This ensures that data is flushed to disk/Azure Storage from the cache func closeFileHandles(suite *dataValidationTestSuite, handles ...*os.File) { for _, h := range handles { @@ -226,28 +215,6 @@ func generateFileWithRandomData(suite *dataValidationTestSuite, filePath string, closeFileHandles(suite, fh) } -func compareReadOperInLocalAndRemote(suite *dataValidationTestSuite, lfh, rfh *os.File, offset int64) { - buffer1 := make([]byte, 4*int(_1MB)) - buffer2 := make([]byte, 4*int(_1MB)) - - bytes_read_local, err1 := lfh.ReadAt(buffer1, offset) - bytes_read_remote, err2 := rfh.ReadAt(buffer2, offset) - suite.Equal(err1, err2) - suite.Equal(bytes_read_local, bytes_read_remote) - suite.Equal(buffer1[:bytes_read_local], buffer2[:bytes_read_remote]) -} - -func compareWriteOperInLocalAndRemote(suite *dataValidationTestSuite, lfh, rfh *os.File, offset int64) { - sizeofbuffer := (rand.Int() % 4) + 1 - buffer := make([]byte, sizeofbuffer*int(_1MB)) - rand.Read(buffer) - - bytes_written_local, err1 := lfh.WriteAt(buffer, offset) - bytes_written_remote, err2 := rfh.WriteAt(buffer, offset) - suite.Equal(err1, err2) - suite.Equal(bytes_written_local, bytes_written_remote) -} - // -------------- Data Validation Tests ------------------- // Test correct overwrite of file using echo command @@ -752,52 +719,6 @@ func (suite *dataValidationTestSuite) TestPanicOnReadingFileInRandReadMode() { closeFileHandles(suite, rfh) } -func (suite *dataValidationTestSuite) TestReadDataAtBlockBoundaries() { - fileName := "testReadDataAtBlockBoundaries" - localFilePath, remoteFilePath := convertFileNameToFilePath(fileName) - fileSize := 35 * int(_1MB) - generateFileWithRandomData(suite, localFilePath, fileSize) - suite.copyToMountDir(localFilePath, remoteFilePath) - suite.validateData(localFilePath, remoteFilePath) - - lfh, rfh := openFileHandleInLocalAndRemote(suite, os.O_RDWR, localFilePath, remoteFilePath) - var offset int64 = 0 - //tests run in 16MB block size config. - //Data in File 35MB(3blocks) - //block1->16MB, block2->16MB, block3->3MB - - //getting 4MB data from 1st block - compareReadOperInLocalAndRemote(suite, lfh, rfh, offset) - //getting 4MB data from overlapping blocks - offset = int64(15 * int(_1MB)) - compareReadOperInLocalAndRemote(suite, lfh, rfh, offset) - //getting 4MB data from last block - offset = int64(32 * int(_1MB)) - compareReadOperInLocalAndRemote(suite, lfh, rfh, offset) - //getting 4MB data from overlapping block with last block - offset = int64(30 * int(_1MB)) - compareReadOperInLocalAndRemote(suite, lfh, rfh, offset) - //Read at some random offset - for i := 0; i < 10; i++ { - offset = rand.Int63() % int64(fileSize) - compareReadOperInLocalAndRemote(suite, lfh, rfh, offset) - } - - //write at end of file - offset = int64(fileSize) - compareWriteOperInLocalAndRemote(suite, lfh, rfh, offset) - //Check the previous write with read - compareReadOperInLocalAndRemote(suite, lfh, rfh, offset) - - //Write at Random offset in the file - offset = rand.Int63() % int64(fileSize) - compareWriteOperInLocalAndRemote(suite, lfh, rfh, offset) - //Check the previous write with read - compareReadOperInLocalAndRemote(suite, lfh, rfh, offset) - - closeFileHandles(suite, lfh, rfh) -} - // -------------- Main Method ------------------- func TestDataValidationTestSuite(t *testing.T) { initDataValidationFlags() diff --git a/test/sample_custom_component1/go.mod b/test/sample_custom_component1/go.mod new file mode 100644 index 000000000..52691189e --- /dev/null +++ b/test/sample_custom_component1/go.mod @@ -0,0 +1,34 @@ +module main + +go 1.22.0 + +toolchain go1.23.1 + +require github.com/Azure/azure-storage-fuse/v2 v2.0.0-20241105172709-e53af0f71d8c + +require ( + github.com/JeffreyRichter/enum v0.0.0-20180725232043-2567042f9cda // indirect + github.com/fsnotify/fsnotify v1.8.0 // indirect + github.com/golang/mock v1.6.0 // indirect + github.com/hashicorp/hcl v1.0.0 // indirect + github.com/inconshreveable/mousetrap v1.1.0 // indirect + github.com/magiconair/properties v1.8.7 // indirect + github.com/mitchellh/mapstructure v1.5.0 // indirect + github.com/pelletier/go-toml/v2 v2.2.3 // indirect + github.com/sagikazarmark/locafero v0.6.0 // indirect + github.com/sagikazarmark/slog-shim v0.1.0 // indirect + github.com/sourcegraph/conc v0.3.0 // indirect + github.com/spf13/afero v1.11.0 // indirect + github.com/spf13/cast v1.7.0 // indirect + github.com/spf13/cobra v1.8.1 // indirect + github.com/spf13/pflag v1.0.5 // indirect + github.com/spf13/viper v1.19.0 // indirect + github.com/subosito/gotenv v1.6.0 // indirect + go.uber.org/atomic v1.11.0 // indirect + go.uber.org/multierr v1.11.0 // indirect + golang.org/x/exp v0.0.0-20241009180824-f66d83c29e7c // indirect + golang.org/x/sys v0.26.0 // indirect + golang.org/x/text v0.19.0 // indirect + gopkg.in/ini.v1 v1.67.0 // indirect + gopkg.in/yaml.v3 v3.0.1 // indirect +) diff --git a/test/sample_custom_component1/go.sum b/test/sample_custom_component1/go.sum new file mode 100644 index 000000000..d6efa4b23 --- /dev/null +++ b/test/sample_custom_component1/go.sum @@ -0,0 +1,95 @@ +github.com/Azure/azure-storage-fuse/v2 v2.0.0-20241105172709-e53af0f71d8c h1:d5qLOkJjrE2yDjNO24I3OINQbzm01zN0pJ0XU+qP4ag= +github.com/Azure/azure-storage-fuse/v2 v2.0.0-20241105172709-e53af0f71d8c/go.mod h1:ZVUBjHdgiZLhcNAXSo8Fk0LPbhcIuQUroqC5PUratkI= +github.com/JeffreyRichter/enum v0.0.0-20180725232043-2567042f9cda h1:NOo6+gM9NNPJ3W56nxOKb4164LEw094U0C8zYQM8mQU= +github.com/JeffreyRichter/enum v0.0.0-20180725232043-2567042f9cda/go.mod h1:2CaSFTh2ph9ymS6goiOKIBdfhwWUVsX4nQ5QjIYFHHs= +github.com/cpuguy83/go-md2man/v2 v2.0.4/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= +github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHkI4W8= +github.com/frankban/quicktest v1.14.6/go.mod h1:4ptaffx2x8+WTWXmUCuVU6aPUX1/Mz7zb5vbUoiM6w0= +github.com/fsnotify/fsnotify v1.8.0 h1:dAwr6QBTBZIkG8roQaJjGof0pp0EeF+tNV7YBP3F/8M= +github.com/fsnotify/fsnotify v1.8.0/go.mod h1:8jBTzvmWwFyi3Pb8djgCCO5IBqzKJ/Jwo8TRcHyHii0= +github.com/golang/mock v1.6.0 h1:ErTB+efbowRARo13NNdxyJji2egdxLGQhRaY+DUumQc= +github.com/golang/mock v1.6.0/go.mod h1:p6yTPP+5HYm5mzsMV8JkE6ZKdX+/wYM6Hr+LicevLPs= +github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= +github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4= +github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= +github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= +github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= +github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= +github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= +github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= +github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= +github.com/magiconair/properties v1.8.7 h1:IeQXZAiQcpL9mgcAe1Nu6cX9LLw6ExEHKjN0VQdvPDY= +github.com/magiconair/properties v1.8.7/go.mod h1:Dhd985XPs7jluiymwWYZ0G4Z61jb3vdS329zhj2hYo0= +github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY= +github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= +github.com/pelletier/go-toml/v2 v2.2.3 h1:YmeHyLY8mFWbdkNWwpr+qIL2bEqT0o95WSdkNHvL12M= +github.com/pelletier/go-toml/v2 v2.2.3/go.mod h1:MfCQTFTvCcUyyvvwm1+G6H/jORL20Xlb6rzQu9GuUkc= +github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= +github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/rogpeppe/go-internal v1.9.0 h1:73kH8U+JUqXU8lRuOHeVHaa/SZPifC7BkcraZVejAe8= +github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= +github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= +github.com/sagikazarmark/locafero v0.6.0 h1:ON7AQg37yzcRPU69mt7gwhFEBwxI6P9T4Qu3N51bwOk= +github.com/sagikazarmark/locafero v0.6.0/go.mod h1:77OmuIc6VTraTXKXIs/uvUxKGUXjE1GbemJYHqdNjX0= +github.com/sagikazarmark/slog-shim v0.1.0 h1:diDBnUNK9N/354PgrxMywXnAwEr1QZcOr6gto+ugjYE= +github.com/sagikazarmark/slog-shim v0.1.0/go.mod h1:SrcSrq8aKtyuqEI1uvTDTK1arOWRIczQRv+GVI1AkeQ= +github.com/sourcegraph/conc v0.3.0 h1:OQTbbt6P72L20UqAkXXuLOj79LfEanQ+YQFNpLA9ySo= +github.com/sourcegraph/conc v0.3.0/go.mod h1:Sdozi7LEKbFPqYX2/J+iBAM6HpqSLTASQIKqDmF7Mt0= +github.com/spf13/afero v1.11.0 h1:WJQKhtpdm3v2IzqG8VMqrr6Rf3UYpEF239Jy9wNepM8= +github.com/spf13/afero v1.11.0/go.mod h1:GH9Y3pIexgf1MTIWtNGyogA5MwRIDXGUr+hbWNoBjkY= +github.com/spf13/cast v1.7.0 h1:ntdiHjuueXFgm5nzDRdOS4yfT43P5Fnud6DH50rz/7w= +github.com/spf13/cast v1.7.0/go.mod h1:ancEpBxwJDODSW/UG4rDrAqiKolqNNh2DX3mk86cAdo= +github.com/spf13/cobra v1.8.1 h1:e5/vxKd/rZsfSJMUX1agtjeTDf+qv1/JdBF8gg5k9ZM= +github.com/spf13/cobra v1.8.1/go.mod h1:wHxEcudfqmLYa8iTfL+OuZPbBZkmvliBWKIezN3kD9Y= +github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= +github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= +github.com/spf13/viper v1.19.0 h1:RWq5SEjt8o25SROyN3z2OrDB9l7RPd3lwTWU8EcEdcI= +github.com/spf13/viper v1.19.0/go.mod h1:GQUN9bilAbhU/jgc1bKs99f/suXKeUMct8Adx5+Ntkg= +github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= +github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= +github.com/subosito/gotenv v1.6.0 h1:9NlTDc1FTs4qu0DDq7AEtTPNw6SVm7uBMsUCUjABIf8= +github.com/subosito/gotenv v1.6.0/go.mod h1:Dk4QP5c2W3ibzajGcXpNraDfq2IrhjMIvMSWPKKo0FU= +github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= +go.uber.org/atomic v1.11.0 h1:ZvwS0R+56ePWxUNi+Atn9dWONBPp/AUETXlHW0DxSjE= +go.uber.org/atomic v1.11.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0= +go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= +go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/exp v0.0.0-20241009180824-f66d83c29e7c h1:7dEasQXItcW1xKJ2+gg5VOiBnqWrJc+rq0DPKyvvdbY= +golang.org/x/exp v0.0.0-20241009180824-f66d83c29e7c/go.mod h1:NQtJDoLvd6faHhE7m4T/1IY708gDefGGjR/iUW8yQQ8= +golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= +golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.26.0 h1:KHjCJyddX0LoSTb3J+vWpupP9p0oznkqVk/IfjymZbo= +golang.org/x/sys v0.26.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.19.0 h1:kTxAhCbGbxhK0IwgSKiMO5awPoDQ0RpfiVYBfK860YM= +golang.org/x/text v0.19.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= +golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo= +gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/ini.v1 v1.67.0 h1:Dgnx+6+nfE+IfzjUEISNeydPJh9AXNNsWbGP9KzCsOA= +gopkg.in/ini.v1 v1.67.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/test/sample_custom_component1/main.go b/test/sample_custom_component1/main.go new file mode 100644 index 000000000..335eb7812 --- /dev/null +++ b/test/sample_custom_component1/main.go @@ -0,0 +1,177 @@ +/* + _____ _____ _____ ____ ______ _____ ------ + | | | | | | | | | | | | | + | | | | | | | | | | | | | + | --- | | | | |-----| |---- | | |-----| |----- ------ + | | | | | | | | | | | | | + | ____| |_____ | ____| | ____| | |_____| _____| |_____ |_____ + + + Licensed under the MIT License . + + Copyright © 2020-2024 Microsoft Corporation. All rights reserved. + Author : + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all + copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + SOFTWARE +*/ + +package main + +import ( + "fmt" + "os" + "syscall" + + "github.com/Azure/azure-storage-fuse/v2/common/config" + "github.com/Azure/azure-storage-fuse/v2/common/log" + "github.com/Azure/azure-storage-fuse/v2/exported" +) + +// SAMPLE CUSTOM COMPONENT IMPLEMENTATION +// To build this component run the following command: +// "go build -buildmode=plugin -o sample_custom_component1.so" +// This is a sample custom component implementation that can be used as a reference to implement custom components. +// The custom component should implement the exported.Component interface. +const ( + CompName = "sample_custom_component1" + Mb = 1024 * 1024 +) + +var _ exported.Component = &sample_custom_component1{} + +func (e *sample_custom_component1) SetName(name string) { + e.BaseComponent.SetName(name) +} + +func (e *sample_custom_component1) SetNextComponent(nc exported.Component) { + e.BaseComponent.SetNextComponent(nc) +} + +func GetExternalComponent() (string, func() exported.Component) { + return CompName, NewexternalComponent +} + +func NewexternalComponent() exported.Component { + comp := &sample_custom_component1{} + comp.SetName(CompName) + return comp +} + +type sample_custom_component1 struct { + blockSize int64 + exported.BaseComponent +} + +type sample_custom_component1Options struct { + BlockSize int64 `config:"block-size-mb" yaml:"block-size-mb,omitempty"` +} + +func (e *sample_custom_component1) Configure(isParent bool) error { + log.Trace("sample_custom_component1::Configure") + conf := sample_custom_component1Options{} + err := config.UnmarshalKey(e.Name(), &conf) + if err != nil { + log.Err("sample_custom_component1::Configure : config error [invalid config attributes]") + return fmt.Errorf("error reading config for %s: %w", e.Name(), err) + } + if config.IsSet(e.Name()+".block-size-mb") && conf.BlockSize > 0 { + e.blockSize = conf.BlockSize * int64(Mb) + } + return nil +} + +func (e *sample_custom_component1) CreateFile(opt exported.CreateFileOptions) (*exported.Handle, error) { + log.Trace("sample_custom_component1::CreateFile : %s", opt.Name) + handle, err := e.NextComponent().CreateFile(opt) + if err != nil { + log.Err("sample_custom_component1::CreateFile failed: %v", err) + return nil, err + } + return handle, nil +} + +func (e *sample_custom_component1) CreateDir(opt exported.CreateDirOptions) error { + log.Trace("sample_custom_component1::CreateDir : %s", opt.Name) + err := e.NextComponent().CreateDir(opt) + if err != nil { + log.Err("sample_custom_component1::CreateDir failed: %v", err) + return err + } + return nil +} + +func (e *sample_custom_component1) StreamDir(options exported.StreamDirOptions) ([]*exported.ObjAttr, string, error) { + log.Trace("sample_custom_component1::StreamDir : %s", options.Name) + + attr, token, err := e.NextComponent().StreamDir(options) + if err != nil { + log.Err("sample_custom_component1::StreamDir failed: %v", err) + return nil, "", err + } + return attr, token, nil +} +func (e *sample_custom_component1) IsDirEmpty(options exported.IsDirEmptyOptions) bool { + log.Trace("test2::IsDirEmpty : %s", options.Name) + empty := e.NextComponent().IsDirEmpty(options) + return empty +} + +func (e *sample_custom_component1) DeleteDir(opt exported.DeleteDirOptions) error { + log.Trace("sample_custom_component1::DeleteDir : %s", opt.Name) + err := e.NextComponent().DeleteDir(opt) + if err != nil { + log.Err("sample_custom_component1::DeleteDir failed: %v", err) + return err + } + return nil +} + +func (e *sample_custom_component1) StageData(opt exported.StageDataOptions) error { + log.Trace("sample_custom_component1::StageData : %s", opt.Name) + err := e.NextComponent().StageData(opt) + if err != nil { + log.Err("sample_custom_component1 StageData failed: %v", err) + return err + } + return nil +} + +func (e *sample_custom_component1) ReadInBuffer(opt exported.ReadInBufferOptions) (length int, err error) { + log.Trace("sample_custom_component1::ReadInBuffer : %s", opt.Handle.Path) + n, err := e.NextComponent().ReadInBuffer(opt) + if err != nil { + log.Err("sample_custom_component1 ReadInBuffer failed: %v", err) + return 0, err + } + return n, nil +} + +func (e *sample_custom_component1) GetAttr(options exported.GetAttrOptions) (attr *exported.ObjAttr, err error) { + log.Trace("sample_custom_component1::GetAttr : %s", options.Name) + attr, err = e.NextComponent().GetAttr(options) + if err != nil { + if os.IsNotExist(err) { + log.Trace("sample_custom_component1::GetAttr : File not found: %s", options.Name) + return nil, syscall.ENOENT + } + log.Err("sample_custom_component1 GetAttr failed: %v", err) + return nil, err + } + return attr, nil +} diff --git a/test/sample_custom_component2/go.mod b/test/sample_custom_component2/go.mod new file mode 100644 index 000000000..52691189e --- /dev/null +++ b/test/sample_custom_component2/go.mod @@ -0,0 +1,34 @@ +module main + +go 1.22.0 + +toolchain go1.23.1 + +require github.com/Azure/azure-storage-fuse/v2 v2.0.0-20241105172709-e53af0f71d8c + +require ( + github.com/JeffreyRichter/enum v0.0.0-20180725232043-2567042f9cda // indirect + github.com/fsnotify/fsnotify v1.8.0 // indirect + github.com/golang/mock v1.6.0 // indirect + github.com/hashicorp/hcl v1.0.0 // indirect + github.com/inconshreveable/mousetrap v1.1.0 // indirect + github.com/magiconair/properties v1.8.7 // indirect + github.com/mitchellh/mapstructure v1.5.0 // indirect + github.com/pelletier/go-toml/v2 v2.2.3 // indirect + github.com/sagikazarmark/locafero v0.6.0 // indirect + github.com/sagikazarmark/slog-shim v0.1.0 // indirect + github.com/sourcegraph/conc v0.3.0 // indirect + github.com/spf13/afero v1.11.0 // indirect + github.com/spf13/cast v1.7.0 // indirect + github.com/spf13/cobra v1.8.1 // indirect + github.com/spf13/pflag v1.0.5 // indirect + github.com/spf13/viper v1.19.0 // indirect + github.com/subosito/gotenv v1.6.0 // indirect + go.uber.org/atomic v1.11.0 // indirect + go.uber.org/multierr v1.11.0 // indirect + golang.org/x/exp v0.0.0-20241009180824-f66d83c29e7c // indirect + golang.org/x/sys v0.26.0 // indirect + golang.org/x/text v0.19.0 // indirect + gopkg.in/ini.v1 v1.67.0 // indirect + gopkg.in/yaml.v3 v3.0.1 // indirect +) diff --git a/test/sample_custom_component2/go.sum b/test/sample_custom_component2/go.sum new file mode 100644 index 000000000..d6efa4b23 --- /dev/null +++ b/test/sample_custom_component2/go.sum @@ -0,0 +1,95 @@ +github.com/Azure/azure-storage-fuse/v2 v2.0.0-20241105172709-e53af0f71d8c h1:d5qLOkJjrE2yDjNO24I3OINQbzm01zN0pJ0XU+qP4ag= +github.com/Azure/azure-storage-fuse/v2 v2.0.0-20241105172709-e53af0f71d8c/go.mod h1:ZVUBjHdgiZLhcNAXSo8Fk0LPbhcIuQUroqC5PUratkI= +github.com/JeffreyRichter/enum v0.0.0-20180725232043-2567042f9cda h1:NOo6+gM9NNPJ3W56nxOKb4164LEw094U0C8zYQM8mQU= +github.com/JeffreyRichter/enum v0.0.0-20180725232043-2567042f9cda/go.mod h1:2CaSFTh2ph9ymS6goiOKIBdfhwWUVsX4nQ5QjIYFHHs= +github.com/cpuguy83/go-md2man/v2 v2.0.4/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= +github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHkI4W8= +github.com/frankban/quicktest v1.14.6/go.mod h1:4ptaffx2x8+WTWXmUCuVU6aPUX1/Mz7zb5vbUoiM6w0= +github.com/fsnotify/fsnotify v1.8.0 h1:dAwr6QBTBZIkG8roQaJjGof0pp0EeF+tNV7YBP3F/8M= +github.com/fsnotify/fsnotify v1.8.0/go.mod h1:8jBTzvmWwFyi3Pb8djgCCO5IBqzKJ/Jwo8TRcHyHii0= +github.com/golang/mock v1.6.0 h1:ErTB+efbowRARo13NNdxyJji2egdxLGQhRaY+DUumQc= +github.com/golang/mock v1.6.0/go.mod h1:p6yTPP+5HYm5mzsMV8JkE6ZKdX+/wYM6Hr+LicevLPs= +github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= +github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4= +github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= +github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= +github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= +github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= +github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= +github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= +github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= +github.com/magiconair/properties v1.8.7 h1:IeQXZAiQcpL9mgcAe1Nu6cX9LLw6ExEHKjN0VQdvPDY= +github.com/magiconair/properties v1.8.7/go.mod h1:Dhd985XPs7jluiymwWYZ0G4Z61jb3vdS329zhj2hYo0= +github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY= +github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= +github.com/pelletier/go-toml/v2 v2.2.3 h1:YmeHyLY8mFWbdkNWwpr+qIL2bEqT0o95WSdkNHvL12M= +github.com/pelletier/go-toml/v2 v2.2.3/go.mod h1:MfCQTFTvCcUyyvvwm1+G6H/jORL20Xlb6rzQu9GuUkc= +github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= +github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/rogpeppe/go-internal v1.9.0 h1:73kH8U+JUqXU8lRuOHeVHaa/SZPifC7BkcraZVejAe8= +github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= +github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= +github.com/sagikazarmark/locafero v0.6.0 h1:ON7AQg37yzcRPU69mt7gwhFEBwxI6P9T4Qu3N51bwOk= +github.com/sagikazarmark/locafero v0.6.0/go.mod h1:77OmuIc6VTraTXKXIs/uvUxKGUXjE1GbemJYHqdNjX0= +github.com/sagikazarmark/slog-shim v0.1.0 h1:diDBnUNK9N/354PgrxMywXnAwEr1QZcOr6gto+ugjYE= +github.com/sagikazarmark/slog-shim v0.1.0/go.mod h1:SrcSrq8aKtyuqEI1uvTDTK1arOWRIczQRv+GVI1AkeQ= +github.com/sourcegraph/conc v0.3.0 h1:OQTbbt6P72L20UqAkXXuLOj79LfEanQ+YQFNpLA9ySo= +github.com/sourcegraph/conc v0.3.0/go.mod h1:Sdozi7LEKbFPqYX2/J+iBAM6HpqSLTASQIKqDmF7Mt0= +github.com/spf13/afero v1.11.0 h1:WJQKhtpdm3v2IzqG8VMqrr6Rf3UYpEF239Jy9wNepM8= +github.com/spf13/afero v1.11.0/go.mod h1:GH9Y3pIexgf1MTIWtNGyogA5MwRIDXGUr+hbWNoBjkY= +github.com/spf13/cast v1.7.0 h1:ntdiHjuueXFgm5nzDRdOS4yfT43P5Fnud6DH50rz/7w= +github.com/spf13/cast v1.7.0/go.mod h1:ancEpBxwJDODSW/UG4rDrAqiKolqNNh2DX3mk86cAdo= +github.com/spf13/cobra v1.8.1 h1:e5/vxKd/rZsfSJMUX1agtjeTDf+qv1/JdBF8gg5k9ZM= +github.com/spf13/cobra v1.8.1/go.mod h1:wHxEcudfqmLYa8iTfL+OuZPbBZkmvliBWKIezN3kD9Y= +github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= +github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= +github.com/spf13/viper v1.19.0 h1:RWq5SEjt8o25SROyN3z2OrDB9l7RPd3lwTWU8EcEdcI= +github.com/spf13/viper v1.19.0/go.mod h1:GQUN9bilAbhU/jgc1bKs99f/suXKeUMct8Adx5+Ntkg= +github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= +github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= +github.com/subosito/gotenv v1.6.0 h1:9NlTDc1FTs4qu0DDq7AEtTPNw6SVm7uBMsUCUjABIf8= +github.com/subosito/gotenv v1.6.0/go.mod h1:Dk4QP5c2W3ibzajGcXpNraDfq2IrhjMIvMSWPKKo0FU= +github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= +go.uber.org/atomic v1.11.0 h1:ZvwS0R+56ePWxUNi+Atn9dWONBPp/AUETXlHW0DxSjE= +go.uber.org/atomic v1.11.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0= +go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= +go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/exp v0.0.0-20241009180824-f66d83c29e7c h1:7dEasQXItcW1xKJ2+gg5VOiBnqWrJc+rq0DPKyvvdbY= +golang.org/x/exp v0.0.0-20241009180824-f66d83c29e7c/go.mod h1:NQtJDoLvd6faHhE7m4T/1IY708gDefGGjR/iUW8yQQ8= +golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= +golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.26.0 h1:KHjCJyddX0LoSTb3J+vWpupP9p0oznkqVk/IfjymZbo= +golang.org/x/sys v0.26.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.19.0 h1:kTxAhCbGbxhK0IwgSKiMO5awPoDQ0RpfiVYBfK860YM= +golang.org/x/text v0.19.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= +golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo= +gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/ini.v1 v1.67.0 h1:Dgnx+6+nfE+IfzjUEISNeydPJh9AXNNsWbGP9KzCsOA= +gopkg.in/ini.v1 v1.67.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/test/sample_custom_component2/main.go b/test/sample_custom_component2/main.go new file mode 100644 index 000000000..4e4bf1268 --- /dev/null +++ b/test/sample_custom_component2/main.go @@ -0,0 +1,256 @@ +/* + _____ _____ _____ ____ ______ _____ ------ + | | | | | | | | | | | | | + | | | | | | | | | | | | | + | --- | | | | |-----| |---- | | |-----| |----- ------ + | | | | | | | | | | | | | + | ____| |_____ | ____| | ____| | |_____| _____| |_____ |_____ + + + Licensed under the MIT License . + + Copyright © 2020-2024 Microsoft Corporation. All rights reserved. + Author : + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all + copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + SOFTWARE +*/ + +package main + +import ( + "fmt" + "os" + "path/filepath" + "syscall" + "time" + + "github.com/Azure/azure-storage-fuse/v2/common/config" + "github.com/Azure/azure-storage-fuse/v2/common/log" + "github.com/Azure/azure-storage-fuse/v2/exported" +) + +// SAMPLE CUSTOM COMPONENT IMPLEMENTATION +// To build this component run the following command: +// "go build -buildmode=plugin -o sample_custom_component2.so" +// This is a sample custom component implementation that can be used as a reference to implement custom components. +// The custom component should implement the exported.Component interface. +const ( + CompName = "sample_custom_component2" + Mb = 1024 * 1024 +) + +var _ exported.Component = &sample_custom_component2{} + +func (e *sample_custom_component2) SetName(name string) { + e.BaseComponent.SetName(name) +} + +func (e *sample_custom_component2) SetNextComponent(nc exported.Component) { + e.BaseComponent.SetNextComponent(nc) +} + +func GetExternalComponent() (string, func() exported.Component) { + return CompName, NewexternalComponent +} + +func NewexternalComponent() exported.Component { + comp := &sample_custom_component2{} + comp.SetName(CompName) + return comp +} + +type sample_custom_component2 struct { + blockSize int64 + externalPath string + exported.BaseComponent +} + +type sample_custom_component2Options struct { + BlockSize int64 `config:"block-size-mb" yaml:"block-size-mb,omitempty"` +} + +func (e *sample_custom_component2) Configure(isParent bool) error { + log.Info("sample_custom_component2:: Configure") + externalPath := os.Getenv("EXTERNAL_PATH") + if externalPath == "" { + log.Err("EXTERNAL_PATH not set") + return fmt.Errorf("EXTERNAL_PATH not set") + } + e.externalPath = externalPath + conf := sample_custom_component2Options{} + err := config.UnmarshalKey(e.Name(), &conf) + if err != nil { + log.Err("sample_custom_component2::Configure : config error [invalid config attributes]") + return fmt.Errorf("error reading config for %s: %w", e.Name(), err) + } + if config.IsSet(e.Name()+".block-size-mb") && conf.BlockSize > 0 { + e.blockSize = conf.BlockSize * int64(Mb) + } + return nil +} + +func (e *sample_custom_component2) CreateFile(options exported.CreateFileOptions) (*exported.Handle, error) { + log.Info("sample_custom_component2::CreateFile") + filePath := filepath.Join(e.externalPath, options.Name) + fileHandle, err := os.OpenFile(filePath, os.O_CREATE, 0777) + if err != nil { + log.Err("Failed to create file %s", filePath) + return nil, err + } + defer fileHandle.Close() + handle := &exported.Handle{ + Path: options.Name, + } + return handle, nil +} + +func (e *sample_custom_component2) CreateDir(options exported.CreateDirOptions) error { + log.Info("sample_custom_component2::CreateDir") + dirPath := filepath.Join(e.externalPath, options.Name) + err := os.MkdirAll(dirPath, 0777) + if err != nil { + log.Err("Failed to create directory %s", dirPath) + return err + } + return nil +} + +func (e *sample_custom_component2) StreamDir(options exported.StreamDirOptions) ([]*exported.ObjAttr, string, error) { + log.Info("sample_custom_component2::StreamDir") + var objAttrs []*exported.ObjAttr + path := formatListDirName(options.Name) + files, err := os.ReadDir(filepath.Join(e.externalPath, path)) + if err != nil { + log.Trace("test1::StreamDir : Error reading directory %s : %s", path, err.Error()) + return nil, "", err + } + + for _, file := range files { + attr, err := e.GetAttr(exported.GetAttrOptions{Name: path + file.Name()}) + if err != nil { + if err != syscall.ENOENT { + log.Trace("test1::StreamDir : Error getting file attributes: %s", err.Error()) + return objAttrs, "", err + } + log.Trace("test1::StreamDir : File not found: %s", file.Name()) + continue + } + + objAttrs = append(objAttrs, attr) + } + + return objAttrs, "", nil +} +func (e *sample_custom_component2) IsDirEmpty(options exported.IsDirEmptyOptions) bool { + log.Info("sample_custom_component2::IsDirEmpty") + files, err := os.ReadDir(filepath.Join(e.externalPath, options.Name)) + if err != nil { + log.Err("Failed to read directory %s", options.Name) + return false + } + return len(files) == 0 +} + +func (e *sample_custom_component2) DeleteDir(options exported.DeleteDirOptions) error { + log.Info("sample_custom_component2::DeleteDir") + dirPath := filepath.Join(e.externalPath, options.Name) + err := os.RemoveAll(dirPath) + if err != nil { + log.Err("Failed to delete directory %s", dirPath) + return err + } + return nil +} + +func (e *sample_custom_component2) StageData(opt exported.StageDataOptions) error { + log.Info("sample_custom_component2:: StageData") + filePath := filepath.Join(e.externalPath, opt.Name) + fileHandle, err := os.OpenFile(filePath, os.O_CREATE|os.O_WRONLY, 0777) + if err != nil { + log.Err("Failed to open file %s", filePath) + return err + } + defer fileHandle.Close() + + fileOffset := int64(opt.Offset) + + _, err = fileHandle.WriteAt(opt.Data, fileOffset) + + if err != nil { + log.Err("Failed to write to file %s at offset %d", filePath, fileOffset) + return err + } + + return nil +} + +func (e *sample_custom_component2) ReadInBuffer(opt exported.ReadInBufferOptions) (length int, err error) { + log.Info("sample_custom_component2:: ReadInBuffer") + + filePath := filepath.Join(e.externalPath, opt.Handle.Path) + fileHandle, err := os.OpenFile(filePath, os.O_RDONLY, 0777) + if err != nil { + log.Err("Failed to open file %s", filePath) + return 0, err + } + defer fileHandle.Close() + + n, err := fileHandle.ReadAt(opt.Data, opt.Offset) + if err != nil { + log.Err("Failed to read from file %s at offset %d", filePath, opt.Offset) + return 0, err + } + return n, nil +} + +func (e *sample_custom_component2) GetAttr(options exported.GetAttrOptions) (attr *exported.ObjAttr, err error) { + log.Info("sample_custom_component2::GetAttr for %s", options.Name) + fileAttr, err := os.Stat(filepath.Join(e.externalPath, options.Name)) + if err != nil { + log.Trace("sample_custom_component2::GetAttr : Error getting file attributes: %s", err.Error()) + return &exported.ObjAttr{}, err + } + + // Populate the ObjAttr struct with the file info. + attr = &exported.ObjAttr{ + Mtime: fileAttr.ModTime(), // Modified time + Atime: time.Now(), // Access time (current time as approximation) + Ctime: fileAttr.ModTime(), // Change time (same as modified time in this case) + Crtime: fileAttr.ModTime(), // Creation time (not available in Go, using modified time) + Mode: fileAttr.Mode(), // Permissions + Path: options.Name, // File path + Name: fileAttr.Name(), // Base name of the path + Size: fileAttr.Size(), // File size + } + if fileAttr.IsDir() { + attr.Flags.Set(exported.PropFlagIsDir) + } + return attr, nil +} + +func formatListDirName(path string) string { + // If we check the root directory, make sure we pass "" instead of "/" + // If we aren't checking the root directory, then we want to extend the directory name so List returns all children and does not include the path itself. + if path == "/" { + path = "" + } else if path != "" { + path = exported.ExtendDirName(path) + } + return path +} From 6bf1f3b1933cea0ea21f1082c6a7a07d0ed409fe Mon Sep 17 00:00:00 2001 From: abhiguptacse Date: Wed, 6 Nov 2024 07:22:18 +0000 Subject: [PATCH 2/4] update --- test/e2e_tests/data_validation_test.go | 79 ++++++++++++++++++++++++++ 1 file changed, 79 insertions(+) diff --git a/test/e2e_tests/data_validation_test.go b/test/e2e_tests/data_validation_test.go index bff3c426c..f9109c58d 100644 --- a/test/e2e_tests/data_validation_test.go +++ b/test/e2e_tests/data_validation_test.go @@ -169,6 +169,17 @@ func createFileHandleInLocalAndRemote(suite *dataValidationTestSuite, localFileP return lfh, rfh } +// Open File in Local and Mounted Directories and returns there file handles the associated fd has O_RDONLY Mode +func openFileHandleInLocalAndRemote(suite *dataValidationTestSuite, flags int, localFilePath, remoteFilePath string) (lfh *os.File, rfh *os.File) { + lfh, err := os.OpenFile(localFilePath, flags, 0666) + suite.Nil(err) + + rfh, err = os.OpenFile(remoteFilePath, flags, 0666) + suite.Nil(err) + + return lfh, rfh +} + // closes the file handles, This ensures that data is flushed to disk/Azure Storage from the cache func closeFileHandles(suite *dataValidationTestSuite, handles ...*os.File) { for _, h := range handles { @@ -215,6 +226,28 @@ func generateFileWithRandomData(suite *dataValidationTestSuite, filePath string, closeFileHandles(suite, fh) } +func compareReadOperInLocalAndRemote(suite *dataValidationTestSuite, lfh, rfh *os.File, offset int64) { + buffer1 := make([]byte, 4*int(_1MB)) + buffer2 := make([]byte, 4*int(_1MB)) + + bytes_read_local, err1 := lfh.ReadAt(buffer1, offset) + bytes_read_remote, err2 := rfh.ReadAt(buffer2, offset) + suite.Equal(err1, err2) + suite.Equal(bytes_read_local, bytes_read_remote) + suite.Equal(buffer1[:bytes_read_local], buffer2[:bytes_read_remote]) +} + +func compareWriteOperInLocalAndRemote(suite *dataValidationTestSuite, lfh, rfh *os.File, offset int64) { + sizeofbuffer := (rand.Int() % 4) + 1 + buffer := make([]byte, sizeofbuffer*int(_1MB)) + rand.Read(buffer) + + bytes_written_local, err1 := lfh.WriteAt(buffer, offset) + bytes_written_remote, err2 := rfh.WriteAt(buffer, offset) + suite.Equal(err1, err2) + suite.Equal(bytes_written_local, bytes_written_remote) +} + // -------------- Data Validation Tests ------------------- // Test correct overwrite of file using echo command @@ -719,6 +752,52 @@ func (suite *dataValidationTestSuite) TestPanicOnReadingFileInRandReadMode() { closeFileHandles(suite, rfh) } +func (suite *dataValidationTestSuite) TestReadDataAtBlockBoundaries() { + fileName := "testReadDataAtBlockBoundaries" + localFilePath, remoteFilePath := convertFileNameToFilePath(fileName) + fileSize := 35 * int(_1MB) + generateFileWithRandomData(suite, localFilePath, fileSize) + suite.copyToMountDir(localFilePath, remoteFilePath) + suite.validateData(localFilePath, remoteFilePath) + + lfh, rfh := openFileHandleInLocalAndRemote(suite, os.O_RDWR, localFilePath, remoteFilePath) + var offset int64 = 0 + //tests run in 16MB block size config. + //Data in File 35MB(3blocks) + //block1->16MB, block2->16MB, block3->3MB + + //getting 4MB data from 1st block + compareReadOperInLocalAndRemote(suite, lfh, rfh, offset) + //getting 4MB data from overlapping blocks + offset = int64(15 * int(_1MB)) + compareReadOperInLocalAndRemote(suite, lfh, rfh, offset) + //getting 4MB data from last block + offset = int64(32 * int(_1MB)) + compareReadOperInLocalAndRemote(suite, lfh, rfh, offset) + //getting 4MB data from overlapping block with last block + offset = int64(30 * int(_1MB)) + compareReadOperInLocalAndRemote(suite, lfh, rfh, offset) + //Read at some random offset + for i := 0; i < 10; i++ { + offset = rand.Int63() % int64(fileSize) + compareReadOperInLocalAndRemote(suite, lfh, rfh, offset) + } + + //write at end of file + offset = int64(fileSize) + compareWriteOperInLocalAndRemote(suite, lfh, rfh, offset) + //Check the previous write with read + compareReadOperInLocalAndRemote(suite, lfh, rfh, offset) + + //Write at Random offset in the file + offset = rand.Int63() % int64(fileSize) + compareWriteOperInLocalAndRemote(suite, lfh, rfh, offset) + //Check the previous write with read + compareReadOperInLocalAndRemote(suite, lfh, rfh, offset) + + closeFileHandles(suite, lfh, rfh) +} + // -------------- Main Method ------------------- func TestDataValidationTestSuite(t *testing.T) { initDataValidationFlags() From 68fe5c4fcab5c7dc0766a9da3ef574668c0064fc Mon Sep 17 00:00:00 2001 From: abhiguptacse Date: Tue, 19 Nov 2024 06:35:09 +0000 Subject: [PATCH 3/4] removing go.mod from sample --- test/sample_custom_component1/go.mod | 34 ---------- test/sample_custom_component1/go.sum | 95 ---------------------------- test/sample_custom_component2/go.mod | 34 ---------- test/sample_custom_component2/go.sum | 95 ---------------------------- 4 files changed, 258 deletions(-) delete mode 100644 test/sample_custom_component1/go.mod delete mode 100644 test/sample_custom_component1/go.sum delete mode 100644 test/sample_custom_component2/go.mod delete mode 100644 test/sample_custom_component2/go.sum diff --git a/test/sample_custom_component1/go.mod b/test/sample_custom_component1/go.mod deleted file mode 100644 index 52691189e..000000000 --- a/test/sample_custom_component1/go.mod +++ /dev/null @@ -1,34 +0,0 @@ -module main - -go 1.22.0 - -toolchain go1.23.1 - -require github.com/Azure/azure-storage-fuse/v2 v2.0.0-20241105172709-e53af0f71d8c - -require ( - github.com/JeffreyRichter/enum v0.0.0-20180725232043-2567042f9cda // indirect - github.com/fsnotify/fsnotify v1.8.0 // indirect - github.com/golang/mock v1.6.0 // indirect - github.com/hashicorp/hcl v1.0.0 // indirect - github.com/inconshreveable/mousetrap v1.1.0 // indirect - github.com/magiconair/properties v1.8.7 // indirect - github.com/mitchellh/mapstructure v1.5.0 // indirect - github.com/pelletier/go-toml/v2 v2.2.3 // indirect - github.com/sagikazarmark/locafero v0.6.0 // indirect - github.com/sagikazarmark/slog-shim v0.1.0 // indirect - github.com/sourcegraph/conc v0.3.0 // indirect - github.com/spf13/afero v1.11.0 // indirect - github.com/spf13/cast v1.7.0 // indirect - github.com/spf13/cobra v1.8.1 // indirect - github.com/spf13/pflag v1.0.5 // indirect - github.com/spf13/viper v1.19.0 // indirect - github.com/subosito/gotenv v1.6.0 // indirect - go.uber.org/atomic v1.11.0 // indirect - go.uber.org/multierr v1.11.0 // indirect - golang.org/x/exp v0.0.0-20241009180824-f66d83c29e7c // indirect - golang.org/x/sys v0.26.0 // indirect - golang.org/x/text v0.19.0 // indirect - gopkg.in/ini.v1 v1.67.0 // indirect - gopkg.in/yaml.v3 v3.0.1 // indirect -) diff --git a/test/sample_custom_component1/go.sum b/test/sample_custom_component1/go.sum deleted file mode 100644 index d6efa4b23..000000000 --- a/test/sample_custom_component1/go.sum +++ /dev/null @@ -1,95 +0,0 @@ -github.com/Azure/azure-storage-fuse/v2 v2.0.0-20241105172709-e53af0f71d8c h1:d5qLOkJjrE2yDjNO24I3OINQbzm01zN0pJ0XU+qP4ag= -github.com/Azure/azure-storage-fuse/v2 v2.0.0-20241105172709-e53af0f71d8c/go.mod h1:ZVUBjHdgiZLhcNAXSo8Fk0LPbhcIuQUroqC5PUratkI= -github.com/JeffreyRichter/enum v0.0.0-20180725232043-2567042f9cda h1:NOo6+gM9NNPJ3W56nxOKb4164LEw094U0C8zYQM8mQU= -github.com/JeffreyRichter/enum v0.0.0-20180725232043-2567042f9cda/go.mod h1:2CaSFTh2ph9ymS6goiOKIBdfhwWUVsX4nQ5QjIYFHHs= -github.com/cpuguy83/go-md2man/v2 v2.0.4/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= -github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHkI4W8= -github.com/frankban/quicktest v1.14.6/go.mod h1:4ptaffx2x8+WTWXmUCuVU6aPUX1/Mz7zb5vbUoiM6w0= -github.com/fsnotify/fsnotify v1.8.0 h1:dAwr6QBTBZIkG8roQaJjGof0pp0EeF+tNV7YBP3F/8M= -github.com/fsnotify/fsnotify v1.8.0/go.mod h1:8jBTzvmWwFyi3Pb8djgCCO5IBqzKJ/Jwo8TRcHyHii0= -github.com/golang/mock v1.6.0 h1:ErTB+efbowRARo13NNdxyJji2egdxLGQhRaY+DUumQc= -github.com/golang/mock v1.6.0/go.mod h1:p6yTPP+5HYm5mzsMV8JkE6ZKdX+/wYM6Hr+LicevLPs= -github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= -github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= -github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4= -github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= -github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= -github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= -github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= -github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= -github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= -github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= -github.com/magiconair/properties v1.8.7 h1:IeQXZAiQcpL9mgcAe1Nu6cX9LLw6ExEHKjN0VQdvPDY= -github.com/magiconair/properties v1.8.7/go.mod h1:Dhd985XPs7jluiymwWYZ0G4Z61jb3vdS329zhj2hYo0= -github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY= -github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= -github.com/pelletier/go-toml/v2 v2.2.3 h1:YmeHyLY8mFWbdkNWwpr+qIL2bEqT0o95WSdkNHvL12M= -github.com/pelletier/go-toml/v2 v2.2.3/go.mod h1:MfCQTFTvCcUyyvvwm1+G6H/jORL20Xlb6rzQu9GuUkc= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/rogpeppe/go-internal v1.9.0 h1:73kH8U+JUqXU8lRuOHeVHaa/SZPifC7BkcraZVejAe8= -github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= -github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= -github.com/sagikazarmark/locafero v0.6.0 h1:ON7AQg37yzcRPU69mt7gwhFEBwxI6P9T4Qu3N51bwOk= -github.com/sagikazarmark/locafero v0.6.0/go.mod h1:77OmuIc6VTraTXKXIs/uvUxKGUXjE1GbemJYHqdNjX0= -github.com/sagikazarmark/slog-shim v0.1.0 h1:diDBnUNK9N/354PgrxMywXnAwEr1QZcOr6gto+ugjYE= -github.com/sagikazarmark/slog-shim v0.1.0/go.mod h1:SrcSrq8aKtyuqEI1uvTDTK1arOWRIczQRv+GVI1AkeQ= -github.com/sourcegraph/conc v0.3.0 h1:OQTbbt6P72L20UqAkXXuLOj79LfEanQ+YQFNpLA9ySo= -github.com/sourcegraph/conc v0.3.0/go.mod h1:Sdozi7LEKbFPqYX2/J+iBAM6HpqSLTASQIKqDmF7Mt0= -github.com/spf13/afero v1.11.0 h1:WJQKhtpdm3v2IzqG8VMqrr6Rf3UYpEF239Jy9wNepM8= -github.com/spf13/afero v1.11.0/go.mod h1:GH9Y3pIexgf1MTIWtNGyogA5MwRIDXGUr+hbWNoBjkY= -github.com/spf13/cast v1.7.0 h1:ntdiHjuueXFgm5nzDRdOS4yfT43P5Fnud6DH50rz/7w= -github.com/spf13/cast v1.7.0/go.mod h1:ancEpBxwJDODSW/UG4rDrAqiKolqNNh2DX3mk86cAdo= -github.com/spf13/cobra v1.8.1 h1:e5/vxKd/rZsfSJMUX1agtjeTDf+qv1/JdBF8gg5k9ZM= -github.com/spf13/cobra v1.8.1/go.mod h1:wHxEcudfqmLYa8iTfL+OuZPbBZkmvliBWKIezN3kD9Y= -github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= -github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= -github.com/spf13/viper v1.19.0 h1:RWq5SEjt8o25SROyN3z2OrDB9l7RPd3lwTWU8EcEdcI= -github.com/spf13/viper v1.19.0/go.mod h1:GQUN9bilAbhU/jgc1bKs99f/suXKeUMct8Adx5+Ntkg= -github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= -github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= -github.com/subosito/gotenv v1.6.0 h1:9NlTDc1FTs4qu0DDq7AEtTPNw6SVm7uBMsUCUjABIf8= -github.com/subosito/gotenv v1.6.0/go.mod h1:Dk4QP5c2W3ibzajGcXpNraDfq2IrhjMIvMSWPKKo0FU= -github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= -go.uber.org/atomic v1.11.0 h1:ZvwS0R+56ePWxUNi+Atn9dWONBPp/AUETXlHW0DxSjE= -go.uber.org/atomic v1.11.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0= -go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= -go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= -golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/exp v0.0.0-20241009180824-f66d83c29e7c h1:7dEasQXItcW1xKJ2+gg5VOiBnqWrJc+rq0DPKyvvdbY= -golang.org/x/exp v0.0.0-20241009180824-f66d83c29e7c/go.mod h1:NQtJDoLvd6faHhE7m4T/1IY708gDefGGjR/iUW8yQQ8= -golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= -golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.26.0 h1:KHjCJyddX0LoSTb3J+vWpupP9p0oznkqVk/IfjymZbo= -golang.org/x/sys v0.26.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= -golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.19.0 h1:kTxAhCbGbxhK0IwgSKiMO5awPoDQ0RpfiVYBfK860YM= -golang.org/x/text v0.19.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= -golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= -golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo= -gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/ini.v1 v1.67.0 h1:Dgnx+6+nfE+IfzjUEISNeydPJh9AXNNsWbGP9KzCsOA= -gopkg.in/ini.v1 v1.67.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= -gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/test/sample_custom_component2/go.mod b/test/sample_custom_component2/go.mod deleted file mode 100644 index 52691189e..000000000 --- a/test/sample_custom_component2/go.mod +++ /dev/null @@ -1,34 +0,0 @@ -module main - -go 1.22.0 - -toolchain go1.23.1 - -require github.com/Azure/azure-storage-fuse/v2 v2.0.0-20241105172709-e53af0f71d8c - -require ( - github.com/JeffreyRichter/enum v0.0.0-20180725232043-2567042f9cda // indirect - github.com/fsnotify/fsnotify v1.8.0 // indirect - github.com/golang/mock v1.6.0 // indirect - github.com/hashicorp/hcl v1.0.0 // indirect - github.com/inconshreveable/mousetrap v1.1.0 // indirect - github.com/magiconair/properties v1.8.7 // indirect - github.com/mitchellh/mapstructure v1.5.0 // indirect - github.com/pelletier/go-toml/v2 v2.2.3 // indirect - github.com/sagikazarmark/locafero v0.6.0 // indirect - github.com/sagikazarmark/slog-shim v0.1.0 // indirect - github.com/sourcegraph/conc v0.3.0 // indirect - github.com/spf13/afero v1.11.0 // indirect - github.com/spf13/cast v1.7.0 // indirect - github.com/spf13/cobra v1.8.1 // indirect - github.com/spf13/pflag v1.0.5 // indirect - github.com/spf13/viper v1.19.0 // indirect - github.com/subosito/gotenv v1.6.0 // indirect - go.uber.org/atomic v1.11.0 // indirect - go.uber.org/multierr v1.11.0 // indirect - golang.org/x/exp v0.0.0-20241009180824-f66d83c29e7c // indirect - golang.org/x/sys v0.26.0 // indirect - golang.org/x/text v0.19.0 // indirect - gopkg.in/ini.v1 v1.67.0 // indirect - gopkg.in/yaml.v3 v3.0.1 // indirect -) diff --git a/test/sample_custom_component2/go.sum b/test/sample_custom_component2/go.sum deleted file mode 100644 index d6efa4b23..000000000 --- a/test/sample_custom_component2/go.sum +++ /dev/null @@ -1,95 +0,0 @@ -github.com/Azure/azure-storage-fuse/v2 v2.0.0-20241105172709-e53af0f71d8c h1:d5qLOkJjrE2yDjNO24I3OINQbzm01zN0pJ0XU+qP4ag= -github.com/Azure/azure-storage-fuse/v2 v2.0.0-20241105172709-e53af0f71d8c/go.mod h1:ZVUBjHdgiZLhcNAXSo8Fk0LPbhcIuQUroqC5PUratkI= -github.com/JeffreyRichter/enum v0.0.0-20180725232043-2567042f9cda h1:NOo6+gM9NNPJ3W56nxOKb4164LEw094U0C8zYQM8mQU= -github.com/JeffreyRichter/enum v0.0.0-20180725232043-2567042f9cda/go.mod h1:2CaSFTh2ph9ymS6goiOKIBdfhwWUVsX4nQ5QjIYFHHs= -github.com/cpuguy83/go-md2man/v2 v2.0.4/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= -github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHkI4W8= -github.com/frankban/quicktest v1.14.6/go.mod h1:4ptaffx2x8+WTWXmUCuVU6aPUX1/Mz7zb5vbUoiM6w0= -github.com/fsnotify/fsnotify v1.8.0 h1:dAwr6QBTBZIkG8roQaJjGof0pp0EeF+tNV7YBP3F/8M= -github.com/fsnotify/fsnotify v1.8.0/go.mod h1:8jBTzvmWwFyi3Pb8djgCCO5IBqzKJ/Jwo8TRcHyHii0= -github.com/golang/mock v1.6.0 h1:ErTB+efbowRARo13NNdxyJji2egdxLGQhRaY+DUumQc= -github.com/golang/mock v1.6.0/go.mod h1:p6yTPP+5HYm5mzsMV8JkE6ZKdX+/wYM6Hr+LicevLPs= -github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= -github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= -github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4= -github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= -github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= -github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= -github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= -github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= -github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= -github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= -github.com/magiconair/properties v1.8.7 h1:IeQXZAiQcpL9mgcAe1Nu6cX9LLw6ExEHKjN0VQdvPDY= -github.com/magiconair/properties v1.8.7/go.mod h1:Dhd985XPs7jluiymwWYZ0G4Z61jb3vdS329zhj2hYo0= -github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY= -github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= -github.com/pelletier/go-toml/v2 v2.2.3 h1:YmeHyLY8mFWbdkNWwpr+qIL2bEqT0o95WSdkNHvL12M= -github.com/pelletier/go-toml/v2 v2.2.3/go.mod h1:MfCQTFTvCcUyyvvwm1+G6H/jORL20Xlb6rzQu9GuUkc= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/rogpeppe/go-internal v1.9.0 h1:73kH8U+JUqXU8lRuOHeVHaa/SZPifC7BkcraZVejAe8= -github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= -github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= -github.com/sagikazarmark/locafero v0.6.0 h1:ON7AQg37yzcRPU69mt7gwhFEBwxI6P9T4Qu3N51bwOk= -github.com/sagikazarmark/locafero v0.6.0/go.mod h1:77OmuIc6VTraTXKXIs/uvUxKGUXjE1GbemJYHqdNjX0= -github.com/sagikazarmark/slog-shim v0.1.0 h1:diDBnUNK9N/354PgrxMywXnAwEr1QZcOr6gto+ugjYE= -github.com/sagikazarmark/slog-shim v0.1.0/go.mod h1:SrcSrq8aKtyuqEI1uvTDTK1arOWRIczQRv+GVI1AkeQ= -github.com/sourcegraph/conc v0.3.0 h1:OQTbbt6P72L20UqAkXXuLOj79LfEanQ+YQFNpLA9ySo= -github.com/sourcegraph/conc v0.3.0/go.mod h1:Sdozi7LEKbFPqYX2/J+iBAM6HpqSLTASQIKqDmF7Mt0= -github.com/spf13/afero v1.11.0 h1:WJQKhtpdm3v2IzqG8VMqrr6Rf3UYpEF239Jy9wNepM8= -github.com/spf13/afero v1.11.0/go.mod h1:GH9Y3pIexgf1MTIWtNGyogA5MwRIDXGUr+hbWNoBjkY= -github.com/spf13/cast v1.7.0 h1:ntdiHjuueXFgm5nzDRdOS4yfT43P5Fnud6DH50rz/7w= -github.com/spf13/cast v1.7.0/go.mod h1:ancEpBxwJDODSW/UG4rDrAqiKolqNNh2DX3mk86cAdo= -github.com/spf13/cobra v1.8.1 h1:e5/vxKd/rZsfSJMUX1agtjeTDf+qv1/JdBF8gg5k9ZM= -github.com/spf13/cobra v1.8.1/go.mod h1:wHxEcudfqmLYa8iTfL+OuZPbBZkmvliBWKIezN3kD9Y= -github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= -github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= -github.com/spf13/viper v1.19.0 h1:RWq5SEjt8o25SROyN3z2OrDB9l7RPd3lwTWU8EcEdcI= -github.com/spf13/viper v1.19.0/go.mod h1:GQUN9bilAbhU/jgc1bKs99f/suXKeUMct8Adx5+Ntkg= -github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= -github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= -github.com/subosito/gotenv v1.6.0 h1:9NlTDc1FTs4qu0DDq7AEtTPNw6SVm7uBMsUCUjABIf8= -github.com/subosito/gotenv v1.6.0/go.mod h1:Dk4QP5c2W3ibzajGcXpNraDfq2IrhjMIvMSWPKKo0FU= -github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= -go.uber.org/atomic v1.11.0 h1:ZvwS0R+56ePWxUNi+Atn9dWONBPp/AUETXlHW0DxSjE= -go.uber.org/atomic v1.11.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0= -go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= -go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= -golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/exp v0.0.0-20241009180824-f66d83c29e7c h1:7dEasQXItcW1xKJ2+gg5VOiBnqWrJc+rq0DPKyvvdbY= -golang.org/x/exp v0.0.0-20241009180824-f66d83c29e7c/go.mod h1:NQtJDoLvd6faHhE7m4T/1IY708gDefGGjR/iUW8yQQ8= -golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= -golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.26.0 h1:KHjCJyddX0LoSTb3J+vWpupP9p0oznkqVk/IfjymZbo= -golang.org/x/sys v0.26.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= -golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.19.0 h1:kTxAhCbGbxhK0IwgSKiMO5awPoDQ0RpfiVYBfK860YM= -golang.org/x/text v0.19.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= -golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= -golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo= -gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/ini.v1 v1.67.0 h1:Dgnx+6+nfE+IfzjUEISNeydPJh9AXNNsWbGP9KzCsOA= -gopkg.in/ini.v1 v1.67.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= -gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= From 941e98ec6b9847991697f67d7cab6f6447d37e4f Mon Sep 17 00:00:00 2001 From: abhiguptacse Date: Thu, 21 Nov 2024 10:58:34 +0000 Subject: [PATCH 4/4] update --- blobfuse2-code-coverage.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/blobfuse2-code-coverage.yaml b/blobfuse2-code-coverage.yaml index 56a76b756..695dafa60 100644 --- a/blobfuse2-code-coverage.yaml +++ b/blobfuse2-code-coverage.yaml @@ -592,7 +592,7 @@ stages: - script: | echo 'mode: count' > ./blobfuse2_coverage_raw.rpt tail -q -n +2 ./*.cov >> ./blobfuse2_coverage_raw.rpt - cat ./blobfuse2_coverage_raw.rpt | grep -v mock_component | grep -v base_component | grep -v loopback | grep -v tools | grep -v "common/log" | grep -v "common/exectime" | grep -v "common/types.go" | grep -v "internal/stats_manager" | grep -v "main.go" | grep -v "component/azstorage/azauthmsi.go" | grep -v "component/azstorage/azauthspn.go" | grep -v "component/stream" | grep -v "component/custom" | grep -v "component/azstorage/azauthcli.go" | grep -v "exported/exported.go" | grep -v "component/block_cache/stream.go" > ./blobfuse2_coverage.rpt + cat ./blobfuse2_coverage_raw.rpt | grep -v mock_component | grep -v base_component | grep -v loopback | grep -v tools | grep -v "common/log" | grep -v "common/exectime" | grep -v "common/types.go" | grep -v "internal/stats_manager" | grep -v "main.go" | grep -v "component/azstorage/azauthmsi.go" | grep -v "component/azstorage/azauthspn.go" | grep -v "component/stream" | grep -v "component/azstorage/azauthcli.go" | grep -v "exported/exported.go" | grep -v "component/block_cache/stream.go" > ./blobfuse2_coverage.rpt go tool cover -func blobfuse2_coverage.rpt > ./blobfuse2_func_cover.rpt go tool cover -html=./blobfuse2_coverage.rpt -o ./blobfuse2_coverage.html go tool cover -html=./blobfuse2_ut.cov -o ./blobfuse2_ut.html