Debian Codegraph @

provider/scaleway/scaleway_discover_test.go

raw symbols SCIP
1 package scaleway_test
2
3 import (
4 "log"
5 "os"
6 "testing"
7
8 discover "github.com/hashicorp/go-discover"
9 "github.com/hashicorp/go-discover/provider/scaleway"
10 )
11
12 var _ discover.Provider = (*scaleway.Provider)(nil)
13
14 func TestAddrs(t *testing.T) {
15 args := discover.Config{
16 "provider": "scaleway",
17 "organization": os.Getenv("SCALEWAY_ORGANIZATION"),
18 "token": os.Getenv("SCALEWAY_TOKEN"),
19 "tag_name": "consul-server",
20 "region": os.Getenv("SCALEWAY_REGION"),
21 }
22 if args["organization"] == "" {
23 t.Skip("Scaleway organization missing")
24 }
25
26 if args["token"] == "" {
27 t.Skip("Scaleway token missing")
28 }
29
30 p := &scaleway.Provider{}
31 l := log.New(os.Stderr, "", log.LstdFlags)
32 addrs, err := p.Addrs(args, l)
33 if err != nil {
34 t.Fatal(err)
35 }
36 if len(addrs) != 2 {
37 t.Fatalf("bad: %v", addrs)
38 }
39 }