File: provider_test.go

package info (click to toggle)
golang-github-viant-toolbox 0.33.2-4
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 1,280 kB
  • sloc: makefile: 16
file content (26 lines) | stat: -rw-r--r-- 607 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
package s3

import (
	"path"
	"testing"

	"github.com/stretchr/testify/assert"
	"github.com/viant/toolbox"
	"github.com/viant/toolbox/storage"
)

const s3Url = "s3://path"
const s3Secret = "mock_s3.json"

//Troubleshooting prod issue with credentials not loading
func TestLoadingCredentialFile(t *testing.T) {
	// Creating absolute path
	fileName, _, _ := toolbox.CallerInfo(2)
	currentPath, _ := path.Split(fileName)
	credentialPath := path.Dir(path.Dir(currentPath)) + "/test/" + s3Secret
	service, err := storage.NewServiceForURL(s3Url, credentialPath)

	assert.Nil(t, err)
	assert.NotNil(t, service)

}