File: scaleway_discover_test.go

package info (click to toggle)
golang-github-hashicorp-go-discover 0.0%2Bgit20190905.34a6505-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 480 kB
  • sloc: makefile: 9
file content (39 lines) | stat: -rw-r--r-- 824 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
27
28
29
30
31
32
33
34
35
36
37
38
39
package scaleway_test

import (
	"log"
	"os"
	"testing"

	discover "github.com/hashicorp/go-discover"
	"github.com/hashicorp/go-discover/provider/scaleway"
)

var _ discover.Provider = (*scaleway.Provider)(nil)

func TestAddrs(t *testing.T) {
	args := discover.Config{
		"provider":     "scaleway",
		"organization": os.Getenv("SCALEWAY_ORGANIZATION"),
		"token":        os.Getenv("SCALEWAY_TOKEN"),
		"tag_name":     "consul-server",
		"region":       os.Getenv("SCALEWAY_REGION"),
	}
	if args["organization"] == "" {
		t.Skip("Scaleway organization missing")
	}

	if args["token"] == "" {
		t.Skip("Scaleway token missing")
	}

	p := &scaleway.Provider{}
	l := log.New(os.Stderr, "", log.LstdFlags)
	addrs, err := p.Addrs(args, l)
	if err != nil {
		t.Fatal(err)
	}
	if len(addrs) != 2 {
		t.Fatalf("bad: %v", addrs)
	}
}