Skip to content

Commit 5373803

Browse files
committed
no need to expose port
1 parent 37181f5 commit 5373803

File tree

1 file changed

+2
-39
lines changed

1 file changed

+2
-39
lines changed

e2e/cluster/cmx/cluster.go

Lines changed: 2 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,8 @@ type Node struct {
3838
ID string `json:"id"`
3939
Name string `json:"name"`
4040

41-
privateIP string `json:"-"`
42-
sshEndpoint string `json:"-"`
43-
adminConsoleURL string `json:"-"`
41+
privateIP string `json:"-"`
42+
sshEndpoint string `json:"-"`
4443
}
4544

4645
type Network struct {
@@ -166,15 +165,6 @@ func NewNode(in *ClusterInput, index int, networkID string) (*Node, error) {
166165
return nil, fmt.Errorf("copy playwright to node %s: %v", node.Name, err)
167166
}
168167

169-
if index == 0 {
170-
in.T.Logf("exposing port 30003 on node %s", node.Name)
171-
hostname, err := exposePort(node, "30003")
172-
if err != nil {
173-
return nil, fmt.Errorf("expose port: %v", err)
174-
}
175-
node.adminConsoleURL = fmt.Sprintf("http://%s", hostname)
176-
}
177-
178168
return &node, nil
179169
}
180170

@@ -483,33 +473,6 @@ func (c *Cluster) copyPlaywrightReport() {
483473
}
484474
}
485475

486-
func exposePort(node Node, port string) (string, error) {
487-
output, err := exec.Command("replicated", "vm", "port", "expose", node.ID, "--port", port).CombinedOutput()
488-
if err != nil {
489-
return "", fmt.Errorf("expose port: %v: %s", err, string(output))
490-
}
491-
492-
output, err = exec.Command("replicated", "vm", "port", "ls", node.ID, "-ojson").Output() // stderr can break json parsing
493-
if err != nil {
494-
if exitErr, ok := err.(*exec.ExitError); ok {
495-
return "", fmt.Errorf("get port info: %w: stderr: %s: stdout: %s", err, string(exitErr.Stderr), string(output))
496-
}
497-
return "", fmt.Errorf("get port info: %w: stdout: %s", err, string(output))
498-
}
499-
500-
var ports []struct {
501-
Hostname string `json:"hostname"`
502-
}
503-
if err := json.Unmarshal(output, &ports); err != nil {
504-
return "", fmt.Errorf("unmarshal port info: %v", err)
505-
}
506-
507-
if len(ports) == 0 {
508-
return "", fmt.Errorf("no ports found for node %s", node.ID)
509-
}
510-
return ports[0].Hostname, nil
511-
}
512-
513476
func copyFileToNode(node Node, src, dst string) error {
514477
scpEndpoint := strings.Replace(node.sshEndpoint, "ssh://", "scp://", 1)
515478

0 commit comments

Comments
 (0)