forked from TrueCloudLab/lego
Read test connection credentials from env vars
Signed-off-by: Vitaliy Potyarkin <v.potyarkin@yadro.com>
This commit is contained in:
parent
bb87c097ba
commit
23e60f1e98
1 changed files with 9 additions and 9 deletions
|
@ -9,22 +9,22 @@ import (
|
||||||
"crypto/ecdsa"
|
"crypto/ecdsa"
|
||||||
"crypto/elliptic"
|
"crypto/elliptic"
|
||||||
"crypto/rand"
|
"crypto/rand"
|
||||||
|
"os"
|
||||||
"sync"
|
"sync"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// Initialize storage backend for tests
|
||||||
func openStorage(t *testing.T) *Storage {
|
func openStorage(t *testing.T) *Storage {
|
||||||
const (
|
cid := os.Getenv("FROSTFS_CID") // example: 348WWfBKbS79Wbmm38MRE3oBoEDM5Ga1XXbGKGNyisDM
|
||||||
cid_hardcoded = "348WWfBKbS79Wbmm38MRE3oBoEDM5Ga1XXbGKGNyisDM"
|
endpoint := os.Getenv("FROSTFS_ENDPOINT") // example: grpc://localhost:8802
|
||||||
endpoint_hardcoded = "grpc://localhost:8802"
|
if cid == "" || endpoint == "" {
|
||||||
)
|
t.Skipf("one or more environment variables not set: FROSTFS_ENDPOINT, FROSTFS_CID")
|
||||||
|
}
|
||||||
// We will use an ephemeral key to write to publicly writable container
|
key, err := ecdsa.GenerateKey(elliptic.P256(), rand.Reader) // TODO: using ephemeral keys for now, later read from env vars
|
||||||
key, err := ecdsa.GenerateKey(elliptic.P256(), rand.Reader)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
storage, err := Open(endpoint, cid, key)
|
||||||
storage, err := Open(endpoint_hardcoded, cid_hardcoded, key)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue