File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ package client
2+
3+ import "testing"
4+
5+ func TestNewClient (t * testing.T ) {
6+ // set required flags
7+ Flags .Endpoint = "http://127.0.0.1:4001"
8+
9+ // instantiate client
10+ _ , err := NewClient ()
11+ if err != nil {
12+ t .Fatal (err )
13+ }
14+ }
Original file line number Diff line number Diff line change 1+ package client
2+
3+ import (
4+ "strings"
5+ "testing"
6+ )
7+
8+ func TestGetTunnelFlag (t * testing.T ) {
9+ flag := getTunnelFlag ()
10+ if flag != "" {
11+ t .Fatalf ("got %v, expected \" \" " , flag )
12+ }
13+ Flags .Tunnel = "hostname:2222"
14+ flag = getTunnelFlag ()
15+ if flag != "hostname:2222" {
16+ t .Fatalf ("got %v, expected \" hostname:2222\" " , flag )
17+ }
18+ Flags .Tunnel = "hostname"
19+ flag = getTunnelFlag ()
20+ if flag != "hostname:22" {
21+ t .Fatalf ("got %v, expected \" hostname:22\" " , flag )
22+ }
23+ }
24+
25+ func TestGetChecker (t * testing.T ) {
26+ Flags .StrictHostKeyChecking = false
27+ checker := getChecker ()
28+ if checker != nil {
29+ t .Fatalf ("expected nil checker, got %v" , checker )
30+ }
31+ }
32+
33+ func TestFakeClient (t * testing.T ) {
34+ _ , err := getFakeClient ()
35+ if err != nil {
36+ t .Fatal (err )
37+ }
38+ }
39+
40+ func TestRegistryClient (t * testing.T ) {
41+ Flags .Endpoint = "http://127.0.0.1:4001"
42+ _ , err := getRegistryClient ()
43+ if err != nil && ! strings .Contains (err .Error (), "no such host" ) {
44+ t .Fatal (err )
45+ }
46+ }
You can’t perform that action at this time.
0 commit comments