github.com/viant/toolbox@v0.34.5/storage/s3/provider_test.go (about)

     1  package s3
     2  
     3  import (
     4  	"path"
     5  	"testing"
     6  
     7  	"github.com/stretchr/testify/assert"
     8  	"github.com/viant/toolbox"
     9  	"github.com/viant/toolbox/storage"
    10  )
    11  
    12  const s3Url = "s3://path"
    13  const s3Secret = "mock_s3.json"
    14  
    15  //Troubleshooting prod issue with credentials not loading
    16  func TestLoadingCredentialFile(t *testing.T) {
    17  	// Creating absolute path
    18  	fileName, _, _ := toolbox.CallerInfo(2)
    19  	currentPath, _ := path.Split(fileName)
    20  	credentialPath := path.Dir(path.Dir(currentPath)) + "/test/" + s3Secret
    21  	service, err := storage.NewServiceForURL(s3Url, credentialPath)
    22  
    23  	assert.Nil(t, err)
    24  	assert.NotNil(t, service)
    25  
    26  }