Skip to content
This repository was archived by the owner on Jul 30, 2021. It is now read-only.

Commit 8fb508e

Browse files
author
Ryan Phillips
committed
run e2e locally
1 parent efb0e91 commit 8fb508e

File tree

2 files changed

+23
-3
lines changed

2 files changed

+23
-3
lines changed

e2e/node.go

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,21 +23,32 @@ func newNode(n *v1.Node) *Node {
2323
return &Node{n}
2424
}
2525

26-
func (n *Node) ExternalIP() string {
26+
func (n *Node) GetIPByType(addrType v1.NodeAddressType) string {
2727
var host string
2828
for _, addr := range n.Status.Addresses {
29-
if addr.Type == v1.NodeExternalIP {
29+
if addr.Type == addrType {
3030
host = addr.Address
3131
break
3232
}
3333
}
3434
return host
3535
}
3636

37+
func (n *Node) ExternalIP() string {
38+
return n.GetIPByType(v1.NodeExternalIP)
39+
}
40+
41+
func (n *Node) InternalIP() string {
42+
return n.GetIPByType(v1.NodeInternalIP)
43+
}
44+
3745
func (n *Node) SSH(cmd string) (stdout, stderr []byte, err error) {
3846
host := n.ExternalIP()
3947
if host == "" {
40-
return nil, nil, fmt.Errorf("cannot find external IP for node %q", n.Name)
48+
host = n.InternalIP()
49+
if host == "" {
50+
return nil, nil, fmt.Errorf("cannot find external or internal IP for node %q", n.Name)
51+
}
4152
}
4253
return sshClient.SSH(host, cmd)
4354
}

hack/multi-node/README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,15 @@ This will generate the default assets in the `cluster` directory and launch mult
1010
./bootkube-up
1111
```
1212

13+
## Running E2E tests
14+
15+
```
16+
$ ssh-add ~/.vagrant.d/insecure_private_key
17+
$ export KUBECONFIG=$PWD/cluster/auth/kubeconfig
18+
$ cd ../.. # project root
19+
$ go test -v ./e2e/ --kubeconfig=$KUBECONFIG
20+
```
21+
1322
## Cleaning up
1423

1524
To stop the running cluster and remove generated assets, run:

0 commit comments

Comments
 (0)